{"action":"opened","issue":{"url":"https://api.github.com/repos/mbroadst/qamqp/issues/41","repository_url":"https://api.github.com/repos/mbroadst/qamqp","labels_url":"https://api.github.com/repos/mbroadst/qamqp/issues/41/labels{/name}","comments_url":"https://api.github.com/repos/mbroadst/qamqp/issues/41/comments","events_url":"https://api.github.com/repos/mbroadst/qamqp/issues/41/events","html_url":"https://github.com/mbroadst/qamqp/issues/41","id":142598139,"number":41,"title":"Trying to publish a message inside the 'connected' signal fails on reconnect.","user":{"login":"alaendle","id":969523,"avatar_url":"https://avatars.githubusercontent.com/u/969523?v=3","gravatar_id":"","url":"https://api.github.com/users/alaendle","html_url":"https://github.com/alaendle","followers_url":"https://api.github.com/users/alaendle/followers","following_url":"https://api.github.com/users/alaendle/following{/other_user}","gists_url":"https://api.github.com/users/alaendle/gists{/gist_id}","starred_url":"https://api.github.com/users/alaendle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alaendle/subscriptions","organizations_url":"https://api.github.com/users/alaendle/orgs","repos_url":"https://api.github.com/users/alaendle/repos","events_url":"https://api.github.com/users/alaendle/events{/privacy}","received_events_url":"https://api.github.com/users/alaendle/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-03-22T09:52:40Z","updated_at":"2016-03-22T09:52:40Z","closed_at":null,"body":"If I create a simple sender that just publishes a message on 'connected' it fails during re-connecting. Just take a look at the following sample (a small modification of the sender-example):\r\n\r\n    Sender::Sender(QObject *parent) : QObject(parent) {\r\n        m_client.setAutoReconnect(true);\r\n    }\r\n\r\n    void Sender::start() {\r\n            connect(&m_client, SIGNAL(connected()), this, SLOT(clientConnected()));\r\n            m_client.connectToHost();\r\n    }\r\n\r\n    void Sender::clientConnected() {\r\n        QAmqpExchange *defaultExchange = m_client.createExchange(\"test\");\r\n        defaultExchange->publish(\"Hello World!\", \"test\");\r\n        qDebug() << \" [x] Sent 'Hello World!'\";\r\n    }\r\n\r\nIf I now restart the broker the client tries to publish before a channel is established:\r\n\r\n> ...\r\ntrying to reconnect after:  5000 ms\r\nconnecting to host:  \"localhost\" , port:  5672\r\n-> connection#start( version_major=0, version_minor=9, mechanisms=(PLAIN,AMQPLAIN), locales=en_US\r\n<- connection#startOk()\r\n-> connection#tune( channel_max=0, frame_max=131072, heartbeat=60 )\r\n<- connection#tuneOk( channelMax=0, frameMax=131072, heartbeatDelay=60\r\n<- connection#open( virtualHost=/, reserved-1=0, reserved-2=0\r\n-> connection#openOk()\r\n<- basic#publish( exchange=test, routing-key=test, mandatory=0, immediate=0 )\r\n [x] Sent 'Hello World!'\r\n<- channel#open( channel=1 )\r\n-> connection#close( reply-code=504, reply-text=CHANNEL_ERROR - expected 'channel.open', class-id=60, method-id:40 )\r\nexchange disconnected:  \"test\"\r\n<- connection#closeOk()\r\nsocket error:  \"The remote host closed the connection\"\r\nexchange disconnected:  \"test\"\r\ntrying to reconnect after:  1000 ms\r\nconnecting to host:  \"localhost\" , port:  5672\r\n-> connection#start( version_major=0, version_minor=9, mechanisms=(PLAIN,AMQPLAIN), locales=en_US\r\n<- connection#startOk()\r\n-> connection#tune( channel_max=0, frame_max=131072, heartbeat=60 )\r\n<- connection#tuneOk( channelMax=0, frameMax=131072, heartbeatDelay=60\r\n<- connection#open( virtualHost=/, reserved-1=0, reserved-2=0\r\n-> connection#openOk()\r\n<- basic#publish( exchange=test, routing-key=test, mandatory=0, immediate=0 )\r\n [x] Sent 'Hello World!'\r\n<- channel#open( channel=1 )\r\n-> connection#close( reply-code=504, reply-text=CHANNEL_ERROR - expected 'channel.open', class-id=60, method-id:40 )\r\nexchange disconnected:  \"test\"\r\n<- connection#closeOk()\r\nsocket error:  \"The remote host closed the connection\"\r\nexchange disconnected:  \"test\"\r\ntrying to reconnect after:  1000 ms\r\n...\r\n\r\nFor me it seems like this is a bug, but maybe I'm just making wrong assumptions about the API of qampq. If I was unclear or if you need more information just let me know. Thanks in advance for any assistance or any hint how to work around this problem."}}