-
Notifications
You must be signed in to change notification settings - Fork 620
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
Unhandled error, publishing to an exchange using an invalid exchange type #287
Comments
This #196, seems related to what happens when this isn't caught. |
Specifying an incorrect exchange type will result in an unrecoverable (connection) exception. What kind of improvements do you have in mind? |
#196 does look relevant but I don't remember what the decision was (if any). Maybe @gerhard or @streadway do :) |
I'm certainly open to suggestions if this is not ideal, but you could validate the exchange type, possibly using a |
Exchange types can be provided by plugins. We cannot limit types to the list of built-in or known ones. |
figured so, hmm, I'll have to look into what happens when declaring an exchange of a wrong type a little further then. |
Yes it definitely is #196 that causes the panic, tracing my code shows that. My issue is more about handling my cause of that beforehand. I am saying handle the wrong exchange type, not the race condition (in this issue specifically). Here's my code:
|
@cpg1111 how can the library know what exchange type is "wrong" if it can be any string that begins with an Some other clients, e.g. Bunny, have helpers for known exchange types: topic, fanout, direct, etc. Another thing we can do is to introduce constants for known exchange types. I think this should be an easier sell. |
I do like the constants idea personally. I was thinking of handling a failed attempt after it's sent to rabbitmq in |
@cpg1111 constants is an easy and no risk solution. @gustamora sorry, can you elaborate? |
@cpg1111 we believe registering an error handler on the connection is what you want. @streadway @gerhard and I agree that introducing constants for known exchange types is a good idea. |
@michaelklishin yeah I've come to that inclusion, thanks for pointing me there. And yeah I think the constants would would be a great idea. |
Hi there,
I seemed to have been getting panic when writing to a closed (go not rabbit) channel, which completely makes sense. However, I got in this state due to a typo in my exchange type,
x-consistent-hash
was spelledx-constistent-hash
. I think I see a couple ways this error state can be handled gracefully, if this change is welcomed, I'd be more than happy to create a pull request for this. Returning an error for this on declare of the exchange seems to make the most sense to me, but I'm certainly open to discussing.The text was updated successfully, but these errors were encountered: