Skip to content

[asyncio] Support creating producer and sending messages #189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 4, 2024

Conversation

BewareMyPower
Copy link
Contributor

Master issue: #55

Modifications

Introduce a pulsar.asyncio module that includes the asynchronous APIs to work with Python asyncio module.

Example:

async def main():
    client = Client('pulsar://localhost:6650')
    try:
        producer = await client.create_producer('topic')
        msg_id = await producer.send('msg'.encode())
        await producer.close()
    except PulsarException as e:
        error = e.error()
    await client.close()

The creation of Client reuses the same keyword arguments from pulsar.Client but the options for creating producer and sending messages are not added yet.

Master issue: apache#55

### Modifications

Introduce a `pulsar.asyncio` module that includes the asynchronous APIs
to work with Python asyncio module.

Example:

```python
async def main():
    client = Client('pulsar://localhost:6650')
    try:
        producer = await client.create_producer('topic')
        msg_id = await producer.send('msg'.encode())
        await producer.close()
    except PulsarException as e:
        error = e.error()
    await client.close()
```

The creation of `Client` reuses the same keyword arguments from
`pulsar.Client` but the options for creating producer and sending
messages are not added yet.
@BewareMyPower BewareMyPower self-assigned this Dec 29, 2023
@BewareMyPower BewareMyPower added the enhancement New feature or request label Dec 29, 2023
@BewareMyPower BewareMyPower added this to the 3.5.0 milestone Dec 29, 2023
@BewareMyPower BewareMyPower marked this pull request as draft December 29, 2023 09:16
@BewareMyPower BewareMyPower marked this pull request as ready for review December 29, 2023 10:29
@BewareMyPower BewareMyPower merged commit 4b61547 into apache:main Jan 4, 2024
@BewareMyPower BewareMyPower deleted the bewaremypower/async-send branch January 4, 2024 05:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants