BlobCheckpointStore Class

A CheckpointStore that uses Azure Blob Storage to store the partition ownership and checkpoint data.

This class implements methods list_ownership, claim_ownership, update_checkpoint and list_checkpoints that are defined in class azure.eventhub.aio.CheckpointStore of package azure-eventhub.

Inheritance
azure.eventhub.aio._eventprocessor.checkpoint_store.CheckpointStore
BlobCheckpointStore

Constructor

BlobCheckpointStore(blob_account_url, container_name, *, credential=None, **kwargs)

Parameters

blob_account_url
str
Required

The URI to the storage account.

container_name
str
Required

The name of the container for the blobs.

credential
Required

The credentials with which to authenticate. This is optional if the account URL already has a SAS token. The value can be a SAS token string, an account shared access key, or an instance of a TokenCredentials class from azure.identity. If the URL already has a SAS token, specifying an explicit credential will take priority.

api_version
str

The Storage API version to use for requests. Default value is '2019-07-07'.

secondary_hostname
str

The hostname of the secondary endpoint.

Methods

claim_ownership

Tries to claim ownership for a list of specified partitions.

close

Close an open HTTP session and connection.

from_connection_string

Create BlobCheckpointStore from a storage connection string.

list_checkpoints

List the updated checkpoints from the storage blob.

list_ownership

Retrieves a complete ownership list from the storage blob.

update_checkpoint

Updates the checkpoint using the given information for the offset, associated partition and consumer group in the storage blob.

Note: If you plan to implement a custom checkpoint store with the intention of running between cross-language EventHubs SDKs, it is recommended to persist the offset value as an integer.

claim_ownership

Tries to claim ownership for a list of specified partitions.

async claim_ownership(ownership_list: Iterable[Dict[str, Any]], **kwargs: Any) -> Iterable[Dict[str, Any]]

Parameters

ownership_list
<xref:Iterable>[<xref:Dict>[<xref:str,Any>]]
Required

Iterable of dictionaries containing all the ownerships to claim.

Return type

<xref:Iterable>[<xref:Dict>[<xref:str,Any>]], <xref:Iterable of dictionaries containing partition ownership information:* *fully_qualified_namespace* >(str)<xref:: The fully qualified namespace that the Event Hub belongs to. The format is like "<namespace.servicebus.windows.net". * *eventhub_name* >(str)<xref:: The name of the specific Event Hub the checkpoint is associated with>, <xref:relative to the Event Hubs namespace that contains it. * *consumer_group* >(str)<xref:: The name of the consumer group the ownership are associated with. * *partition_id* >(str)<xref:: The partition ID which the checkpoint is created for. * *owner_id* >(str)<xref:: A UUID representing the owner attempting to claim this partition. * *last_modified_time* >(<xref:UTC datetime.datetime>)<xref:: The last time this ownership was claimed. * *etag* >(str)<xref:: The Etag value for the last time this ownership was modified. Optional depending on storage implementation.>

close

Close an open HTTP session and connection.

async close() -> None

from_connection_string

Create BlobCheckpointStore from a storage connection string.

from_connection_string(conn_str: str, container_name: str, *, credential: Optional[Any] = None, **kwargs: Optional[Any]) -> azure.eventhub.extensions.checkpointstoreblobaio._blobstoragecsaio.BlobCheckpointStore

Parameters

conn_str
str
Required

A connection string to an Azure Storage account.

container_name
str
Required

The container name for the blobs.

credential
Required

The credentials with which to authenticate. This is optional if the account URL already has a SAS token, or the connection string already has shared access key values. The value can be a SAS token string, an account shared access key, or an instance of a TokenCredentials class from azure.identity. Credentials provided here will take precedence over those in the connection string.

api_version
str

The Storage API version to use for requests. Default value is '2019-07-07'.

secondary_hostname
str

The hostname of the secondary endpoint.

Returns

A blob checkpoint store.

