This repository has been archived by the owner on Sep 11, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use MQ.error instead of Kernel#raise [#4].
- Loading branch information
75e5407
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't it leave closed channel in inconsistent state? I mean, broker has closed the channel (for whatever reason), but you still have MQ instance hanging, and you can still try to do things with it, as if it is alive... How do you tell "live" channels from dead ones now?
Sure, you can set up MQ.error error processing callback to specifically check for this message and then somehow terminate your dead MQ instance, but not many people do this right now...
75e5407
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a jolly good point arvicco, I haven't thought about that. Raising an exception is definitely a wrong thing to do in an async environment, so I'd suggest to cache status in a variable, and have something like raise "X" if status.eql?(:closed) in method definitions. Thusly we'll raise an exception in a sync environment, so user will be able to rescue from it. I'll create an issue for this.
75e5407
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue: #8
75e5407
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I have to agree that exceptions are a big pain in the a** when dealing with current lib... However we should be careful to not leave business objects in inconsistent state... I've also thought about @status=:closed or something similar...
75e5407
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
868f349
75e5407
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, this should definitely work much better!