By default, assets deployed with a WebSphere MQ configuration will copy the MQMD characterSet
, messageId
, and correlationId
from the incoming request MQ Message to the outgoing response MQ message. This is the default correlation mechanism.
If a different correlation mechanism is required, such as making the virtual asset copy the incoming request messageId
into the outgoing response correlationId
, then you can configure this at the Message Responder level. To do this:
- Chain a Header Data Bank tool to the incoming header request of that responder and extract the
messageId
(or the desired MQMD field) value (see Header Data Bank). - In the Message Responder Transport Header Options, MQ (see Transport Header Tab) add
messageId
(or the desired MQMD field name) and parameterize its value with the requestmessageId
or field provided by the Data Bank. This approach can be used for MQMD MQMessage fields as desired.- For the list of MQ Message MQMD field names recognized and handled by Virtualize, see the MQMD documentation.
Note that Virtualize will display a hex-encoded representation of the byte array fields in order to allow their values to be readable in the data bank and traffic views. However, the exact byte content will be transferred gracefully from the request to the response messages—preserving messages, preserving the original byte contents.
...
Code Block |
---|
from com.parasoft.api import CorrelationScriptingHookConstants from com.parasoft.xml import XMLUtil from org.w3c.dom import * from javax.xml.xpath import * from java.lang import * def match(context): msg = context.get(CorrelationScriptingHookConstants.MESSAGE_STR) if msg != None: xmlDocument = XMLUtil.buildDocumentFromString(msg) cond1 = matchRFH2Header(xmlDocument, "mcd/Msd", "sampleDomain") cond2 = matchRFH2Header(xmlDocument, "usr/sampleKey", "sampleValue") return cond1 and cond2 return false def matchRFH2Header(xmlDocument, path, val): xPathFactory = XPathFactory.newInstance(); xpath = xPathFactory.newXPath() expression = xpath.compile("/RFH2Message/RFH2Headers/" + path + "/text()") elementValue = expression.evaluate(xmlDocument) return String(elementValue).equals(val) |
The follwing following paths can be used to access the values in various RFH2 areas:
...