@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) (1)
public String process(String request) {
TextMessage requestMessage = jms.createTextMessage(request);
TemporaryQueue responseQueue = jms.createTemporaryQueue();
jms.createProducer()
.setJMSReplyTo(responseQueue) (2)
.send(requestQueue, requestMessage); (3)
try (JMSConsumer consumer = jms.createConsumer(responseQueue)) { (4)
String response = consumer.receiveBody(String.class, 2000); (5)
if (response == null) { (6)
throw new IllegalStateException("Message processing timed out");
} else {
return response;
}
}
}