{"action":"created","issue":{"url":"https://api.github.com/repos/veegee/amqpy/issues/11","labels_url":"https://api.github.com/repos/veegee/amqpy/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/veegee/amqpy/issues/11/comments","events_url":"https://api.github.com/repos/veegee/amqpy/issues/11/events","html_url":"https://github.com/veegee/amqpy/issues/11","id":95722830,"number":11,"title":"how mandatory works","user":{"login":"gst","id":38055,"avatar_url":"https://avatars.githubusercontent.com/u/38055?v=3","gravatar_id":"","url":"https://api.github.com/users/gst","html_url":"https://github.com/gst","followers_url":"https://api.github.com/users/gst/followers","following_url":"https://api.github.com/users/gst/following{/other_user}","gists_url":"https://api.github.com/users/gst/gists{/gist_id}","starred_url":"https://api.github.com/users/gst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gst/subscriptions","organizations_url":"https://api.github.com/users/gst/orgs","repos_url":"https://api.github.com/users/gst/repos","events_url":"https://api.github.com/users/gst/events{/privacy}","received_events_url":"https://api.github.com/users/gst/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-07-17T19:10:26Z","updated_at":"2015-07-18T17:06:50Z","closed_at":null,"body":"Hi,\r\n\r\nWe would like to use the mandatory flag of the basic_publish channel method (to know if a message is well delivered to a queue), but once set to True I don't know what else I need to do ..\r\n\r\ndo you have some resources / example ? I looked in the code and doc but could not find how this works..\r\n\r\nthx.\r\n\r\ngst."},"comment":{"url":"https://api.github.com/repos/veegee/amqpy/issues/comments/122564275","html_url":"https://github.com/veegee/amqpy/issues/11#issuecomment-122564275","issue_url":"https://api.github.com/repos/veegee/amqpy/issues/11","id":122564275,"user":{"login":"veegee","id":1820417,"avatar_url":"https://avatars.githubusercontent.com/u/1820417?v=3","gravatar_id":"","url":"https://api.github.com/users/veegee","html_url":"https://github.com/veegee","followers_url":"https://api.github.com/users/veegee/followers","following_url":"https://api.github.com/users/veegee/following{/other_user}","gists_url":"https://api.github.com/users/veegee/gists{/gist_id}","starred_url":"https://api.github.com/users/veegee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/veegee/subscriptions","organizations_url":"https://api.github.com/users/veegee/orgs","repos_url":"https://api.github.com/users/veegee/repos","events_url":"https://api.github.com/users/veegee/events{/privacy}","received_events_url":"https://api.github.com/users/veegee/received_events","type":"User","site_admin":false},"created_at":"2015-07-18T17:06:50Z","updated_at":"2015-07-18T17:06:50Z","body":"\r\nUpdate: It actually has nothing to do with `ch.close()`. You can call any method which waits for a server response, such as \r\n```\r\ntry:\r\n    ch.queue_declare('_', passive=True)`\r\nexcept amqpy.exceptions.NotFound:\r\n    pass\r\n```\r\n\r\nor even\r\n\r\n```\r\nL:\\projects\\python\\amqpy\\amqpy\\tests\\test_channel.py\r\nand it will work as expected. The purpose of doing this is waiting for the server to send *anything*, and storing them in the `returned_messages` queue. `ch.basic_publish()` doesn't read any data and therefore the channel doesn't get an opportunity to read returned messages from the socket at that point.\r\n\r\nLooks like everything is working as expected. I'll update the documentation and tests to reflect this.\r\n\r\nUpdate: It actually has nothing to do with `ch.close()`. You can call any method which waits for a server response, such as \r\n```\r\ntry:\r\n    ch.queue_declare('_', passive=True)`\r\nexcept amqpy.exceptions.NotFound:\r\n    pass\r\n```\r\n\r\nor even\r\n\r\n```\r\n        while True:\r\n            try:\r\n                conn.drain_events(0.1)\r\n            except:\r\n                break\r\n```\r\n\r\nand it will work as expected. The purpose of doing this is waiting for the server to send *anything*, and storing them in the `returned_messages` queue. `ch.basic_publish()` doesn't read any data and therefore the channel doesn't get an opportunity to read returned messages from the socket at that point.\r\n\r\nHowever, this should be done in a more obvious way, so I'll improve this mechanism shortly."}}