Search in sources :

Example 1 with EventHubClient

use of com.microsoft.azure.eventhubs.EventHubClient in project nifi by apache.

the class PutAzureEventHub method setupClient.

@OnScheduled
public final void setupClient(final ProcessContext context) throws ProcessException {
    final String policyName = context.getProperty(ACCESS_POLICY).getValue();
    final String policyKey = context.getProperty(POLICY_PRIMARY_KEY).getValue();
    final String namespace = context.getProperty(NAMESPACE).getValue();
    final String eventHubName = context.getProperty(EVENT_HUB_NAME).getValue();
    final int numThreads = context.getMaxConcurrentTasks();
    senderQueue = new LinkedBlockingQueue<>(numThreads);
    for (int i = 0; i < numThreads; i++) {
        final EventHubClient client = createEventHubClient(namespace, eventHubName, policyName, policyKey);
        if (null != client) {
            senderQueue.offer(client);
        }
    }
}
Also used : EventHubClient(com.microsoft.azure.eventhubs.EventHubClient) OnScheduled(org.apache.nifi.annotation.lifecycle.OnScheduled)

Aggregations

EventHubClient (com.microsoft.azure.eventhubs.EventHubClient)1 OnScheduled (org.apache.nifi.annotation.lifecycle.OnScheduled)1