Class BlobCheckpointStore

java.lang.Object
com.azure.messaging.eventhubs.checkpointstore.blob.BlobCheckpointStore
All Implemented Interfaces:
CheckpointStore

public class BlobCheckpointStore extends Object implements CheckpointStore
Implementation of CheckpointStore that uses Storage Blobs for persisting partition ownership and checkpoint information. EventProcessors can use this implementation to load balance and update checkpoints.
See Also:
  • Field Details

  • Constructor Details

    • BlobCheckpointStore

      public BlobCheckpointStore(BlobContainerAsyncClient blobContainerAsyncClient)
      Creates an instance of BlobCheckpointStore.
      Parameters:
      blobContainerAsyncClient - The BlobContainerAsyncClient this instance will use to read and update blobs in the storage container.
  • Method Details

    • listOwnership

      public Flux<PartitionOwnership> listOwnership(String fullyQualifiedNamespace, String eventHubName, String consumerGroup)
      This method is called by the EventProcessorClient to get the list of all existing partition ownership from the Storage Blobs. Could return empty results if there are is no existing ownership information.
      Specified by:
      listOwnership in interface CheckpointStore
      Parameters:
      eventHubName - The Event Hub name to get ownership information.
      consumerGroup - The consumer group name.
      fullyQualifiedNamespace - The fully qualified namespace of the Event Hub. This is likely to be similar to "{your-namespace}.servicebus.windows.net".
      Returns:
      A flux of partition ownership details of all the partitions that have/had an owner.
    • listCheckpoints

      public Flux<Checkpoint> listCheckpoints(String fullyQualifiedNamespace, String eventHubName, String consumerGroup)
      Description copied from interface: CheckpointStore
      Called to get the list of checkpoints from the underlying data store. This method could return empty results if there are no checkpoints available in the data store.
      Specified by:
      listCheckpoints in interface CheckpointStore
      Parameters:
      fullyQualifiedNamespace - The fully qualified namespace of the Event Hub.
      eventHubName - The Event Hub name to get checkpoint information.
      consumerGroup - The consumer group name associated with the checkpoint.
      Returns:
      A Flux of checkpoints associated with the partitions of the Event Hub.
    • claimOwnership

      public Flux<PartitionOwnership> claimOwnership(List<PartitionOwnership> requestedPartitionOwnerships)
      This method is called by the EventProcessorClient to claim ownership of a list of partitions. This will return the list of partitions that were owned successfully.
      Specified by:
      claimOwnership in interface CheckpointStore
      Parameters:
      requestedPartitionOwnerships - List of partition ownerships this instance is requesting to own.
      Returns:
      A flux of partitions this instance successfully claimed ownership.
    • updateCheckpoint

      public Mono<Void> updateCheckpoint(Checkpoint checkpoint)
      Updates the checkpoint in Storage Blobs for a partition.
      Specified by:
      updateCheckpoint in interface CheckpointStore
      Parameters:
      checkpoint - Checkpoint information containing sequence number and offset to be stored for this partition.
      Returns:
      The new ETag on successful update.