Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

process_frame raises an error on Channel::Close instead of calling MQ.error #4

Closed
noteflakes opened this issue Aug 11, 2009 · 2 comments

Comments

@noteflakes
Copy link

When a Channel::Close frame is received, an error is raised instead of calling MQ.error, causing the process to exit unless EM.error_handler is set. Here is a patch to correct this:

diff --git a/lib/mq.rb b/lib/mq.rb
index 893325f..b6cd901 100644
--- a/lib/mq.rb
+++ b/lib/mq.rb
@@ -222,7 +222,7 @@ class MQ
         end
 
       when Protocol::Channel::Close
-        raise Error, "#{method.reply_text} in #{Protocol.classes[method.class_id].methods[method.method_id]} on #{@channel}"
+        MQ.error "#{method.reply_text} in #{Protocol.classes[method.class_id].methods[method.method_id]} on #{@channel}"
 
       when Protocol::Channel::CloseOk
         @closing = false
@noteflakes
Copy link
Author

In order to resume operation the following needs to be added after calling MQ.error:

        conn.callback{ |c|
          @channel = c.add_channel(self)
          send Protocol::Channel::Open.new
        }

@botanicus
Copy link
Collaborator

Currently you shouldn't need any callback, the AMQP gem reconnects automatically, I just checked. Anyway: ruby-amqp@75e5407

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants