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

Documentation for setting up dead-letter exchange is inaccurate and/or incomplete #133

Open
fireproofsocks opened this issue Oct 5, 2024 · 3 comments

Comments

@fireproofsocks
Copy link

If the example from https://hexdocs.pm/broadway_rabbitmq/BroadwayRabbitMQ.Producer.html#module-dead-letter-exchanges is run, it generates errors:

[error] GenServer Rarebit.Pipelines.Inspection.Broadway.Producer_0 terminating
** (stop) exited in: :gen_server.call(#PID<0.492.0>, {:subscribe, {:"basic.consume", 0, "my_queue.dlx", "", false, false, false, false, []}, #PID<0.407.0>}, 70000)
    ** (EXIT) shutdown: {:server_initiated_close, 404, "NOT_FOUND - no queue 'my_queue.dlx' in vhost '/'"}

This appears to be because the the my_queue.dlx is not yet created yet -- this makes sense because the code that creates that queue is in the :after_connect option. The errors appear only on the 1st start; subsequent restarts do not seem to have this issue.

Secondly, the code in the handle_message/3 is incomplete -- it should demonstrate a full working example, e.g.

  def handle_message(_processor, message, _context) do
    Broadway.Message.failed(message, "Error handling message; this should trigger a send to the dead letter queue")
  end
@josevalim
Copy link
Member

Thank you, can you please send a pull request?

@fireproofsocks
Copy link
Author

Yessir! I'm finding I am not a fan of the :declare, :bindings, or :after_connect options because it's difficult to express more complicated setups using those options (e.g. like having pre-requisites for a dead-letter queue). Secondly, I find that the :bindings in particular tend to be mis-interpreted because people think that Broadway somehow cares about the them. But really Broadway is only bound to the queue. So I might adjust the setup in the example a little bit and try to offer some clarifications in my PR.

I'm working on a book for Packt on concurrency with Elixir, so I've been digging into RabbitMQ and Broadway for one of the chapters. We'd love your feedback!

@fireproofsocks
Copy link
Author

Here's the PR #134

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