Can some one help me please?
I have this error in console:
jakarta.jms.InvalidDestinationException: Cannot determine response destination: Request message does not contain reply-to destination, and no default response destination set.
In first step I receive the message from Mqseries, and after I get the error for a lot of time (application keep running and to give me the same message and same error after)
[Error destination-JMSListener](https://i.sstatic.net/IYyK4yuW.png)
There is my code :
@RestController
@Service
@EnableJms
public class MQReceiver {
private static final Logger LOGGER = LoggerFactory.getLogger(MQReceiver.class.getName());
@JmsListener(destination = "${ibm.mq.additionalProperties.queue1}")
protected String receiveMessage(@Payload String message, @Header(JmsHeaders.MESSAGE_ID) String messageId) throws IOException , Throwable{
BufferedWriter bw;
FileWriter fw;
LOGGER.info("received OrderNumber='{}' with MessageId='{}'", message, messageId);
return "Le message est : " + message;
}
}
Wanna exepct to have message one time on console , without error
Hamzix91 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2
The IBM Messaging dev-patterns repo includes a number of samples for IBM MQ / Spring JMS. In particular, sample 108 has source that listens for a request and sends a reply to the reply-to queue specified in the request.
The code snippet below illustrates how to handle the ReplyTo
destination and other JMS properties. In addition, the code validates the redelivery count to avoid a redelivery loop.
@JmsListener(destination = "${app.l108.queue.name2}", containerFactory = "myContainerFactory108")
public Message receiveRequest(Message message,
Session jmsSession,
@Header("JMSXDeliveryCount") Integer deliveryCount) {
logger.info("");
logger.info( this.getClass().getSimpleName());
logger.info("Received message of type: " + message.getClass().getSimpleName());
logger.info("Received message :" + message);
MessageUtils.checkMessageType(message);
try {
Destination replyDest = message.getJMSReplyTo();
//String correlation = message.getJMSCorrelationID();
String correlation = message.getJMSMessageID();
...
// If the deliveryCount >=3 then perhaps the temp reply queue is broken,
// ideally should dead letter queue the request.
if (3 <= deliveryCount) {
logger.warn("Message delivered " + deliveryCount + " times.");
logger.warn("Message should be dead letter queued, as it might be poisoned");
...
} catch (JMSException e) {
logger.warn("JMSException processing request");
}
return null;
}