Migrating from Microsoft.Azure.EventHubs to Azure.Messaging.EventHubs . What do i need to do to make sure new SDK deployment picks up from checkpoint made by older SDK

Soumya Prateek Raul 40 Reputation points Microsoft Employee
2024-06-19T08:21:22.41+00:00

Migrating from Microsoft.Azure.EventHubs to Azure.Messaging.EventHubs . Read from docs online that new SDK doesnt support old checkpointing format . What do i need to do to make sure new SDK deployment picks up from checkpoint made by older SDK

Azure Event Hubs
Azure Event Hubs
An Azure real-time data ingestion service.
648 questions
{count} votes

1 answer

Sort by: Most helpful
  1. PRADEEPCHEEKATLA 90,241 Reputation points
    2024-06-30T14:59:45.81+00:00

    @Soumya Prateek Raul - Thank you for sharing this information. It's good to know that you were able to override the default behavior of the new SDK by passing a function to eventProcessorClient.PartitionInitializingAsync.

    As you mentioned, the new SDK follows a different folder format for the checkpointing store than the old SDK. If you want to use the new SDK with the checkpoint data created by the old SDK, you need to migrate the checkpoint data to the new format. You can use the BlobCheckpointStore class in the new SDK to store the checkpoint data in the new format.

    Here's an example of how to use the BlobCheckpointStore class to store the checkpoint data in the new format:

    from azure.eventhub import EventHubConsumerClient
    from azure.eventhub.extensions.checkpointstoreblob import BlobCheckpointStore
    from azure.messaging.eventhubs import EventProcessorClient
    
    # Create a BlobCheckpointStore object to store the checkpoint data in the new format
    checkpoint_store = BlobCheckpointStore.from_connection_string(
        "<connection-string>",
        "<blob-container-name>"
    )
    
    # Create an EventProcessorClient object to read from the Event Hub
    event_processor_client = EventProcessorClient(
        eventhub_connection_str="<connection-string>",
        consumer_group="<consumer-group-name>",
        eventhub_name="<event-hub-name>",
        checkpoint_store=checkpoint_store
    )
    
    # Start reading from the Event Hub
    event_processor_client.start()
    

    In this example,, you create a BlobCheckpointStore object to store the checkpoint data in the new format, and then create an EventProcessorClient object to read from the Event Hub. You pass the BlobCheckpointStore object to the EventProcessorClient constructor as the checkpoint_store parameter.

    After creating the EventProcessorClient object, you call the start method to start reading from the Event Hub.

    I hope this helps! Let me know if you have any other questions.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.