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

Consuming without ACK #4

Open
arpunk opened this issue Dec 29, 2016 · 5 comments
Open

Consuming without ACK #4

arpunk opened this issue Dec 29, 2016 · 5 comments

Comments

@arpunk
Copy link
Contributor

arpunk commented Dec 29, 2016

Is it possible to consume from a queue without ACK'ing?

I used to do this in amqp without problems but in wabbit I haven't been able to do so. Can you point me to the place to set up such flag? I tried on the producer options but it didn't work.

What I tried was to set no_ack: true in the handle_channel_opened/2 callback but then I see my consumers go up and down in the RabbitMQ admin panel and I see tons of enqueued messages. There are messages that are being received by the wabbit consumer and I don't see any errors or disconnections. Any ideas?

I'm using the master branch, Erlang/OTP 19.2 and Elixir 1.4.0-rc.1.

@pma
Copy link
Owner

pma commented Jan 1, 2017

How are you trying to set no_ack: true?

The return of the handle_channel_opened/2 callback is {:ok, queue, new_state, consume_options}, where consume_options is a Keyword list that can include no_ack: true. These options are just passed to the equivalent of AMQP.Basic.consume.

Example: https://gist.github.com/pma/f912d799daeb894769a5083ab18062ad

@pma
Copy link
Owner

pma commented Jan 8, 2017

@arpunk ping

@arpunk
Copy link
Contributor Author

arpunk commented Jan 10, 2017

Using no_ack: true in the options has no effect: I see no connected consumers in RabbitMQ and I see a lot of stalled messages, but I also see that data is arriving at the consumer.

@pma
Copy link
Owner

pma commented Jan 11, 2017

@arpunk I have tried to reproduce your issue with https://github.com/pma/wabbit_test.

When running, I see one Connection and two Channels, as expected. Both channels show a message flow and there is one consumer connected to one of the channels.

I don't see the same behaviour, where messages are stalled. Instead, I see messages being published, confirmed and delivered. Maybe we are doing something different in the client code?

I do however see an issue with using no_ack: true. With this option, the Source, which is a RabbitMQ consumer and a GenStage producer, has no flow control. This means it can receive message from the broker faster than it's subscribed GenStage consumer can handle and it will start discarding messages. I think we can address this by calling Basic.cancel when demand is 0 and reissuing Basic.consume once demand is greater than 0.

@arpunk
Copy link
Contributor Author

arpunk commented Jan 30, 2017

Sorry for the delay.

I am going to try to get no_ack: true to work in the afternoon. I haven't tried it further because we are ACK'ing in production so currently it is not an issue for me.

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

No branches or pull requests

2 participants