protected void unregister(String name, String consumerGroup) { this.clientFactory.getOrCreateEventProcessorHost(name, consumerGroup).unregisterEventProcessor() .whenComplete((s, t) -> { if (t != null) { log.warn(String.format("Failed to unregister consumer '%s' with group '%s'", name, consumerGroup), t); } }); }
private CompletableFuture<Void> doSend(String eventHubName, PartitionSupplier partitionSupplier, List<EventData> eventData) { try { EventHubClient client = this.clientFactory.getOrCreateClient(eventHubName); if (partitionSupplier == null) { return client.send(eventData); } else if (!Strings.isNullOrEmpty(partitionSupplier.getPartitionId())) { return this.clientFactory.getOrCreatePartitionSender(eventHubName, partitionSupplier.getPartitionId()) .send(eventData); } else if (!Strings.isNullOrEmpty(partitionSupplier.getPartitionKey())) { return client.send(eventData, partitionSupplier.getPartitionKey()); } else { return client.send(eventData); } } catch (EventHubRuntimeException e) { log.error(String.format("Failed to send to '%s' ", eventHubName), e); CompletableFuture<Void> future = new CompletableFuture<>(); future.completeExceptionally(e); return future; } }
private CompletableFuture<Void> doSend(String eventHubName, PartitionSupplier partitionSupplier, List<EventData> eventData) { try { EventHubClient client = this.clientFactory.getOrCreateClient(eventHubName); if (partitionSupplier == null) { return client.send(eventData); } else if (!Strings.isNullOrEmpty(partitionSupplier.getPartitionId())) { return this.clientFactory.getOrCreatePartitionSender(eventHubName, partitionSupplier.getPartitionId()) .send(eventData); } else if (!Strings.isNullOrEmpty(partitionSupplier.getPartitionKey())) { return client.send(eventData, partitionSupplier.getPartitionKey()); } else { return client.send(eventData); } } catch (EventHubRuntimeException e) { log.error(String.format("Failed to send to '%s' ", eventHubName), e); CompletableFuture<Void> future = new CompletableFuture<>(); future.completeExceptionally(e); return future; } }
protected void unregister(String name, String consumerGroup) { this.clientFactory.getOrCreateEventProcessorHost(name, consumerGroup).unregisterEventProcessor() .whenComplete((s, t) -> { if (t != null) { log.warn(String.format("Failed to unregister consumer '%s' with group '%s'", name, consumerGroup), t); } }); }
protected void register(String name, String consumerGroup, EventHubProcessor eventProcessor) { EventProcessorHost host = this.clientFactory.getOrCreateEventProcessorHost(name, consumerGroup); host.registerEventProcessorFactory(context -> eventProcessor, buildEventProcessorOptions(startPosition)); }
protected void register(String name, String consumerGroup, EventHubProcessor eventProcessor) { EventProcessorHost host = this.clientFactory.getOrCreateEventProcessorHost(name, consumerGroup); host.registerEventProcessorFactory(context -> eventProcessor, buildEventProcessorOptions(startPosition)); }