Skip to content

[asyncio] Support creating producer and sending messages - #189

Merged
BewareMyPower merged 4 commits into
apache:mainfrom
BewareMyPower:bewaremypower/async-send
Jan 4, 2024
Merged

[asyncio] Support creating producer and sending messages#189
BewareMyPower merged 4 commits into
apache:mainfrom
BewareMyPower:bewaremypower/async-send

Conversation

@BewareMyPower

Copy link
Copy Markdown
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

2 participants