Skip to content
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

Introduce a new api to consume message from Rabbit. #218

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dzen
Copy link
Contributor

@dzen dzen commented Mar 20, 2020

The goal is to get rid of the callback, which is imho a non-sense
in an asyncio context.

the new Channel::consume method now returns a MessageQueue objects
which can be iterated using async for.

This object allows us to ease the API:

    x = channel.consume(queue_name='hello')
    await x.qos(prefetch_size=0, prefetch_count=1)
    async with x as consumer:
        async for message in consumer:
            body, envelope, properties = message
            await channel.basic_client_ack(delivery_tag=envelope.delivery_tag)

The Event was created when the server gave a response which is wrong:

The Event should be created in the basic_consume, which is client side,
and set when the basic_consume_ok, server side, is received.
@dzen dzen requested a review from RemiCardona March 20, 2020 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant