We recently deployed azure event-hub java receiver/listener client by following azure-docs.
I truly believe arrays starts with 0, but that has nothing to do with this question. So anyways, I observed the following error raised from processError
& also processPartitionClose
Error occurred in partition14 - connectionId[MF_5fba9c_1636350888640] sessionName[eventhub-name/ConsumerGroups/consumer-group-name/Partitions/14] entityPath[eventhub-name/ConsumerGroups/consumer-group-name/Partitions/14] linkName[14_500701_1636350888641] Cannot create receive link from a closed session., errorContext[NAMESPACE: namespace.servicebus.windows.net. ERROR CONTEXT: N/A, PATH: eventhub-name/ConsumerGroups/consumer-group-name/Partitions/14]
ERROR | Partition has been lost 14 reason LOST_PARTITION_OWNERSHIP
Question :
- Do azure-sdk-for-java-sdk-eventhubs reconnect on such partition lost automatically ?
- If NOT then what is the best practice before restarting manually ?
- do I need to update the checkpoint manually ?
- do I need to do anything on the ownership ?
This is our sdk setup with Sample Code
EventProcessorClientBuilder eventProcessorClientBuilder = new EventProcessorClientBuilder()
.checkpointStore(new BlobCheckpointStore(blobContainerAsyncClient))
.connectionString(getEventHubConnectionString(), getEventHubName())
.consumerGroup(getConsumerGroup())
.initialPartitionEventPosition(initialPartitionEventPosition)
.processEvent(PARTITION_PROCESSOR)
.processError(ERROR_HANDLER)
.processPartitionClose(CLOSE_HANDLER);
EventProcessorClient eventProcessorClient = eventProcessorClientBuilder.buildEventProcessorClient();
// Starts the event processor
eventProcessorClient.start();
private final Consumer < ErrorContext > ERROR_HANDLER = errorContext->{
log.error("Error occurred in partition" + errorContext.getPartitionContext().getPartitionId()
+ " - " + errorContext.getThrowable().getMessage());
};
private final Consumer < CloseContext > CLOSE_HANDLER = closeContext->{
log.error("Partition has been lost " + closeContext.getPartitionContext().getPartitionId()
+ " reason " + closeContext.getCloseReason());
EventContext lastContext = lastEvent.get();
if (lastContext != null && (lastContext.getEventData().getSequenceNumber() % 10) != 0) {
lastContext.updateCheckpoint();
}
};
jdk : 1.8
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-messaging-eventhubs-checkpointstore-blob</artifactId>
<version>1.10.0</version>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-messaging-eventhubs</artifactId>
<version>5.10.1</version>
</dependency>
I did come across github-issue-15164 but could not find it anywhere mentioned.