I have init function of my GenServer. Supervisor is looking after it, and should restart it on exit.
def init(_opts) do
username = get_conf(:username)
password = get_conf(:password)
host = get_conf(:host)
port = get_conf(:port)
vhost = String.replace(get_conf(:vhost), "/", "%2f")
{:ok, conn} = Connection.open("amqp://#{username}:#{password}@#{host}:#{port}/#{vhost}")
{:ok, chan} = Channel.open(conn)
state = %State{
exchange: get_conf(:exchange),
channel: chan,
routing_key: get_conf(:routing_key)
}
{:ok, state}
end
When I restart RabbitMQ with sudo service rabbitmq-server restart new connection isn't established.
In debug bar I see following:
When I click on connection pid <0.417.0> I get message that process doesn't exist any more. It seems that process is dead and parent AmqpTransport know nothing about that.
How can I make AmqpTransport die together with it's child Connection?