RabbitMQ
RabbitMQ is a message broker software that provides a messaging queue for handling communication between various components or services in a distributed system. It enables asynchronous communication by allowing producers to send messages to queues and consumers to receive those messages when they are ready to process them. RabbitMQ supports various messaging patterns and protocols, making it a versatile tool for building reliable and scalable distributed systems.
RabbitMQ integration
Description
<
rabbitmqIntegration>
- command for integration with RabbitMQ
Required parameters
- alias - unique name of the integration (e.g., "MY_RABBIT")
- enabled - boolean flag to enable/disable integration (can be “true” or “false”)
- host - specifies the hostname or IP address of the RabbitMQ server (e.g., "localhost")
- port - specifies the port number on which the RabbitMQ server is running (e.g., 5672)
- username - specifies the username for authentication with RabbitMQ (e.g., "my_username")
- password - specifies the password for authentication with RabbitMQ (e.g., "my_password123")
- apiPort - specifies the port number for the RabbitMQ management API
- virtualHost - specifies the separate logical RabbitMQ entity that provides isolated messaging environments
- enabledMetrics - determines whether metrics collection is enabled for the RabbitMQ integration
<rabbitmqIntegration>
<rabbitmq alias="MY_RABBIT" enabled="true">
<host>localhost</host>
<port>5672</port>
<username>my_username</username>
<password>my_password123</password>
<apiPort>15672</apiPort>
<virtualHost>/</virtualHost>
<enabledMetrics>true</enabledMetrics>
</rabbitmq>
</rabbitmqIntegration>
RabbitMQ command
Description
<rabbit> – command which is responsible for sending the RabbitMQ queries in testing scenarios
Required parameters
- comment
- alias - unique name of the integration
- commands: send or receive (only one can be selected)
Optional parameters
- condition - the condition according to which this test step will or won't be executed
- threshold - parameter, where the maximum execution time of the command is defined (milliseconds), if the execution time is exceeded, the step will be defined as failed
Send command
<rabbit comment="Send a command" alias="RABBIT_0">
<send routingKey="out" correlationId="5" exchange="1">
<body>
[
"city": "Houston"
]
</body>
<headers>
<header name="Lviv" value="20"/>
<header name="Odessa" value="25"/>
</headers>
</send>
<send routingKey="in">
<file>body_8.json</file>
</send>
</rabbit>
The send command is used to send a message to RabbitMQ. The command has arguments:
- [required] routingKey - specifies a string value that helps determine which queues or consumers will receive the message based on the routing rules defined in the RabbitMQ exchange (e.g., “out”)
- [optional] correlationId- specifies the correlation ID which is typically used to associate related messages or to correlate a response message with its corresponding request message (e.g., “5”)
- [optional] exchange - specifies the identifier used for correlation purposes in the RabbitMQ message (e.g., “1”)
- body - contains the main content or payload of the message being sent
- headers (name, value) - contains elements used to include additional header information in the RabbitMQ message
- file - specifies the name and location of a file that contains the content or payload of the message being sent
Receive command
<rabbit comment="Receive a command" alias="RABBIT_0">
<receive queue="weather" timeoutMillis="2000" headers="true" prefetchCount="2">
<message>
[
"city": "Houston"
]
</message>
</receive>
<receive queue="weather">
<message>
<file>expected_223.json</file>
</message>
</receive>
</rabbit>
The receive command is used to receive a message from RabbitMQ. The command has arguments:
- [required] queue - specifies the name of the RabbitMQ queue from which messages will be received (e.g., “weather”)
- [optional] timeoutMillis - specifies the timeout duration for the receive operation in milliseconds. It determines how long the receiver will wait for a message to become available in the queue before timing out (e.g., “2000”, “1000” by default if not specified )
- [optional] headers - indicates that the received message should or should not include the headers along with the message payload (can be “true” or “false”, “true” by default if not specified)
- [optional] prefetchCount - specifies the maximum number of unacknowledged messages that a receiver can prefetch from the queue (e.g., “2”, “1” by default if not specified )
- message - specifies the structure and content of the received message
- file - specifies the name or location of a file that contains the content or payload of the received message