Return type

list_checkpoints

List the updated checkpoints from the storage blob.

async list_checkpoints(fully_qualified_namespace, eventhub_name, consumer_group, **kwargs)

Parameters

fully_qualified_namespace
str
Required

The fully qualified namespace that the Event Hub belongs to. The format is like ".servicebus.windows.net".

eventhub_name
str
Required

The name of the specific Event Hub the checkpoints are associated with, relative to the Event Hubs namespace that contains it.

consumer_group
str
Required

The name of the consumer group the checkpoints are associated with.

Return type

<xref:Iterable>[<xref:Dict>[<xref:str,Any>]], <xref:Iterable of dictionaries containing partition checkpoint information:* *fully_qualified_namespace* >(str)<xref:: The fully qualified namespace that the Event Hub belongs to. The format is like "<namespace.servicebus.windows.net". * *eventhub_name* >(str)<xref:: The name of the specific Event Hub the checkpoints are associated with>, <xref:relative to the Event Hubs namespace that contains it. * *consumer_group* >(str)<xref:: The name of the consumer group the checkpoints are associated with. * *partition_id* >(str)<xref:: The partition ID which the checkpoint is created for. * *sequence_number* >(int)<xref:: The sequence number of the azure.eventhub.EventData. * *offset* >(str)<xref:: The offset of the azure.eventhub.EventData.>

list_ownership

Retrieves a complete ownership list from the storage blob.

async list_ownership(fully_qualified_namespace: str, eventhub_name: str, consumer_group: str, **kwargs: Any) -> Iterable[Dict[str, Any]]

Parameters

fully_qualified_namespace
str
Required

The fully qualified namespace that the Event Hub belongs to. The format is like ".servicebus.windows.net".

eventhub_name
str
Required

The name of the specific Event Hub the partition ownerships are associated with, relative to the Event Hubs namespace that contains it.

consumer_group
str
Required

The name of the consumer group the ownerships are associated with.

Return type

<xref:Iterable>[<xref:Dict>[str, <xref:Any>]], <xref:Iterable of dictionaries containing partition ownership information:* *fully_qualified_namespace* >(str)<xref:: The fully qualified namespace that the Event Hub belongs to. The format is like "<namespace.servicebus.windows.net". * *eventhub_name* >(str)<xref:: The name of the specific Event Hub the checkpoint is associated with>, <xref:relative to the Event Hubs namespace that contains it. * *consumer_group* >(str)<xref:: The name of the consumer group the ownership are associated with. * *partition_id* >(str)<xref:: The partition ID which the checkpoint is created for. * *owner_id* >(str)<xref:: A UUID representing the current owner of this partition. * *last_modified_time* >(<xref:UTC datetime.datetime>)<xref:: The last time this ownership was claimed. * *etag* >(str)<xref:: The Etag value for the last time this ownership was modified. Optional depending on storage implementation.>

update_checkpoint

Updates the checkpoint using the given information for the offset, associated partition and consumer group in the storage blob.

Note: If you plan to implement a custom checkpoint store with the intention of running between cross-language EventHubs SDKs, it is recommended to persist the offset value as an integer.

async update_checkpoint(checkpoint: Dict[str, Any], **kwargs: Any) -> None

Parameters

checkpoint
<xref:Dict>[<xref:str,Any>]
Required

A dict containing checkpoint information:

  • fully_qualified_namespace (str): The fully qualified namespace that the Event Hub belongs to. The format is like ".servicebus.windows.net".

  • eventhub_name (str): The name of the specific Event Hub the checkpoint is associated with, relative to the Event Hubs namespace that contains it.

  • consumer_group (str): The name of the consumer group the checkpoint is associated with.

  • partition_id (str): The partition ID which the checkpoint is created for.

  • sequence_number (int): The sequence number of the EventData the new checkpoint will be associated with.

  • offset (str): The offset of the EventData the new checkpoint will be associated with.

Return type