Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Feature Request] Expose create_producer Parameters in pulsar.asyncio.ClientΒ #261

@justinreddick

Description

@justinreddick

πŸ“ Feature Request: Expose create_producer Parameters in pulsar.asyncio.Client

Summary

I'd like to request enhanced support for configuring producers in the pulsar.asyncio.Client by exposing the same parameters available in the sync Client.create_producer(...) method.

Motivation

The current asyncio version of the Pulsar Python client is ideal for modern async applications (e.g., FastAPI, asyncio event loops). However, it lacks support for configuring producers with the full range of parameters β€” such as:

  • batching_enabled
  • compression_type
  • message_routing_mode
  • block_if_queue_full
  • producer_name
  • and others

This limits its usability in production environments that require more granular control over performance, reliability, and behavior.

Proposal

Update pulsar.asyncio.Client.create_producer() to accept and forward the same optional keyword arguments as the sync Client.create_producer(). This can likely be done by aligning its signature and implementation more closely with the existing sync interface.

Benefits

  • Enables parity between sync and async usage
  • Reduces the need to fall back to thread-based workarounds
  • Makes it easier to build scalable, async-native services with Pulsar
  • Encourages adoption of the asyncio interface

Example Use Case

producer = await client.create_producer(
    "my-topic",
    batching_enabled=True,
    compression_type=pulsar.CompressionType.LZ4,
    producer_name="metrics-publisher"
)

References

Thank you

Thanks for all your work on this client!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions