Java – how to receive the content sent by convertandsend?

I am reading the Spring Framework Reference chapter on JMS integration There are some examples of sending text messages and receiving them asynchronously (by listeners) There is also an example of the jmtemplate function convertandsend, which converts a given object into a message reference:

But there is no example of receiving such a message They mentioned the function receiveandconvert, but unfortunately it receives synchronously So how do I receive it asynchronously? I must note that when I convert and send the map, the generated message will be a mapmessage, and I just need to check this type of message in my listener and process it? But they promised that I would not care about the details of how to represent it as a JMS message So is there a better way?

Solution

Although jmtemplate provides basic synchronous receiving methods, asynchronous receiving is more complex and beyond the scope of jmtemplate

The asynchronous reception of JMS messages is completed in spring using message listener containers, which uses asynchrony to send messages from JMS destinations and deliver them to applications You can insert the messageconverter into the message listener container through the messagelistener adapter (insert the converter into the adapter, insert the listener of the application into the adapter, and then insert the adapter into the listener container)

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>