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

Queue subscription exceptions kill workpool #186

Closed
bobbytables opened this issue Jan 28, 2014 · 5 comments
Closed

Queue subscription exceptions kill workpool #186

bobbytables opened this issue Jan 28, 2014 · 5 comments
Assignees
Labels

Comments

@bobbytables
Copy link
Contributor

So when you have something like this:

queue.subscribe(ack: true) do |info, message, json|
  if rand > 0.5
    raise "Killed"
  else
    some_work
  end
end

When that raise happens, the subscription will never receive anything afterwards because the thread is dead in the water and Thread#abort_on_exception isn't turned on (from what I can tell).

I feel like subscribe should have a way to say how to handle errors or tack on something like on_exception for subscriptions.

I've combed issues / doc / code and I haven't seen anything so I'm wondering if this is something I'm doing also.

Cheers!

@michaelklishin
Copy link
Member

I can confirm that basic.deliver is dispatched without exception handling. basic.cancel is.

Java client has exception handlers and the default one simply dumps exceptions to stderr. We should do the same.

@bobbytables
Copy link
Contributor Author

For now I just wrap my inner subscribe block with a begin / rescue and notify our exceptions service there.

Do you have a link to the java client handling or example? For us we'd love to have library support for exception handling as we use this library pretty extensively.

@michaelklishin
Copy link
Member

See javadoc. You define exception handler per connection. There is a default handler that dumps stack traces to stderr.

@ghost ghost assigned michaelklishin Jan 29, 2014
michaelklishin pushed a commit that referenced this issue Jan 29, 2014
michaelklishin pushed a commit that referenced this issue Jan 29, 2014
michaelklishin pushed a commit that referenced this issue Jan 29, 2014
This is what Java and C# clients do.

Fixes #186.
@bobbytables
Copy link
Contributor Author

Awesome, thanks for the quick response.

@michaelklishin
Copy link
Member

In 1.1.1.

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

No branches or pull requests

2 participants