Service Virtualization

Expand all | Collapse all

How to use selector query in JMS Send Receive step? - DevTest 9.5.1

Jump to Best Answer
  • 1.  How to use selector query in JMS Send Receive step? - DevTest 9.5.1

    Posted 11-09-2016 02:00 PM

    Hello,

     

    I have a messaging flow containing multiple topics and queues (in different domains). I'm publishing a message on a queue, which in turn flows to a system that fetches data (according to the message that was published) from the database and generates a new message; put it in a another topic. My aim is to retrieve that particular message which contains the required information.  A queue is subscribing to that topic as well, which give me two options to get that particular message 

     

    Approach 1 - Using Topics

     

    With this approach I can get the message but there seems to be no way to filter the incoming messages and as the same system is being used by multiple people it increase the chances of getting a wrong message. 

    I tried using async Listener that filters all the messages using the correlation scheme (JMS Payload) ->Payload Scheme (Xpath), but for some reasons it was not able to get any message and it would simply throw time out error. 

     

    Even if it starts working, this approach might be more time consuming as all the payloads have to opened and searched by DevTest. Still I'll be interested to the correct method to work with this approach. Also, let me know if there is any other way to filter messages using the JMS Headers, as all the messages have some custom headers attached with them.

     

    Note :- I'm unable to use the JMS Correlation ID or any other custom property as the message with which it is sent doesn't transfer it to the newly generated message.

     

    Approach 2 - Using Queues

     

     

    This approach works perfectly fine when I use the JMS Messaging step since I'm able to use the selector query to filter out my messages. However, If I use the JMS Send Receive step, it doesn't allow me to do the same. Please let me know, how can I get the filtered messages from the queue itself using JMS Send Receive step?

     

    Thanks in advance

    Best Regards

     

    #jmsheader#jms



  • 2.  Re: How to use selector query in JMS Send Receive step? - DevTest 9.5.1
    Best Answer

    Posted 11-09-2016 02:49 PM

    To specify a message selector with the JMS Send Receive step you need to create a JMS Consumer asset, where you can enter your selector in the 'Message Selector' field.  Then select that asset in the Receive side of your step, at the 'JMS Consumer' field.

     

    The correlation scheme is a shortcut to doing that with Correlation ID; it ends up creating a new JMS Consumer on the fly with a selector that looks like "JMSCorrelationID='...'".  However, currently correlation schemes only work if you have both the send and receive sides enabled.



  • 3.  Re: How to use selector query in JMS Send Receive step? - DevTest 9.5.1

    Posted 12-22-2017 08:05 AM

    Hi Kevin,

     

    I have a scenario like mentioned above. Can you please elaborate how can we implement this.

     

    Best Regards,

    Venkat Yedida



  • 4.  Re: How to use selector query in JMS Send Receive step? - DevTest 9.5.1

    Posted 12-22-2017 10:19 AM

    I'm not sure how much clearer I can be than I already was above.  Screenshots?

     

    Make sure 'PRO' is enabled.  Click the '+' button next to 'JMS Consumer', and select 'JMS Consumer'.

     

    Give it a name and enter your selector query by 'Message Selector'.  Click 'OK'.

     

    Your consumer asset should now be selected by 'JMS Consumer'.  Click the edit button right next to it to edit your selector query.

    -KB