{"action":"created","issue":{"url":"https://api.github.com/repos/ruby-amqp/bunny/issues/429","repository_url":"https://api.github.com/repos/ruby-amqp/bunny","labels_url":"https://api.github.com/repos/ruby-amqp/bunny/issues/429/labels{/name}","comments_url":"https://api.github.com/repos/ruby-amqp/bunny/issues/429/comments","events_url":"https://api.github.com/repos/ruby-amqp/bunny/issues/429/events","html_url":"https://github.com/ruby-amqp/bunny/issues/429","id":166184892,"number":429,"title":"Allow handling more channel-level errors with Channel#on_error","user":{"login":"mitio","id":129307,"avatar_url":"https://avatars.githubusercontent.com/u/129307?v=3","gravatar_id":"","url":"https://api.github.com/users/mitio","html_url":"https://github.com/mitio","followers_url":"https://api.github.com/users/mitio/followers","following_url":"https://api.github.com/users/mitio/following{/other_user}","gists_url":"https://api.github.com/users/mitio/gists{/gist_id}","starred_url":"https://api.github.com/users/mitio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitio/subscriptions","organizations_url":"https://api.github.com/users/mitio/orgs","repos_url":"https://api.github.com/users/mitio/repos","events_url":"https://api.github.com/users/mitio/events{/privacy}","received_events_url":"https://api.github.com/users/mitio/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ruby-amqp/bunny/labels/feature","name":"feature","color":"d7e102"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-07-18T20:24:53Z","updated_at":"2016-07-19T11:34:22Z","closed_at":"2016-07-18T20:37:08Z","body":"In rare cases, publishing a message may result in a channel-level error and closing of the channel by RabbitMQ.\r\n\r\nFor example, publishing via a deleted exchange (as [demonstrated in this snippet](https://gist.github.com/mitio/059f9938eee06f820d57c6b7f59fcc9a)) would result in\r\n`AMQ::Protocol::Channel::Close` with a `@reply_code` of `404` and a `reply_text` of `NOT_FOUND - no exchange '…' in vhost '…'\"`.\r\n\r\nThere is currently no way to handle such errors in client code. The closest thing to a handler for them is `Channel#on_error`, but currently it's said to handle only errors after basic.ack, basic.reject and basic.nack and is triggered only if the error from RabbitMQ matches the following:\r\n\r\n```ruby\r\ndef channel_level_exception_after_operation_that_has_no_response?(method)\r\n  method.reply_code == 406 && method.reply_text =~ /unknown delivery tag/\r\nend\r\n```\r\n\r\nI'm not sure if extending the scope of `on_error` would be the best way to handle this, but I think there should exist an API for this."},"comment":{"url":"https://api.github.com/repos/ruby-amqp/bunny/issues/comments/233605914","html_url":"https://github.com/ruby-amqp/bunny/issues/429#issuecomment-233605914","issue_url":"https://api.github.com/repos/ruby-amqp/bunny/issues/429","id":233605914,"user":{"login":"mitio","id":129307,"avatar_url":"https://avatars.githubusercontent.com/u/129307?v=3","gravatar_id":"","url":"https://api.github.com/users/mitio","html_url":"https://github.com/mitio","followers_url":"https://api.github.com/users/mitio/followers","following_url":"https://api.github.com/users/mitio/following{/other_user}","gists_url":"https://api.github.com/users/mitio/gists{/gist_id}","starred_url":"https://api.github.com/users/mitio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitio/subscriptions","organizations_url":"https://api.github.com/users/mitio/orgs","repos_url":"https://api.github.com/users/mitio/repos","events_url":"https://api.github.com/users/mitio/events{/privacy}","received_events_url":"https://api.github.com/users/mitio/received_events","type":"User","site_admin":false},"created_at":"2016-07-19T11:34:21Z","updated_at":"2016-07-19T11:34:21Z","body":"Hey Michael, thanks for the clarification and patience! I really appreciate it.\r\n\r\nI accept that you don't want `on_error` to be enhanced and I'm not pushing for it.\r\n\r\nI just want to point out that I demonstrated a case where `basic_publish` would result in an immediate channel close frame instead of an ack or nack and there's no user facing method people can use to handle this case. Yes, this frame is pushed to `@continuations`, but one can't simultaneously wait for both `wait_on_continuations` and `wait_for_confirms` and has to pick one. The \"happy path\" is waiting for confirmations after publishing and it will just timeout because of the lack of handling of this case.\r\n\r\nAre you positive that you don't want Bunny to handle such cases (a channel close after `basic_publish`) in any user accessible way? Isn't it feasible to release all confirms continuations in this case? E.g. call `release_all_continuations` in `close!` or in `handle_method`?\r\n\r\nIf you're positive that's not desirable, I will not push further. Thanks again for your time."}}
{"actor":{"display_login":"mitio"}}