AMQP连接丢失不会杀死父进程,因此永远不会发生重新连接

问题描述

我具有GenServer的初始化功能。主管正在照顾它,应该在退出时重新启动它。

  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

当我使用sudo service rabbitmq-server restart重新启动RabbitMQ时,未建立新连接。

在调试栏中,我看到以下内容:

enter image description here

当我单击连接pid 时,我收到消息,该进程不再存在。似乎进程已死,父级AmqpTransport对此一无所知。 如何使AmqpTransport和孩子Connection一起死亡?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)