检查rabbit mq和node js之间的连接是否关闭

时间:2012-12-13 11:05:22

标签: node.js rabbitmq amqp

我可以将兔子mq交换与我的node.js server连接起来。但是,如果我手动删除Rabbit MQ UI中的交换,那么有没有办法从node.js检查交换被删除或connection是否已关闭。

由于在同一个交易平台上发布消息,node.js崩溃,我无法使用exception处理try catch。我想在处理node.js之后重新创建exception的兑换。

exchange.publish(ROUTING_KEY, msg);  //here exchange is already deleted so throwing below error 

    Error: NOT_FOUND - no exchange 'lutron.poc.incoming' in vhost '/'
    at Exchange._onMethod (F:\workspaces\LutronHeroku_GITnew\lutroncloudserverco
nnector\lutroncloudserverconnector\node_modules\amqp\amqp.js:2091:15)
    at Exchange.Channel._onChannelMethod (F:\workspaces\LutronHeroku_GITnew\lutr
oncloudserverconnector\lutroncloudserverconnector\node_modules\amqp\amqp.js:1533
:14)
    at Connection._onMethod (F:\workspaces\LutronHeroku_GITnew\lutroncloudserver
connector\lutroncloudserverconnector\node_modules\amqp\amqp.js:1056:28)
    at AMQPParser.self.addListener.parser.onMethod (F:\workspaces\LutronHeroku_G
ITnew\lutroncloudserverconnector\lutroncloudserverconnector\node_modules\amqp\am
qp.js:895:12)
    at AMQPParser._parseMethodFrame (F:\workspaces\LutronHeroku_GITnew\lutronclo
udserverconnector\lutroncloudserverconnector\node_modules\amqp\amqp.js:449:10)
    at frameEnd (F:\workspaces\LutronHeroku_GITnew\lutroncloudserverconnector\lu
troncloudserverconnector\node_modules\amqp\amqp.js:190:16)
    at frame (F:\workspaces\LutronHeroku_GITnew\lutroncloudserverconnector\lutro
ncloudserverconnector\node_modules\amqp\amqp.js:175:14)
    at AMQPParser.header [as parse] (F:\workspaces\LutronHeroku_GITnew\lutronclo
udserverconnector\lutroncloudserverconnector\node_modules\amqp\amqp.js:162:14)
    at AMQPParser.execute (F:\workspaces\LutronHeroku_GITnew\lutroncloudserverco
nnector\lutroncloudserverconnector\node_modules\amqp\amqp.js:234:21)
    at Connection.<anonymous> (F:\workspaces\LutronHeroku_GITnew\lutroncloudserv
erconnector\lutroncloudserverconnector\node_modules\amqp\amqp.js:932:12)
Server: worker 4028  died; signal null

有没有办法抓住这个exception

0 个答案:

没有答案