{"action":"created","issue":{"url":"https://api.github.com/repos/postwait/node-amqp/issues/373","labels_url":"https://api.github.com/repos/postwait/node-amqp/issues/373/labels{/name}","comments_url":"https://api.github.com/repos/postwait/node-amqp/issues/373/comments","events_url":"https://api.github.com/repos/postwait/node-amqp/issues/373/events","html_url":"https://github.com/postwait/node-amqp/issues/373","id":53520801,"number":373,"title":"publish() not calling callback during/after reconnect","user":{"login":"tcort","id":216720,"avatar_url":"https://avatars.githubusercontent.com/u/216720?v=3","gravatar_id":"","url":"https://api.github.com/users/tcort","html_url":"https://github.com/tcort","followers_url":"https://api.github.com/users/tcort/followers","following_url":"https://api.github.com/users/tcort/following{/other_user}","gists_url":"https://api.github.com/users/tcort/gists{/gist_id}","starred_url":"https://api.github.com/users/tcort/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tcort/subscriptions","organizations_url":"https://api.github.com/users/tcort/orgs","repos_url":"https://api.github.com/users/tcort/repos","events_url":"https://api.github.com/users/tcort/events{/privacy}","received_events_url":"https://api.github.com/users/tcort/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-01-06T14:41:10Z","updated_at":"2015-05-13T09:01:05Z","closed_at":null,"body":"I have some code that looks something like this. It publishes 1 message per second. It waits until the prior message has been published before publishing a new message.\r\n\r\n    (function sendMessage() {\r\n            var msg = msgs.shift();\r\n\r\n            console.log('Sending %d', msg.id);\r\n            exchange.publish(routingKey, msg, options, function (err) {\r\n                    if (err) {\r\n                            console.log('Failed to send %d, requeueing', msg.id);\r\n                            msgs.unshift(msg);\r\n                    } else {\r\n                            console.log('Sent %d', msg.id);\r\n                    }\r\n                    setTimeout(sendMessage, 1000);\r\n            });\r\n    })();\r\n\r\nThe exchange is durable, non-autoDelete, topic type with confirm turned on. When I run the above code and I send while the connection is down, I never get a callback.\r\n\r\n    Connected\r\n    Sending 0\r\n    Sent 0\r\n    Sending 1\r\n    Sent 1\r\n    Error: CONNECTION_FORCED - broker forced connection closure with reason 'shutdown', will retry\r\n    Error: connect ECONNREFUSED\r\n    Sending 2\r\n    Error: connect ECONNREFUSED\r\n    Error: connect ECONNREFUSED\r\n    Error: connect ECONNREFUSED\r\n    Connected\r\n\r\nI am expecting the callback to be called when the connection is reestablished and the message is sent -- either that or I would expect a publication error (because the connection is down). Instead, there is no callback. With the debugging output turned on, I see that it does a basicPublish and gets a basicAck after the reconnect, but the callback isn't called.\r\n\r\nEnvironments:\r\n\r\n* FreeBSD 8.1 / RabbitMQ v3.3.1 / node v0.10.28\r\n* Mac OS X 10.10.1 / RabbitMQ v3.4.1 / node v0.10.32"},"comment":{"url":"https://api.github.com/repos/postwait/node-amqp/issues/comments/101579982","html_url":"https://github.com/postwait/node-amqp/issues/373#issuecomment-101579982","issue_url":"https://api.github.com/repos/postwait/node-amqp/issues/373","id":101579982,"user":{"login":"andre1810","id":2612346,"avatar_url":"https://avatars.githubusercontent.com/u/2612346?v=3","gravatar_id":"","url":"https://api.github.com/users/andre1810","html_url":"https://github.com/andre1810","followers_url":"https://api.github.com/users/andre1810/followers","following_url":"https://api.github.com/users/andre1810/following{/other_user}","gists_url":"https://api.github.com/users/andre1810/gists{/gist_id}","starred_url":"https://api.github.com/users/andre1810/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andre1810/subscriptions","organizations_url":"https://api.github.com/users/andre1810/orgs","repos_url":"https://api.github.com/users/andre1810/repos","events_url":"https://api.github.com/users/andre1810/events{/privacy}","received_events_url":"https://api.github.com/users/andre1810/received_events","type":"User","site_admin":false},"created_at":"2015-05-13T09:01:05Z","updated_at":"2015-05-13T09:01:05Z","body":"+1"}}