Feedback on my article about how to safely consume RabbitMQ messages with Broadway

I have recently wrote a blog post about my solution to a problem that we face internally consuming RabbitMQ messages with Broadway where if a crash occurred in the code the code would enter in an infinite loop: http://www.ubazu.com/consume-rabbit-mq-messages-from-elixir
Can you guys provide me some feedback regarding my idea and my code. Is anyone else encountered the same problem?

I’ve only read articles about Broadway, never used it in production, so I can’t speak to the specific functionality here. Some more general code notes:

def handle_message(_, %Message{data: string_payload} = message, _) do
  apply(unquote(module), :handle_message, [string_payload])
  message
  # I rescue any crash and move the message to the other queue
rescue
  e ->

Beware: there are more ways to crash than rescue deals with: see GenServer timeout and retry for recent discussion

exchange_fct = Keyword.get(opts, :exchange)
exchange = exchange_fct.()

This pattern happens often enough that it feels like it should be named.

Thanks for the tip with rescue. I have switched my code to use catch/2 to cover all the cases.