Configure VSI and listen step for JMS MQ to include a custom header property.
search cancel

Configure VSI and listen step for JMS MQ to include a custom header property.

book

Article ID: 269616

calendar_today

Updated On:

Products

Service Virtualization

Issue/Introduction

In the DevTest JMS Send Receive step, custom header properties can be sent.
See: https://knowledge.broadcom.com/external/article?articleId=15976

How to send a custom header property in the VSI respond step like:
messageType=abc.001.001.14

Also how to receive the custom header property in the listen step and set a VS property.

Environment

Release : 10.7.2

Resolution

Configure the respond step for JMS and in the VSI response meta section add: "msg.props.messageType"

To receive the custom header property in the listen step, configure a Scriptable Data Protocol in the listen step with this code:

%beanshell%
import com.itko.util.ParameterList;

ParameterList p1 = lisa_vse_request.getMetaData();

/*
//USE THIS BLOCK IF YOU WANT TO SET ONLY messageType as a property
for(i=0;i<p1.size();i++)
{
    p = p1.get(i);
    if(p.getName().equalsIgnoreCase("msg.props.messageType"))
    {
        testExec.setStateObject("inputMessageType", p.getValue());
        break;
    }
}*/

//USE THIS BLOCK TO SET ALL THE METADATA OF THE INPUT MESSAGE AS PROPERTIES
//WITH lisa.vse.request as prefix
//Eg: lisa.vse.request.msg.props.messageType  abc.001.001.14

for(i=0;i<p1.size();i++)
{
    p = p1.get(i);
    testExec.setStateObject("lisa.vse.request." + p.getName(), p.getValue());
}