-
Notifications
You must be signed in to change notification settings - Fork 30
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
Allow prefetch_count
when consuming a channel.
#27
Conversation
When starting up a consumer process this adds support for setting a prefetch on the channel. For example: children = [ {EchoConsumer, [pool_id: :consumers_pool, queue: "echo_queue", options: [prefetch_count: 1]]},
I wasn't trying to make a PR into esl:master quite yet, but I guess I'll use this to ask. I wanted to support setting a As far as setting the |
Hi, i don't think that logic should be inside the adapter. if we want to set up a channel before starting to consume messages maybe we can add some callbacks to the consumer behavior like |
Are you thinking that this callback would belong in the I'm certainly willing to work on this. I'm not sure how best to test something like this without introducing mocks however. |
@jdl yes, in the |
Supporting prefetch sounds good. I think an approach of having a |
Then (as discussed), |
Agree with @sescobb27 - it would seem to be more appropriate to follow the underlying semantics of pma/amqp and handle the following in separate code blocks:
@sescobb27 testing strategy seems appropriate to me. |
ok, bear in mind the number of configured channels are created implicitly by the connection "worker" on initialisation https://github.com/esl/ex_rabbit_pool/blob/master/lib/worker/rabbit_connection.ex#L194-L196 so setting QoS once on checkout (when necessary as this ain't a mandatory operation), would make more sense than incurring the overhead of doing this each time on channel creation. The adapter behaviour already defines and abstracts interactions with Rabbit over Then for the setup procedures, the fabric is configured in the |
I don't pretend to understand everything in the last reply, but does this seem like a consensus on what should be changed? |
@sescobb27 - what would be the recommended strategy for users/implementors? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Waiting for feedback from @sescobb27 - might be it needs to be implemented a little differently.
add a with :ok <- setup_channel(channel),
{:ok, tag} <- adapter.consume(...) do
... # continue
else
{:error, error} -> # retry logic
end thoughts? @bryanhuntesl |
When starting up a consumer process this adds support for setting a
prefetch on the channel.
For example: