-
Notifications
You must be signed in to change notification settings - Fork 124
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
Add direct consumer support #172
Conversation
…dules and init args for direct consumer mode.
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.
Nice work 👏 👏 and thank you for explaining!
I left bunch of comments but please don't be overwhelmed. Most of them are trivial and I believe they don't require big changes 🙏
e9fac7c
to
509b520
Compare
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.
Thanks for updating PRs! All looks good apart from a comment on channel_test.exs.
Since #169 seems dead and @sircinek and I no longer work together, I decided to pick this up and finish it. This adds support for any custom consumer type as specified by
:amqp_gen_consumer
and addsAMQP.DirectConsumer
as an Elixir reimplementation of:amqp_direct_consumer
.The reason for this change is that when we are using this library we are opening a channel per consumer. This starts an
:amqp_selective_consumer
for each of those. That consumer is a separate process leading to a structure that looks something like this:(:amqp_channel) -- (:amqp_selective_consumer) -- (OurConsumer)
. In rare cases whenOurConsumer
crashes,:amqp_selective_consumer
remains. That means the broker still sees the channel as open and continues routing messages into it. Those messages are then being lost asOurConsumer
does not exist anymore to handle those, neither can:amqp_selective_consumer
reject them.