For a basic introduction with examples have a look at Mocking and simulating JMS IBM® WebSphere MQ Tutorial.
A tester uses a web browser to access the console. The console manages the virtual service. The system under test (application under test) connects directly to the virtual service on different ports.
Here is an example of how that could look like for a scenario where the virtual service is replaying messages to an external queue.
To record from or replay to JMS brokers you will need to tell Traffic Parrot how to connect to them.
Those connections are displayed in the dropdown menus on the record and replay panels, for example:
The "Internal broker" connection is available in the dropdown by default when you choose to use an internal broker in the Broker panel.
To define a new connection that will be available in the dropdown in the record and replay panels:[
{
"connectionId": "1",
"connectionName": "Test Payments Broker",
"connectionData": {
"jmsProvider": "IBM_MQ_7_5",
"hostname": "mqserver.example.com",
"port": 1415,
"queueManager": "PAYMENT.QM",
"channel": "PAYMENT.SVRCONN",
"username": "payuser",
"password": "paypassword222",
"useMQCSPAuthenticationMode": false,
"copyRequestMessageIdToResponseMessageId": false
}
},
{
"connectionId": "2",
"connectionName": "TrafficParrot External Payment Broker",
"connectionData": {
"jmsProvider": "IBM_MQ_7_5",
"hostname": "mqserver.example.com",
"port": 1414,
"queueManager": "TRAFFICPARROT.DEV.AWS.QM",
"channel": "TP.PUBLIC.JUNIT",
"username": "tpuser",
"password": "tppass333",
"useMQCSPAuthenticationMode": false,
"copyRequestMessageIdToResponseMessageId": false
}
},
{
"connectionId": "3",
"connectionName": "Test Order System Broker",
"connectionData": {
"jmsProvider": "ACTIVE_MQ",
"hostname": "localhost",
"port": 61616
}
},
{
"connectionId": "4",
"connectionName": "Azure AMQP",
"connectionData": {
"jmsProvider": "AZURE_AMQP_1_0",
"hostname": "namespace.servicebus.windows.net",
"sharedAccessKeyName": "SendListen",
"sharedAccessKey": "password"
}
},
{
"connectionId": "5",
"connectionName": "Local RabbitMQ",
"connectionData": {
"jmsProvider": "RABBIT_MQ_3",
"hostname": "localhost",
"virtualHost": "/",
"username": "guest",
"password": "guest",
"port": 5672,
"amqpCompatibilityMode": true,
"declareArguments" : {
"x-max-length": 10000,
"x-message-ttl": 60000
}
}
},
{
"connectionId": "6",
"connectionName": "Local ActiveMQ AMQP",
"connectionData": {
"jmsProvider": "ACTIVE_MQ",
"hostname": "localhost",
"port": 61617,
"protocol": "amqp"
}
}
]
In the current Traffic Parrot version you edit JMS connections directly in the jms-connections.json file. In near future you will be able to do it via the Web UI as well.
trafficparrot.virtualservice.jmsConnectionsUrl=classpath:jms-connections.jsonto for example
trafficparrot.virtualservice.jmsConnectionsUrl=file:/home/john/git/project/trafficparrot-jms-connections.jsonThis can be useful if you would like to version control it with your application source code.
To connect to IBM® MQ you need jar files provided by IBM that will allow Traffic Parrot to establish connections with MQ.
Before you proceed please read these instructions to double check your actions are inline with the supported way to install WebSphere MQ Java jar files.
If you have any issues with obtaining the jar files please contact us.
Copy those files to trafficparrot-x.y.z/lib/external and restart Traffic Parrot.
You can enable additional logging that displays total processing time of JMS messages.
trafficparrot.jms.monitorPerformance=trueYou should then see INFO log lines that contain "Total processing time", for example:
2026-03-18 10:15:32,046 INFO DEV.QUEUE.1-replay-responses-jms-message-scheduler-0 Request JMS message '49443A3631363162' was received on '2026-03-18T10:15:32.004Z' from 'QUEUE:DEV.QUEUE.1'. Request message putDateTime is '2026-03-18T10:15:31.990Z'. Response JMS message '49443A3632383263' was sent on '2026-03-18T10:15:32.045Z' to 'QUEUE:DEV.QUEUE.2'. Total processing time 41msYou can increase the logging level by setting it to DEBUG or TRACE, change trafficparrotserver.log4j.properties (last line in the file):
log4j.category.com.trafficparrot.messaging.jms.connection.monitor.ReportingJmsPerformanceMonitor=DEBUG
As with HTTP recording Traffic Parrot, during recording incoming and outgoing messages are matched up to provide mappings. Then upon playback receipt of a matching incoming message will trigger generation of an outgoing message.
Traffic Parrot can form mappings in a number of ways.
The default is to use time based matching. This can be changed in the advanced parameter section of the record page.
The method which requires least configuration is to use Traffic Parrot's internal broker. Via this method you can record traffic to and from your application by just modifying the broker URL to which your application connects.
This diagram shows how two production systems connect:
One system generates messages onto a queue; another system consumes these messages and puts responses onto a second queue, which the first system consumes. If our goal is to test the system-under-test in isolation, we must record these interactions in order to replay them.
As you can see in the diagram, the recording simply introduces two extra queues, to which the system under test connects, as shown in the diagram below:
As the system-under-test generates messages they are listed in the bottom table 'Current recording session'. As the second system generates responses to these messages, they are also listed at the bottom, but in addition mappings are generated in the 'Mappings' table showing incoming and outgoing messages that Traffic Parrot has paired up.
In this scenario we don't want to use Traffic Parrot's internal broker - we want Traffic Parrot to work with an existing external broker. This scenario is useful mainly when you would like to work with brokers that are unsupported internally by Traffic Parrot, for example IBM® MQ.
Instead of pointing the system under test at a different broker, we will create extra queues on our existing broker that will be used by the virtual service. Then we will reconfigure the system-under-test to connect to these queues instead of the original ones. Traffic Parrot will move messages between these queues and the original queues, recording and creating mappings as it does so.
To replay the recorded mappings we will need the same virtual service queues in place as shown on the image below.
You can use Traffic Parrot's internal broker to record and replay topic messages. For the purpose fo the examples below, we will use a configuration where the production systems connect in a way described on the diagram below:
The system-under-test generates messages onto a topic which are received by a number of other systems. One of these systems generates responses onto a different topic (which are received by a number of systems, one of which is the system-under-test).
We will configure Traffic Parrot to connect to the request and response topics and record the messages appearing on both, generating mappings as it goes, as shown on diagram Recording topics using an internal broker
Recording and playback of topics using an external broker is less intrusive than queues or internal broker topics, because Traffic Parrot can subscribe to a topic just like any other application and receive messages, without affecting the delivery of those messages to other applications.
This diagram shows how the production systems connect:
The system-under-test generates messages onto a topic which are received by a number of other systems. One of these systems generates responses onto a different topic (which are received by a number of systems, one of which is the system-under-test).
We will configure Traffic Parrot to connect to the request and response topics and record the messages appearing on both, generating mappings as it goes, as shown on diagram Recording topics using an external broker
Go to JMS in the top navigation bar and then click Export. Click the button to download a ZIP file that contains all of the JMS mappings and data files.
The ZIP file contains the following directories:
Go to JMS in the top navigation bar and then click Import. Select a ZIP file that was previously exported and it will be uploaded and the mappings and data files will be restored.
AsyncAPI is an open specification for describing event-driven and message-based APIs — its channels, operations and message schemas — in the same way that OpenAPI describes HTTP APIs. If your team already documents its messaging APIs with AsyncAPI, you can create JMS mappings directly from that document instead of writing them by hand.
Go to JMS in the top navigation bar and then click Import AsyncAPI. Upload a JSON or YAML AsyncAPI 2.x or 3.0 document and Traffic Parrot generates one JMS mapping per importable channel operation, each serving an example payload generated from the operation's message schema.
After you upload the document, Traffic Parrot shows a preview of the mappings it would create so you can review and select exactly which ones to import.
The preview table lists one row per importable operation, with the following columns:
Each row has a checkbox. Use the header checkbox to select or deselect all rows at once, or toggle individual rows. The Import Selected button shows the count of selected rows. Click it to create JMS mappings only for the checked operations, or click Cancel to discard the preview and return to the file selector.
If the document is malformed, is not a supported AsyncAPI version, or contains no importable operations, the page reports a clear error and no mappings are created.
Each selected operation becomes a JMS mapping whose request matches any message on the channel destination and whose response is the example payload generated from the message schema. You can then open the mapping in the JMS editor to refine the request matchers, response body, properties or delay just like any other JMS mapping.
For an AsyncAPI 3.0 operation that carries a reply object, Traffic Parrot creates a request-reply mapping instead: it still receives the request on the operation's own channel, but it publishes the response on the reply channel's destination (shown in the Reply destination column of the preview), and the response is the example payload generated from the reply message's schema. A one-way operation continues to echo its example back on the same channel as before.
The same import flow is also available for native IBM® MQ — see Import an AsyncAPI specification on the native IBM® MQ page.
Traffic Parrot supports both AsyncAPI 2.x and AsyncAPI 3.0 documents with the JMS and IBM® MQ channel bindings. For a 3.0 document, the destination is taken from the channel's address (falling back to the channel name). The destination type is taken from the channel binding: it is a TOPIC when either the jms or the ibmmq binding declares destinationType: topic (case-insensitive); otherwise it defaults to a QUEUE (so a document with no binding, or one whose destinationType is absent, empty or unrecognised, imports as a queue). Both one-way publish/subscribe operations (send and receive) and request-reply operations (those that carry a reply object) are imported — a request-reply operation publishes the reply message's example on the reply channel's destination.
Other channel bindings (AMQP, Kafka, MQTT) and AsyncAPI 4.x are not yet supported. Message payload schemas use JSON Schema (draft-07 for 2.x, draft 2020-12 for 3.0); Traffic Parrot generates an example from common schema constructs, and renders a placeholder payload for advanced constructs it cannot yet turn into an example (for example $defs with internal $ref, patternProperties, prefixItems, const, if/then/else and additionalProperties). You can edit any generated payload in the editor afterwards.
Messaging skeletons offer a quick way to pre-fill a JMS mapping form from an operation declared in an imported AsyncAPI specification, in the same way the HTTP skeletons and gRPC skeletons dropdowns pre-fill their forms. Where Import AsyncAPI creates mappings for many operations at once, the skeletons dropdown is for hand-crafting a single mapping that starts from a declared operation.
On the JMS Add/Edit page, pick an operation from the skeletons dropdown above the form. The form's destination name, destination type (the Queue / Topic radio) and request body/payload pre-fill from the selected operation. You can then edit any field before saving, just like a mapping you wrote by hand.
To edit the list of operations on the skeletons dropdown, place AsyncAPI specifications (JSON or YAML, AsyncAPI 2.x or 3.0) into the trafficparrot-x.y.z/asyncapi configuration directory — the same directory the messaging coverage check reads. Each declared operation becomes an entry in the dropdown.
Alternatively, you can use the import button beside the dropdown to upload an AsyncAPI specification directly. If you import a file with the same name as a file that was previously imported, it will be overwritten.
For a request-reply operation the dropdown option is labelled <operationId> (request-reply), and selecting it pre-fills both the request side (destination name, type and request body) and the reply side (a cloned response row carrying the reply destination name and reply body). This works for AsyncAPI 3.0-native reply operations and for AsyncAPI 2.x operations paired by a shared correlation id.
The headless trafficparrot validate command also checks your messaging mappings against your imported AsyncAPI specifications, so you can run it as a step in a continuous integration pipeline. AsyncAPI is the messaging contract, exactly as OpenAPI is the contract for HTTP and proto files are for gRPC. The same command also validates HTTP mappings against OpenAPI specifications and gRPC mappings against proto files; for the shared usage, exit codes, and CI-pipeline details see the full validate CLI reference.
The command enumerates the operations declared in your imported AsyncAPI specifications and reports any declared operation that has no backing messaging mapping — whether JMS, native IBM® MQ or file-message. This means a partially-mocked messaging API cannot silently drift from its contract. The AsyncAPI specifications are read from <files-root>/asyncapi/ (the messaging analogue of the HTTP openapi/ and gRPC proto/ directories; JSON or YAML, AsyncAPI 2.x or 3.0; all files in the directory are aggregated before the check runs). For example, a specification declaring an operation on the orders queue with no mapping that backs it reports:
Some AsyncAPI operations have no backing messaging mapping (under-coverage): (1) No mapping covers AsyncAPI operation: QUEUE:orders
A declared operation is matched to a mapping by its destination identity — the destination name and type written as TYPE:name, where TYPE is QUEUE or TOPIC (for example QUEUE:orders or TOPIC:events). The same identity is used in the report and in the allowlist below. A TOPIC mapping never covers a QUEUE operation of the same name, and the reverse.
For a request-reply operation, coverage is measured on the inbound (request) destination only — the reply destination is the mock's output, not a coverage target.
If there are no AsyncAPI specifications (no declared operations), the messaging under-coverage check contributes nothing and passes silently.
If your virtual service intentionally mocks only part of a messaging API, you can mark the remaining destinations as deliberately unmocked so that they do not fail the under-coverage check. Create a file named messaging-coverage.properties in the files-root directory (alongside the mappings and the asyncapi/ directory) and list the excluded destinations in the exclude.destinations property:
exclude.destinations=QUEUE:orders, TOPIC:events
Each entry is a TYPE:name destination token, where TYPE is QUEUE or TOPIC, written exactly as it appears in the report. Entries are separated by commas. If the file is absent, no destinations are excluded.
To stop the allowlist from quietly going stale, an exclude.destinations entry for a destination that is not present in any AsyncAPI specification is itself reported as drift and causes a non-zero exit code, with the message Allowlist excludes a destination not present in the AsyncAPI specification: <entry>. Remove or correct an entry once the destination it refers to no longer appears in the specifications.
Messaging drift participates in the same report and the same exit codes as the HTTP and gRPC checks — a declared operation with no backing mapping fails the build (exit code 1) the same way a renamed or removed HTTP endpoint does. Run the command as a pipeline step and check its exit status, exactly as described in Using it in a CI pipeline in the validate CLI reference.
Pact is a consumer-driven contract format. As well as the HTTP interactions you can import as HTTP stubs, a Pact contract can describe asynchronous message interactions — the messages a provider publishes for a consumer to handle. If your team captures its messaging contracts as Pact files, you can create JMS mappings directly from them instead of writing them by hand.
Go to JMS in the top navigation bar and then click Import message Pact. Upload a Pact .json file and Traffic Parrot generates one JMS mapping per message interaction in the contract, each publishing the message's example payload.
Two contract shapes are accepted. A Pact specification v3 contract carries its messages in a top-level messages[] array. A specification v4 contract carries them as interactions[] entries whose type is Asynchronous/Messages. Both are detected automatically. An HTTP-only Pact contract (one with no message interactions) is rejected with a message pointing you to the HTTP Pact import instead.
After you upload the file, Traffic Parrot shows a preview of the mappings it would create so you can review and select exactly which ones to import.
The preview table lists one row per message interaction, with the following columns:
Each row has a checkbox. New rows are checked by default and duplicate rows are left unchecked. Use the header checkbox to select or deselect all rows at once, or toggle individual rows. The Import Selected button shows the count of selected rows. Click it to create JMS mappings only for the checked messages, or click Cancel to discard the preview and return to the file selector.
If the file cannot be parsed as JSON, or contains no message interactions, the page reports a clear error and no mappings are created.
A Pact message interaction describes what a provider publishes, but not the queue or topic it is published to — a message contract carries no transport binding. Traffic Parrot therefore derives a destination for each message:
Review a derived destination before importing. When a destination is derived from the description rather than taken from explicit metadata, the preview shows a warning banner above the table listing each affected message, because the generated name is a best guess and may not match the queue or topic your system under test actually uses. Confirm the contract carries the right metadata, or correct the destination on the imported mapping in the JMS editor afterwards, so the mapping listens on the destination you expect.
Each selected message becomes a one-way publish JMS mapping. It matches any message on the derived destination and, on receipt, publishes the message's example contents back on that same destination. You can then open the mapping in the JMS editor to refine the request matchers, response body, properties or delay just like any other JMS mapping.
Message Pact imports are one-way only. A Pact message interaction is a fire-and-forget message a provider publishes — the contract has no request that selects it and no reply. The imported mapping therefore just publishes the example payload; it is not a request-matching, request-reply stub. (Request-reply mappings are created only by an AsyncAPI operation that carries a reply object.)
Given this minimal Pact specification v3 contract with a single message in its messages[] array, where the destination is taken from the message metadata:
{
"consumer": { "name": "OrderConsumer" },
"provider": { "name": "OrderProvider" },
"messages": [
{
"description": "an Order Created event",
"metadata": { "queue": "orders.created" },
"contents": { "orderId": "1001", "status": "CREATED" }
}
]
}
importing it on the JMS page creates a one-way mapping that listens on the orders.created QUEUE and publishes {"orderId":"1001","status":"CREATED"} on receipt of any message there. Importing the same contract on the IBM® MQ page instead creates the equivalent native IBM® MQ mapping.
Had the message carried no metadata destination key, the destination would have been derived from the description as an.order.created.event and the preview would have shown a warning to review it before importing.
The same import flow is also available for native IBM® MQ — see Import a message Pact contract on the native IBM® MQ page.
Import message Pact is part of the JMS support and is available on a JMS licence, the same as the rest of the JMS functionality; the menu link does not appear without it. Pact specification v3 (messages[]) and v4 (Asynchronous/Messages interactions) message contracts are supported. For a v4 contract the example body is read from the message's contents.content envelope. The example contents is imported as-is — you can edit any imported payload in the editor afterwards.
will allow you to edit an existing mapping:
Traffic Parrot supports postponing the delivery of a JMS message. This can be useful to better simulate a more realistic scenario where the responding system does not send a response message immediately after receiving the request message.
Use the
field on the edit mapping panel to specify the delay in milliseconds.
Sometimes, the response headers or properties of a message are crucial to the system under test. They can be specified line by line using the following format:
StringPropertyName;java.lang.String;StringValue IntegerPropertyName;java.lang.Integer;111
For RabbitMQ, the content type can be specified for example as:
ContentType;java.lang.String;application/x-java-serialized-object
The request priority can be set in order to set up a preference order for matching mappings.
The highest priority value is 1. If two or more mappings both match a request, the mapping with the higher priority will be used to provide the response. The default priority is 5.
This can be useful, if you want a "catch-all" mapping that returns a general response for most requests and specific mappings on top that return more specific responses.
Traffic Parrot is able to record and replay a javax.jms.TextMessage which could contain text in a variety of formats e.g. JSON, XML or plain text.
Traffic Parrot is able to record and replay a javax.jms.BytesMessage that could contain bytes in any format.
If the bytes of a javax.jms.BytesMessage are found to contain at least 95% printable characters (e.g. letters, digits, special characters), it will be displayed in plain text in the user interface.
This is configurable using the trafficparrot.mostly.printable.characters.threshold=0.95 property.
Non printable bytes will typically be displayed by the browser as a small box, as you can see in the screenshot below.
If the bytes of a javax.jms.BytesMessage are found to contain a single java.io.Serializable object that Traffic Parrot is able to deserialize, it will be displayed as a JSON object in the user interface.
The request and response body can be edited as if they were a JSON body. You are free to change the JSON as you wish, so long as the edits are compatible with the underlying Java class that the JSON represents.
By default, Traffic Parrot will use dynamic object serialization to support objects of any class that it is able to understand, including objects that are not on the classpath.
Unlike other tools, we do not require additional JAR files or agents to be installed in order to record, edit and replay object messages.
To improve compatibility (and support special handling during the serialization), you can choose to use standard Java object serialization by adding your classes to the Traffic Parrot classpath.
See the notes for developers for instructions on how to do this.
If you are having trouble with this functionality, please ask the developers on your team to review the notes for developers below.
Please contact us if you require any additional help for your particular configuration.
In order to deserialize a serialized Java object using standard Java object serialization, the Java class of that object and the classes of all of its fields must be on the Traffic Parrot classpath. Copy the JAR files containing those classes to trafficparrot-x.y.z/lib/external and restart Traffic Parrot.
In order to represent the object as JSON and allow editing, the class must have a public zero argument constructor.
Please contact us if you require any additional help for your particular configuration.
JMS mapping configuration is stored in the jms-mappings directory as text files in JSON format. You may directly edit these files on the filesystem and store them in a VCS such as Git or SVN.
Some JMS mapping features are not currently supported in the UI and can only be edited directly in the mapping JSON:{
"mappingId" : "1bf95fd0-5647-4db0-bae6-729a8b29fd1f",
"request" : {
"destination" : {
"name" : "request-queue",
"type" : "QUEUE",
"declareArguments" : {
"x-queue-mode" : "lazy",
"x-dead-letter-exchange" : "dead-letter-exchange",
"x-dead-letter-routing-key" : "dead-letter-routing-key",
"x-max-length" : 100,
"x-message-ttl" : 60000
},
"skipDeclare" : false
},
"bodyMatcher" : {
"equalTo" : "any"
},
"bodyType" : "TEXT",
"jmsMessageType" : "javax.jms.TextMessage"
},
"response" : {
"destination" : {
"name" : "response-queue",
"type" : "QUEUE",
"declareArguments" : {
"x-dead-letter-exchange" : "dead-letter-exchange",
"x-dead-letter-routing-key" : "dead-letter-routing-key",
"x-max-length" : 100,
"x-message-ttl" : 60000
},
"skipDeclare" : false
},
"jmsResponseTransformerClassName" : "NO_TRANSFORMER",
"text" : "anything",
"bodyType" : "TEXT",
"jmsMessageType" : "javax.jms.TextMessage",
"properties" : [ ],
"fixedDelayMilliseconds" : 0
},
"mappingName" : "saved-mapping-1bf95fd0-5647-4db0-bae6-729a8b29fd1f.json"
}
JMS text messages can be sent after an HTTP or gRPC response, configured in the mapping JSON:
"postServeActions" : [ {
"name" : "send-jms-message",
"parameters" : {
"jmsConnectionId" : "(connection id from jms-connections.json)",
"destination" : {
"name" : "queue-name",
"type" : "QUEUE"
},
"variables" : {
"id" : "{{randomValue length=24 type='ALPHANUMERIC'}}"
},
"properties" : {
"id" : "{{variables.id}}"
},
"bodyType" : "TEXT",
"jsonBody" : {
"id" : "{{variables.id}}",
"fieldFromRequest" : "{{originalRequest.jsonBody.requestField}}",
"fieldFromResponse" : "{{originalResponse.jsonBody.responseField}}"
},
"delayDistribution" : {
"type" : "fixed",
"milliseconds" : 500
}
}
} ]
Supported bodyType settings:
When Traffic Parrot receives a request message, it will try to simulate the system it is replacing by sending back a response message on the response queue or topic. To decide which response message to send, it will go through all the request to response mappings it has available to find the response to be sent. For more details how request matching works, see Request matching.
There are several matchers available to match JMS request messages, depending on the attribute.
The type of message can be considered for matching.
The type of the message body can be considered for matching.
| Type name | Type Id | Description |
|---|---|---|
| Text | TEXT | Matches message text directly |
| Printable Characters | PRINTABLE_CHARACTERS | Matches message bytes represented in mapping as text using UTF-8 printable character encoding |
| Base64 Bytes | BYTES | Matches raw bytes represented in mapping using Base64 encoding |
| Proto Bytes | proto/com.example.RequestType | Matches Proto message bytes represented in mapping as JSON text |
| Java Serialized Proto Bytes | javaProto/com.example.RequestType | Matches Java object Serializable Proto message bytes represented in mapping as JSON text |
| Java Serialized Bytes | com.example.RequestType | Matches Java object Serializable message bytes represented in mapping as JSON text |
The most common matchers are shown below. All other WireMock request body patterns are also supported.
| Matcher name | Matcher Id | Description |
|---|---|---|
| any | any | Any request body will match. |
| equal to | equalTo | Check that the received request message body is equal to the request body specified in the mapping |
| contains | contains | Check that the received request message body contains the sequence of characters specified in the mapping |
| does not contain | doesNotContain | Check that the received request body does not contain the sequence of characters specified in the mapping |
| matches regex | matches | Check that the received request message body matches the regexp specified in the mapping |
| does not match regexp | doesNotMatch | Check that the received request message body does not match the regexp specified in the mapping |
| equal to JSON | equalToJson | Check that the received request message body is JSON and that it is equal to the request body JSON specified in the mapping |
| matches JSON | matchesJson |
Check that the received request message body matches (allowing for special wildcard tokens) JSON specified in the mapping.
Tokens allowed:
For example a "matches JSON" request body matcher:
{
"name": "{{ anyValue }}",
"lastName": "{{ anyValue }}",
"age": "{{ anyNumber }}",
"children": "{{ anyElements }}"
}
will match a request body:
{
"name": "Bob",
"lastName": "Smith",
"age": 37,
"children": [{"name": "sam"}, {"name": "mary"}]
}
|
| matches JSONPath | matchesJsonPath | Check that the received request message body is JSON and that it matches JSONPath
specified in the mapping. For example, if we use the following expression as the request body matcher
$[?(@.xyz.size() == 2)]it will match this request body: {"xyz":[{"a":true}, {"b":false}]}
but will NOT match this one:
{"xyz":["a":true, "b":false, "c":true]}
For more examples see the request matching documentation.
|
| equal to XML | equalToXml | Check that the received request message body is XML and that it is equal to the request body XML specified in the mapping |
| matches XML | matchesXml |
Check that the received request message body matches (allowing for special wildcard tokens) XML specified in the mapping.
Tokens allowed:
For example a matches XML request body matcher:
<example>
<name>{{ anyValue }}</name>
<age>{{ anyNumber }}</age>
<children><tp:AnyElements/></children>
</example>
will match a request body:
<example> <name>Sam</name> <age>29</age> <children><child name="bob"/></children> </example> |
| matches XPath | matchesXPath | Check that the received request message body is XML and that it matches XPath
specified in the mapping. For example, if we use the following expression as the request body matcher
/xyz[count(abc) = 2]it will match this request body: <xyz><abc/><abc/></xyz>but will NOT match this one: <xyz><abc/></xyz> |
| matches SWIFT field | matchesSwiftField |
Match on a specific field within a SWIFT MT message body. Instead of writing a complex regular expression to match the entire message, you can target an individual field by its tag number and apply a regex to just that field's value. The matcher value is a JSON object with two properties:
For example, to match an MT103 message where tag 20 (Transaction Reference) starts with TXNREF: {"field": "20", "matches": "TXNREF.*"}
This will match a SWIFT message containing: :20:TXNREF001 but will NOT match: :20:OTHERREF The matcher handles both full SWIFT envelopes (with block structure) and bare field content. Multi-line field values (e.g., :59: address fields) are supported. If the specified tag appears multiple times, the match succeeds if any occurrence matches. If the tag is not present or the input is not a SWIFT message, the matcher returns no-match (not an error). The corresponding JSON mapping file format is: {
"bodyPatterns": [{
"matchesSwiftField": {
"field": "20",
"matches": "TXNREF.*"
}
}]
}
|
| matches FIX field | matchesFixField |
Match on a specific tag within a FIX protocol message body. Instead of writing a complex regular expression to match the entire message body, you can target an individual tag by its number and apply a regex to just that tag's value. The matcher value is a JSON object with two properties:
For example, to match a NewOrderSingle message (message type D) where tag 35 is D: {"field": "35", "matches": "D"}
This will match a JMS message body containing the FIX-standard SOH-delimited body: 8=FIX.4.4|9=176|35=D|49=SENDER|56=TARGET|11=ORDER123|55=AAPL|54=1|44=150.25|10=128| (where | represents the SOH character, ASCII 0x01) but will NOT match an ExecutionReport message where tag 35 is 8. Tag numbers are treated as opaque string keys, so the matcher works across FIX 4.2, 4.4, 5.0, and FIXT without any FIX-dictionary validation. If the specified tag appears multiple times (for example inside a repeating group), the match succeeds if any occurrence matches. If the tag is not present or the input is not a FIX message, the matcher returns no-match (not an error). The corresponding JSON mapping file format is: {
"bodyPatterns": [{
"matchesFixField": {
"field": "35",
"matches": "D"
}
}]
}
|