Skip to content

Allow custom owner_id in azure-eventhub EventProcessor's receive/receive_batch #40949

Description

@dikuchan

Is your feature request related to a problem? Please describe.
Currently, the EventProcessor in azure-eventhub auto-generates an owner_id using str(uuid.uuid4()) when calling receive/receive_batch. This becomes problematic in environments with frequent pod/worker restarts (e.g., K8s), as each restart results in a new owner_id, forcing unnecessary partition rebalancing and checkpoint contention.

Describe the solution you'd like
Add an optional parameter (owner_id: Optional[str] = None) to the said methods. If provided, this value would override the auto-generated UUID. This allows users to pass a persistent identifier (e.g., pod FQDN) to:

  • Reduce partition ownership juggling during brief restarts.
  • Improve traceability with meaningful IDs.

Example usage:

client.receive_batch(
    on_event_batch=on_event_batch,
    on_error=on_error,
    owner_id=socket.getfqdn(),
)

Describe alternatives you've considered
As for now, I monkey patch EventProcessor.

Additional context
In my deployment, workers restart hourly (due to a custom proxy requiring credentials refresh) and use a custom MongoDB (is Web scale) checkpoint store with the following behavior:

  • Graceful shutdowns do not release partitions.
  • On restart, the same worker reclaims its previous partitions. But it only works if the owner_id is stable.

Explicit control over owner_id would greatly help in this solution.

Also, as I understand it, the Java SDK allows you to explicitly specify owner_id.

I’d be happy to implement this myself if the feature is approved.

Thank you in advance.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

ClientThis issue points to a problem in the data-plane of the library.Event HubsMessagingMessaging crewcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.feature-requestThis issue requires a new behavior in the product in order be resolved.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK team

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions