Service Virtualization

 View Only
  • 1.  How to use JMS Selector Query in JNDI Step

    Posted Mar 12, 2016 10:14 PM

    Use Case: I have the test case which publish the request into JMS topic and subscribe the response from other topic.

    I am able to publish request successfully. But unable to subscribe the response, getting “No response was returned. Either the timeout occurred or there were problems.  Check your server logs.” Error. When I check in the server actually there are multiple response is available at the subscription topic, In JMS Selector query pane what selector query I should write to filter my response .I tried the below syntax  Properties.messageSender == "myvalue"  but it’s not working.

     

    Version: DevTest 8.0.1

    Using JNDI Test Step

    Can somebody help me to resolve this problem?



  • 2.  Re: How to use JMS Selector Query in JNDI Step

    Posted Mar 12, 2016 11:03 PM

    If no response is being received *without* specifying a selector query, then adding one won't help.  The JMS selector query can only filter *out* messages on the queue/topic that don't match the query. 

     

    If you are using JMS Topics then they differ from Queues in one important way:  You have to be subscribed to a topic *at the time a message is sent to it* in order to receive it.  Unless you use a "durable" subscription, messages will not wait on a Topic for a client to pick up later. 

     

    From your description, it sounds like you may have two separate JMS steps, one that sends a request followed by one that receives the response.  It's likely that the response is being sent before the second step can actually open its subscriber, so it's being missed. 

     

    You have a couple of options.  The easiest is to just do it all in one step.  When both the send and receive sides on the JMS step are enabled then it automatically opens the response queue subscriber *before* sending the request, avoiding any race conditions with the response.  If they *have* to be two separate steps then you will actually need *three* steps:  First the response step with its type changed to an Async listener, which starts the subscriber in the background.  Second is the request send step.  And third is an async consumer step that references the async key defined in the first step and actually receives the message.

     

    In 8.0 you can also use the new JMS Send Receive step, which can also do either of the above patterns and is a bit less clunky to use.



  • 3.  Re: How to use JMS Selector Query in JNDI Step

    Posted Mar 15, 2016 09:01 AM

    Thanks Kevin. As per your suggestion we just did it in one step, enabled the both publish and subscribe in the same test step, now we are able to subscribe the response.