MQ

 View Only
Expand all | Collapse all

MQ spring boot - Requesting a response

  • 1.  MQ spring boot - Requesting a response

    Posted Wed October 26, 2022 03:39 PM
    Hello,

    I'm beginer in IBM MQ and I'm learning programing base on testing IBM MQ samples on github. I have a problem on my local environment with this example  https://github.com/ibm-messaging/mq-dev-patterns/tree/master/Spring-JMS/src/main/java/com/ibm/mq/samples/jms/spring/level107.   The problem is in case acynchronic send a message on queue by scheduler I don't recive response on consumer  which is defined in setJmsReplayTo - method with annotation @JmsListener is not executed. I will be grateful for your help.​

    ------------------------------
    Jacek Borys
    ------------------------------

    Attachment(s)

    java
    Scheduler107.java   1 KB 1 version
    java
    MQApplication.java   1 KB 1 version
    java
    MQConfiguration107.java   1 KB 1 version
    java
    MessageConsumer107.java   1 KB 1 version


  • 2.  RE: MQ spring boot - Requesting a response

    Posted Thu October 27, 2022 03:33 AM

    I think you don't have a running responder. The sample is the requester in a request / response pattern. In the sample ( https://github.com/ibm-messaging/mq-dev-patterns/tree/master/Spring-JMS/src/main/java/com/ibm/mq/samples/jms/spring/level107 ) the asynchronous response in MessageConsumer107, is listening on queue 2. 

    The original request is sent in SendMessageService107, with the reply queue set to queue 2


    @Value("${app.l107.queue.name2}")
    public String replyQueue;

    ...

    jmsmsg.setJMSReplyTo(session.createQueue(replyQueue));


    Which maps to the same queue that MessageConsumer107 is expecting the response

    @JmsListener(destination = "${app.l107.queue.name2}")
    public void receiveOther(Message message) {
       ...


    Your response code, should be receiving the message on queue 1, and responding to the replyQueue specified in the request message header. The replyQueue will be queue 2. 

    If you don't have a responder, then you can use the 108 sample as the responder ( https://github.com/ibm-messaging/mq-dev-patterns/tree/master/Spring-JMS/src/main/java/com/ibm/mq/samples/jms/spring/level108 )



    ------------------------------
    Soheel Chughtai
    ------------------------------