mysunnytime commented on a change in pull request #3676: NIFI-6597 Azure Event
Hub Version Update
URL: https://github.com/apache/nifi/pull/3676#discussion_r333223470
##########
File path:
nifi-nar-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/eventhub/GetAzureEventHub.java
##########
@@ -312,11 +317,13 @@ public void onScheduled(final ProcessContext context)
throws ProcessException, U
receiverFetchTimeout = null;
}
- final String connectionString = new ConnectionStringBuilder(new
URI("amqps://"+namespace+serviceBusEndpoint), eventHubName, policyName,
policyKey).toString();
- setupReceiver(connectionString);
+ final int numThreads = context.getMaxConcurrentTasks();
+ executor = Executors.newScheduledThreadPool(numThreads);
Review comment:
We have to use executor because in the new api we need
ScheduledExecutorService to create EventHubClient. But I'm not sure whether we
should create the ScheduledExecutorService in onScheduled or onTrigger.
My understanding is that in **onScheduled**, where we prepare the processor
to be ready to work, we set up EventHubClient here, and now we need to create
this EventHubClient with a ScheduledExecutorService, and in **onTrigger**, we
use EventHubClient to receive msg or send msg. So before we set up
EventHubClient, we need to have a ScheduledExecutorService. So it should be in
the same (or earlier) place. Also we don't want the ScheduledExecutorService to
be created everytime when we wanna send/receive msg (i.e., in onTrigger), so I
think it should still be in onScheduled.
Please tell me what you think, and correct me if I understand onSchedule and
onTrigger incorrectly.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services