Ciboulette
Catch RabbitMQ :heartbeat_timeout
Good evening,
I am working on a escript executable in plain elixir. I’m currently using RabbitMQ with the AMQP library which is great. I’m using rabbitMQ heartbeat to handle lack of connection. When i turn down my wifi connection there is a heartbeat_timeout and this is normal ! I just want to catch this message to avoid showing this to the user in his console, but i can’t figure it out. How can i do this ? The message in the console is below:
22:02:37.681 [error] GenServer #PID<0.257.0> terminating
** (stop) :heartbeat_timeout
Last message: :heartbeat_timeout
State: {:state, :amqp_network_connection, {:state, #Port<0.9883>, "client adress -> adress:5672", 10, #PID<0.260.0>, 131072, #PID<0.256.0>, :undefined, false}, #PID<0.259.0>, {:amqp_params_network, "1v62q9wtxu2sckso", "33oga51ho8yswo0gwswg44440kwc4k4okkksgg0kks4wkkcc08", "/", 'adress.com', 5672, 0, 0, 10, :infinity, :none, [&:amqp_auth_mechanisms.plain/3, &:amqp_auth_mechanisms.amqplain/3], [], []}, 0, [{"capabilities", :table, [{"publisher_confirms", :bool, true}, {"exchange_exchange_bindings", :bool, true}, {"basic.nack", :bool, true}, {"consumer_cancel_notify", :bool, true}, {"connection.blocked", :bool, true}, {"consumer_priorities", :bool, true}, {"authentication_failure_close", :bool, true}, {"per_consumer_qos", :bool, true}]}, {"cluster_name", :longstr, "rabbit@adress-production.localdomain"}, {"copyright", :longstr, "Copyright (C) 2007-2015 Pivotal Software, Inc."}, {"information", :longstr, "Licensed under the MPL. See http://www.rabbitmq.com/"}, {"platform", :longstr, "Erlang/OTP"}, {"product", :longstr, "RabbitMQ"}, {"version", :longstr, "3.5.7"}], :none, false}
First Post!
PatNowak
Did you try to use handle_info that will for sure grab this message?
def handle_info(anything, channel) do
# do something with that
end
It should be at the bottom of your handle_info list.
Most Liked
josevalim
Last Post!
josevalim
Here is a sample translator: https://github.com/elixir-plug/plug/blob/master/lib/plug/adapters/translator.ex
The idea is that you will be able to pattern match in certain cases and convert those to better error messages.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









