Reputation: 1986
I have object which is transferred via JMS to a component which listens to queue via channel adapter:
IntegrationFlows
.from(Jms.messageDriverChannelAdapter(connectionFactory)
.destination(inputQueue)
)
However this kind of setup only gives a possibility to receive ObjectMessage
however I want to provide custom deserializer which will also be able to accept BytesMessage
. The desired setup looks like this:
IntegrationFlows
.from(Jms.messageDriverChannelAdapter(connectionFactory)
.destination(inputQueue)
.deserializeWith((javax.jms.Message message) -> new org.springframework.messaging.Message(){}) // Does not exist, but desired
)
Thanks a lot in advance.
Upvotes: 1
Views: 541
Reputation: 121272
The deserialization logic is a part of org.springframework.jms.support.converter.MessageConverter
, which you can specify as a :
.from(Jms.messageDriverChannelAdapter(connectionFactory)
.destination(inputQueue)
.jmsMessageConverter(...)
)
I understand your wish to make that with the Lambda, but I don't see reason to introduce extra logic if that can be achieved with an existing abstraction.
Upvotes: 3