问题
I am using EPH ( EventProcessorHost) class of Azure python SDK to receive events from the eventhub.
It actually uses AzureStorageCheckpointLeaseManager
for checkpointing and partitioning in the storage account. But I cannot see where I can write the full path of the storage account. Like it directly create files inside the specified container in the storage account. I would like to give the full path inside the container. Where can I do that?
回答1:
Here is my research:
In AzureStorageCheckpointLeaseManager
, there is a parameter storage_blob_prefix
, which should be used to set blob prefix(means directory for the checkpoint blob). But actually it does not work.
After going through the source code of azure_storage_checkpoint_manager.py
, I can see storage_blob_prefix is actually assigned to consumer_group_directory, but consumer_group_directory is never used to create the blob for checkpoint. Instead, it just creates the blob directly inside the container.
So the fix is that we can modify the azure_storage_checkpoint_manager.py
, by using lease_container_name + consumer_group_directory to create the checkpoint blob. I modified it and uploaded it github. It can work well to create a directory for the checkpoint blob as expected.
来源:https://stackoverflow.com/questions/59207767/how-to-provide-the-complete-path-of-the-container-in-azurestoragecheckpointlease