JMS plugin
Overview
The JMS plugin connects QALIPSIS to a messaging platform that supports JMS.
- Technology addressed
-
JMS: https://www.oracle.com/java/technologies/java-message-service.html
- Dependency
-
io.qalipsis.plugin:qalipsis-plugin-jms - Namespace in scenario
-
jms()
- Client library
-
JMS API: refer to Java Interface Summary.
- Supported steps
An example scenario that uses a combination of the JMS consume and produce steps is provided on GitHub.
Consume step
The consume step within the JMS plugin consumes records from ActiveMQ.
- Ancestor
-
Scenario
- Functionality
-
The
consumestep polls data from the designated ActiveMQ connection, step context, and the data deserializer. - Example
-
jms().consume { queues("battery_state") queueConnection { ActiveMQConnectionFactory("tcp://localhost:61616").createQueueConnection() } } .deserialize(JmsJsonDeserializer(targetClass = BatteryState::class)) .map { result -> result.record.value } - Notable parameters
-
-
consume: configures the the ActiveMQ connection. -
broadcast(optional): specifies the broadcast parameters for the step. -
deserialize(optional): specifies the class to use to deserialize the body of the response.
-
- Tip
-
The ActiveMQ connection can be configured for either
queues(QeueConnection) ortopics(TopicConnection), but not both. - Reference documentation
-
Refer to the JMS documentation for further parameter and configuration information.
Produce step
- Ancestor
-
Step
- Functionality
-
The
producestep produces a batch of records into one or more JMSdestinations. The record values may be provided by previous steps. - Example
-
.jms() .produce { connect { ActiveMQConnectionFactory("tcp://localhost:61616").createConnection() } records { _, input -> listOf( JmsProducerRecord( destination = ActiveMQQueue().createDestination("battery_state"), messageType = JmsMessageType.BYTES, value = objectMapper.writeValueAsBytes(input) ) ) } } - Notable parameters
-
-
connect: specifies the connection type for theJmsProducerRecord(s). -
records: generates and configures a list of produced records.-
destination: defines the destination for eachJmsProducerRecordas either queues (QueueConnection) or topics (TopicConnection). -
messageType: indicates theJmsMessageTypeas:TEXT,AUTO,BYTES, orOBJECT. -
value: defines the message to be displayed at thedestination.
-
-
- Tip
-
If you are not sure about the
JmsMessageType, useAUTOto allow the system to infer the type and display the result. - Reference documentation
-
Refer to the JMS documentation for further parameter and configuration information.