Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attach names for all producers/readers in worker service #7165

Merged
merged 3 commits into from
Jun 5, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public void initialize() {
Reader<byte[]> reader = pulsarClient.newReader()
.topic(this.workerConfig.getFunctionMetadataTopic())
.startMessageId(MessageId.earliest)
.readerName(workerConfig.getWorkerId() + "-function-metadata-manager")
jerrypeng marked this conversation as resolved.
Show resolved Hide resolved
.create();

this.functionMetaDataTopicTailer = new FunctionMetaDataTopicTailer(this, reader);
Expand Down Expand Up @@ -432,6 +433,9 @@ public void close() throws Exception {
}

private ServiceRequestManager getServiceRequestManager(PulsarClient pulsarClient, String functionMetadataTopic) throws PulsarClientException {
return new ServiceRequestManager(pulsarClient.newProducer().topic(functionMetadataTopic).create());
return new ServiceRequestManager(pulsarClient.newProducer()
.topic(functionMetadataTopic)
.producerName(workerConfig.getWorkerId() + "-function-metadata-manager")
.create());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ public void initialize() {
log.info("/** Initializing Runtime Manager **/");
try {
Reader<byte[]> reader = this.getWorkerService().getClient().newReader()
.readerName(workerConfig.getWorkerId() + "-function-runtime-manager")
.topic(this.getWorkerConfig().getFunctionAssignmentTopic()).readCompacted(true)
.startMessageId(MessageId.earliest).create();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ private static Producer<byte[]> createProducer(PulsarClient client, WorkerConfig
.blockIfQueueFull(true)
.compressionType(CompressionType.LZ4)
.sendTimeout(0, TimeUnit.MILLISECONDS)
.producerName(config.getWorkerId() + "-scheduler-manager")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you also add

.subscriptionRolePrefix(workerConfig.getWorkerId())

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Producer name needs to be unique, so we better put this in the producer properties instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, in this case it should be good since there's only 1 writer.

.createAsync().get(10, TimeUnit.SECONDS);
return Actions.ActionResult.builder().success(true).result(producer).build();
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -994,10 +994,17 @@ public String triggerFunction(final String tenant,
Producer<byte[]> producer = null;
try {
if (outputTopic != null && !outputTopic.isEmpty()) {
reader = worker().getClient().newReader().topic(outputTopic).startMessageId(MessageId.latest).create();
reader = worker().getClient().newReader()
.topic(outputTopic)
.startMessageId(MessageId.latest)
.readerName(worker().getWorkerConfig().getWorkerId() + "-trigger-" +
FunctionCommon.getFullyQualifiedName(tenant, namespace, functionName))
.create();
}
producer = worker().getClient().newProducer(Schema.AUTO_PRODUCE_BYTES())
.topic(inputTopicToWrite)
.producerName(worker().getWorkerConfig().getWorkerId() + "-trigger-" +
FunctionCommon.getFullyQualifiedName(tenant, namespace, functionName))
.create();
byte[] targetArray;
if (uploadedInputStream != null) {
Expand Down