How to send VSE Responses to different Queues ( Q1 & Q2) in DevTest
search cancel

How to send VSE Responses to different Queues ( Q1 & Q2) in DevTest


Article ID: 100485


Updated On:


CA Application Test CA Continuous Application Insight (PathFinder) Service Virtualization


How to direct a virtual service  message  based on some criteria  to multiple queues? 

For example if incoming request payload contains <field id="User" value="A0001JH3"/> , the requirement is that 
  If  value="A0001JH2" -> go to Queue 1    and if value="A0001JH3" -> Queue 2


All supported DevTest releases.




There are multiple ways to do this, Please see the options described below: 

Option A: 
With the new 'IBM MQ Native' protocol, you can put multiple response queues into a single Respond step.
 1. Create a separate queue asset for each of your response queues. 

 2. Add multiple response channels in your VSM 'Respond' step (or in the VSE recorder when generating your VSM).  Create a separate channel for each response queue and give it a name.

 3. In your VSI service image, find the '' property in the response meta-data of each transaction and change its value to match the name of the response channel corresponding to the correct response queue.


Option B:

You can do this with a response-side scripted DPH :
if ("A0001JH3".equals(lisa_vse_request.getMetaData().getParameterValue("...field.Usario"))) {
    lisa_vse_response.getMetaData().setParameterValue("", "Response 2");

} else {
    lisa_vse_response.getMetaData().setParameterValue("", "Response 1");

Option C:

Add a Scripted Assertion, 

  • Change the assertion in the Image Selection Step to a Scripted Assertion and set the responseChannel property based on the input parameter.

Set the Assertion to FAIL if False.
// set the response channel 1 or 2 depending on the input arg
// use getStateString in case the argument is not parsed by the XML dph
if ( “A0001JH3”.equals( testExec.getStateString(“requestMsg_dse_formattedData_kColl_field_1_value”, “unknown”) ) {
      testExec.setStateValue(“responseChannel”, “Response 1”);
} else {
      testExec.setStateValue(“responseChannel”, “Response 2”);


Additional Information

parameterizing the MQ Name in Native MQ step


1558701420356000100485_sktwi1f5rjvs16kij.jpeg get_app
1558701418579000100485_sktwi1f5rjvs16kii.jpeg get_app
1558701416653000100485_sktwi1f5rjvs16kih.jpeg get_app
1558701414772000100485_sktwi1f5rjvs16kig.jpeg get_app