Reputation: 1
I am facing the same issue mentioned in details in the following link: https://github.com/spring-cloud/spring-cloud-stream/issues/1686
Thanks for the help.
Upvotes: 0
Views: 166
Reputation: 6106
That is because the payload type transformation occurs only when it is known which message handler (method) is going to be invoked and which type is specified as an input. Remember, there are still a lot of things that are in play here - routing would be the best example, since only after routing decision we know which handler to invoke and how to extract type information to perform type transformation
Non of it known at the interceptor level since it is too early, so the general recommendation is to NOT ever rely on payload when message is in route and instead structure your message as such that any kind of in-route decision could be made based on message headers which are simple types. A good analogy would be a post service which makes routing decisions based on the information provided on the envelope (the mailman does not open your letters to see the payload to make those decisions). Anyway, a while back I wrote a blog post - https://spring.io/blog/2018/02/26/spring-cloud-stream-2-0-content-type-negotiation-and-transformation. .. have a read as there are more details there.
Upvotes: 2