Forum Discussion

Daviiid's avatar
Daviiid
New Contributor
10 years ago

[Resolved] jms get message on CorrelId

Hello
I configured soapUi to send/receive message on JMS MQ queue.
Here is my url jms://DAVID::queue_REQ::queue_REP
It's nice except i always get thefirst message in the response Mq Queue (and it's not the response i expected)
How can i configured soapui for reading message on CorrelId ? (Because the messageId put is reported in the CorrelId response MQ)
I read this topic viewtopic.php?t=3247 but i don't really understand !
Thanks for your help !

5 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    You may try adding the correlationID as JMS Property to the test step and put some unique value for each test.
  • Daviiid's avatar
    Daviiid
    New Contributor
    Hi Rao
    it doesn't work. SoapUi get always the fisrt message :-(
  • nmrao's avatar
    nmrao
    Champion Level 3
    May be after reading/consuming the message, send an explicit acknowledgement so that the message gets deleted. See if this helps. May be you need to write a groovy for the same.

    Otherwise, don't provide the response queue name so that you get the response on a temp queue where the message gets deleted once user consumes.
    like:
    jms://DAVID::queue_REQ::queue_
  • Daviiid's avatar
    Daviiid
    New Contributor
    Hi
    I wrote a groovy script for put and get on correlationId after copying mq jar files into the file ${SoapUiRep}/lib/ext

    import com.ibm.mq.*
    /* definition de la connexion au QManager */

    MQEnvironment.@hostname = "host"
    MQEnvironment.@port = 1414
    MQEnvironment.@channel = "CHANNEL.NAME"
    MQEnvironment.@userID = "jmsmq"
    MQEnvironment.disableTracing();
    def queueManager = new MQQueueManager('QueueManagerName')
    def putMsg = new MQMessage();


    /* option du header MQMD */
    putMsg.setVersion(MQC.MQMD_VERSION_2);
    putMsg.format = MQC.MQFMT_STRING;
    putMsg.characterSet = 1208

    /* Message à déposer */
    putMsg.writeString('String Message');

    /* dénition file d'attente request avec option et dépose */
    def putQ = queueManager.accessQueue('NomQueueRequest', MQC.MQOO_OUTPUT | MQC.MQOO_FAIL_IF_QUIESCING);
    putQ.put(putMsg, new MQPutMessageOptions());
    putQ.close()


    /* definition des options de get */
    MQGetMessageOptions getOptions = new MQGetMessageOptions();
    getOptions.options = MQC.MQGMO_WAIT + MQC.MQGMO_FAIL_IF_QUIESCING;
    getOptions.waitInterval = 15000;//MQC.MQWI_UNLIMITED;

    /* definition du corrleId a getter */
    def message = new MQMessage();
    message.correlationId = putMsg.messageId;

    /* definition de la queue a getter en y mettant les option */
    def MQQueue getQ;
    getQ = queueManager.accessQueue('NomQueueResponse', getOptions.options);
    getQ.get(message, getOptions);
    def response = message.readString(message.getMessageLength())
    getQ.close()
    log.info response
  • nmrao's avatar
    nmrao
    Champion Level 3
    So assuming that you could resolve the issue, glad to know and thank you for sharing groovy code, hope it will be useful for someone.