提交订单失败:尝试通过关闭的连接发送框架

时间:2018-08-20 13:50:24

标签: ruby-on-rails rabbitmq pusher bunny

我正在尝试与RabbitMQ和Bunny建立一个新的竞标连接,但出现错误,请您帮忙解决。下面是代码和错误。

连接代码

class AMQPQueue

  class <<self
    def connection
      @connection ||= Bunny.new(AMQPConfig.connect).tap do  |conn|
      conn.start
    end
  end
end

错误

Member id=2 failed to submit order: Trying to send frame through a closed connection. Frame is #<AMQ::Protocol::MethodFrame:0x00007f321806dd98 @payload="\x00<\x00(\x00\x00\x00\x16exchange.pusher.member\x00", @channel=2>, method class is AMQ::Protocol::Basic::Publish
{"utf8"=>"✓", "order_bid"=>{"ord_type"=>"limit", "price"=>"1.0", "origin_volume"=>"2.0000", "total"=>"2.0000", "bid"=>"btc", "ask"=>"eth", "state"=>"wait", "currency"=>"ethbtc", "member_id"=>2, "volume"=>"2.0000", "source"=>"Web"}, "controller"=>"private/order_bids", "action"=>"create", "market_id"=>"ethbtc", "market"=>"ethbtc", "ask"=>"eth", "bid"=>"btc"}
/home/pankaj/.rvm/gems/ruby-2.5.1@peatio_old/gems/bunny-1.2.2/lib/bunny/session.rb:872:in `send_frame_without_timeout'
/home/pankaj/.rvm/gems/ruby-2.5.1@peatio_old/gems/bunny-1.2.2/lib/bunny/session.rb:904:in `block (2 levels) in send_frameset_without_timeout'

连接的RabbitMQ节点关闭时出现错误。 有什么适当的方法可以处理这些错误。

0 个答案:

没有答案