You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is the real limitation here? If a method is annotated with RabbitListener, I'd expect all messages that match its binding to be delivered to the annotated method, and, if this for whatever reason fails due to a bad method signature, a huge exception if not.
However, if the signature goes "bad", the endpoint silently stops working. For example, if you have this:
void listen(SomeJavaClass body);
And you at some point need the properties (or a header), and you change the signature to this:
What I don't understand is that there is an exception made for Message, so this does work:
void listen(Message rawMsg, SomeJavaClass body);
Leaving me to have to add this line:
MessageProperties props = rawMsg.getMessageProperties(); // this can't be done directly...?
Why not also make exceptions for @Header, MessageProperties, etc?
Looking at the code where this is implemented it seems at a maximum a single inferred type can be handled, either 1 header, 1 unannotated parameter that is not Message or a parameter annotated with @Payload.
The text was updated successfully, but these errors were encountered:
Okay, thank you for the quick response. I just banged my head on this why it suddenly stopped working, when all that was different in the message was the missing __TypeId__. I'm glad at least I do not need to configure my own converter in order to make it work.
garyrussell
added a commit
to garyrussell/spring-amqp
that referenced
this issue
Jun 17, 2021
See #390.
Signatures like this for RabbitListener do not work when there is no type information (no TypeId):
What is the real limitation here? If a method is annotated with RabbitListener, I'd expect all messages that match its binding to be delivered to the annotated method, and, if this for whatever reason fails due to a bad method signature, a huge exception if not.
However, if the signature goes "bad", the endpoint silently stops working. For example, if you have this:
And you at some point need the properties (or a header), and you change the signature to this:
...it stops working completely.
What I don't understand is that there is an exception made for
Message
, so this does work:Leaving me to have to add this line:
Why not also make exceptions for
@Header
, MessageProperties, etc?Looking at the code where this is implemented it seems at a maximum a single inferred type can be handled, either 1 header, 1 unannotated parameter that is not
Message
or a parameter annotated with@Payload
.The text was updated successfully, but these errors were encountered: