Virtualizing Message Recordings
BlazeMeter can mock different protocols within the same Service Virtualization environment, and you can virtualize message queue (MQ) transactions by recording messages from your live message broker. For more information on how to create a virtual service with a Message Runner, see Virtualizing Message Queues first.
On this page:
Prerequisites
This procedure assumes you have created a virtual service with a Message Runner and want to add recordings to it.
Creating messages to virtualize a message queue
Before you can run a test against an application under test that relies on a MQ, create the messages that you want to virtualize. Then assign these message recordings to your virtual services. Your recordings map virtual inbound to live outbound queues in JMS recordings to capture and replay message flows.
You have two options:
-
Either record live messages and play them back,
-
or create messages manually.
You can mix both methods.
Option 1: Record live messages
To enable recording mode:
-
Configure your MQ to run against the virtual queues that you have defined.
-
Open the Service Virtualization tab and edit the Messaging Runner virtual service.
-
Go to the Runner tab and switch Recording Mode on.
-
Go to the Recording Configuration tab.
-
Under Settings, configure the following values:
-
Max Message Count - Default 1000
-
Max Messages per Second - Default 100
-
Under Bindings, click the Plus button to add mappings. Map each virtual inbound queue (or topic) to a live outbound queue (or topic).
-
Virtual Inbound - Define the name of the virtual inbound queue (or topic).
-
Type: Select either QUEUE or TOPIC
-
Live Outbound - Define the name of the live outbound queue (or topic) in the message broker to map it to.
-
-
-
Click Save.
-
Click Start Recording.
-
Run your MQ against the virtual queues and make requests.
Recorded messages appear on the Runner > Recording Configuration > Recorded Messages tab. You see that it records request/response pairs with the same correlation ID.
-
Click Stop Recording when you have recorded enough messages.
-
Click Save Recording.
The message recording is saved in the Asset Library. -
Go to the Runner tab and switch Recording Mode off.
Option 2: Create message recordings manually
As with all types of virtual services, a Service is a container to group virtual services and recordings that belong together.
-
Open the Service Virtualization tab.
-
Click Asset Catalog and go to the Recordings tab.
-
Select a Service.
-
Click the Plus button to create a Message Recording.
-
Define the following fields:
-
Name
-
Description
-
Service - Select a Service to group the recordings under.
-
Tags - (Optional) Assign custom tags to filter by.
-
-
Click Save.
The Messages section appears in the Recording section.
-
Click the Plus button to add a new Message. The Add Message window opens.
-
Define the following fields:
-
Name
-
Correlation ID - A request and response message that belong together have the same correlation ID.
-
Message Type - Select one of the following options:
-
Bytes Message
-
Text Message
-
Stream Message
-
Map Message
-
Object Message
-
-
Delay - Define the wait time in milliseconds to simulate network latency. Default: 0 ms.
-
Destination name
-
Destination Type
-
Queue
-
Topic
-
Subscription
-
-
-
Define the Body content of the message.
-
Define the response Header matchers of the message.
-
Define the response header Properties.
-
Click Save.
You can now assign the new recordings to the virtual service, or create a transaction from the recording.
View recorded messages
The recordings are saved in the Asset Catalog on the Recordings tab.
-
For each message, you can view its name, type, time stamp, Virtual Inbound queue, Live Outbound queue, and tags.
-
Here you can view, delete, or save recordings.
-
Messages inside the recording are ordered; click Change Order to rearrange them.
Convert a recording to a transaction
If you are virtualizing request-reply pairs, convert recordings to sets of transactions. This conversion involves grouping messages by their correlation ID, which are then split into pairs.
-
The first message in each pair is treated as a request message, for which an
equals
body matcher is created. -
The second message in the pair is treated as a response, and its content, headers, and properties are used in the transaction response definition.
For example, if there are four transaction messages in a recording that share the same correlation ID, three transactions are generated for the message pairs: 1-2, 2-3, and 3-4.
Follow these steps:
-
Open the Service Virtualization tab.
-
Click Asset Catalog and go to the Recordings tab.
-
Identify the recordings that you want to convert.
-
Set or update correlation IDs manually as needed. The converter converts only messages with correlation IDs.
-
Under Actions, click the Convert to transaction button.
-
Assign the transactions to the virtual service as usual. For more information, see Creating a Virtual Service.
Tip: Messaging Runner transactions can use Processing Actions in the same manner as HTTP Runner transactions do.