I want to read events only once from Azure Event hub so that event gets processed only once. But while reading these events getting same event in all partitions.
Tech Stack - Spring boot to read events via
EventProcessorHost host = EventProcessorHost.EventProcessorHostBuilder
.newBuilder(EventProcessorHost.createHostName(hostNamePrefix),
consumerGroupName)
.useAzureStorageCheckpointLeaseManager(storageConnectionString, storageContainerName, null)
.useEventHubConnectionString(eventHubConnectionString.toString(), eventHubName)
.build();
Thanks.
You can create up to
32
partition on Eventhub but when you send a message that will go only on single partition (if you would not putpartition-id
, Eventhub will send message to random partition )maybe issue with your code, To confirm this behaviour you can use Microsoft ServiceBusExplorer to send and receive messages from Eventhub. When you will create Eventhub listener through Service bus you can receive partition-id and messages in real-time.