Reputation: 2332
Im using
@Autowired RabbitTemplate temp; temp.convertAndSend("aQueue", msg);
for sending and
@Autowired RabbitTemplate temp; return temp.receiveAndConvert("aQueue");
for receving messages from rappid mq Now I would like to use a listener something like :
@Component public class MessengerListener implements MessageListener{ @Override public void onMessage(Message arg0) { } }
The problem is that the on onMessage listener works with Messages is it possible to receive simple serializable objects in similar fasion ?
Upvotes: 1
Views: 674
Reputation: 1038
I strongly suggest you do not do this, you should pass XML,JSON(i recommend json),etc. to onMessage(..) and unmarshal the responses, not serialized objects over JMS.
use something like below for unmarshalling/marshalling the payload
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
</dependency
Upvotes: 0