RabbitMQ plugins
Overview
The RabbitMQ plugin connects QALIPSIS to the RabbitMQ broker.
- Technology addressed
-
RabbitMQ: https://www.rabbitmq.com/
- Dependency
-
io.qalipsis.plugin:qalipsis-plugin-rabbitmq - Namespace in scenario
-
rabbitmq() - Client library
-
RabbitMQ: refer to rabbitMQ
- Supported steps
An example scenario that uses a combination of the rabbitmq consume and produce steps is provided on GitHub.
Consume step
The consume step within the RabbitMQ plugin consumes data from queues of the RabbitMQ broker and forwards the data to the next step.
This step is generally used in conjunction with join to assert data or inject data into a workflow.
This step supports multithreading concurrent consumers using the concurrency() property. When the concurrency is set to more than 1, the sequence of the records transmitted to the next step in no longer guaranteed.
To learn more, visit the RabbitMQ website.
- Ancestor
-
Scenario
- Functionality
-
The
consumestep starts a polling loop for consumption of the designated queue. As new records appear,consumepolls them and sends them to the next step. - Example
-
rabbitmq() .consume { name = "consume" connection { host = "localhost" port = 5672 username = "Celia45" password = "Columbus1963" } queue(queueName = "battery_state") } - Notable parameters
-
-
connection(required): configures the connection to the RabbitMQ broker; defaults tolocalhost:5672 -
queue(required): defines the name of the queue to consume. -
concurrency (optional):defines the number of concurrent channels producing messages to RabbitMQ; defaults to 1. -
prefetchCount(optional): defines the prefetch count value; defaults to 10. -
broadcast(optional): specifies the broadcast parameters for the step.
-
- Tip
-
Use the
consumestep withjointo assert data or inject data into a workflow. - Reference documentation
-
-
Learn more about
prefetchCountby reading the RabbitMQ Prefetch documentation. -
To configure the
consumestep, consult the RabbitMQ documentation.
-
Produce step
The produce step within the RabbitMQ plugin provides messages to the RabbitMQ broker using a query; the messages are then forwarded as input to the next step.
- Ancestor
-
Scenario
- Functionality
-
The
producestep’s input and step context are used to generate the values to complete the step; results are then forwarded to the next step(s). - Example
.rabbitmq()
.produce {
connection {
host = "localhost"
port = 5672
username = "Celia45"
password = "Columbus1963"
}
records { _, input ->
listOf(
RabbitMqProducerRecord(
exchange = "battery_state",
routingKey = "battery_state",
props = null,
value = objectMapper.writeValueAsBytes(input)
)
)
}
}
- Notable parameters
-
-
concurrency(optional): defines the number of concurrent channels producing messages to RabbitMQ; defaults to1. -
connection: configures the connection to the RabbitMQ broker; defaults tolocalhost:5672. -
records: configures and generates a list of produced records.
-
- Reference documentation
-
-
For more information on configuring the connection to RabbitMQ, refer to Connecting to RabbitMQ.
-
For more information on configuring the
producestep, refer to the RabbitMQ documentation.
-