Skip to main content
Pentaho Documentation

JMS Consumer

Use the Java Messaging Service (JMS) Consumer step to receive streaming data from the Apache ActiveMQ JMS server or the IBM MQ middleware. 

The parent JMS Consumer step runs a child (sub-transformation) that executes according to the message batch size or duration, letting you process a continuous stream of records in near real-time. The child transformation must start with the Get records from stream step. You can configure the JMS Consumer step to continuously ingest streaming data from your JMS server. 

In the JMS Consumer step itself, you can define the number of messages to accept for processing, as well as the specific data formats to stream activity data and system metrics. You can set up this step to collect monitored events, track user consumption of data streams, and monitor alerts. Additionally, you can select a step in the child transformation to stream records back to the parent transformation, which passes records downstream to any other steps included within the same parent transformation. 

Since the JMS Consumer step continuously ingests streaming data, you may want to use the Abort step in either the parent or child transformation to stop consuming records from JMS for specific workflows. For example, you can run the parent transformation on a timed schedule, or abort the child transformation if sensor data exceeds a preset range.

Before You Begin

Before using the JMS Consumer step, be aware of the following conditions:

  • You must be familiar with JMS messaging to use this step. Additionally, you must have a message broker, such as Apache ActiveMQ or IBM MQ, available before you configure this step.
  • This step supports JMS 2.0 and requires Apache ActiveMQ Artemis.
  • If you need to use JMS 1.1 with ActiveMQ or Artemis, use the previous versions of the JMS Consumer and JMS Producer steps, also available in Pentaho version 8.1 and earlier. 
  • Place IBM MQ client JARs for the IBM MQ middleware in the following directories:  
  • On the PDI client: data-integration/system/karaf/deploy
  • On the Pentaho Server: server/pentaho-server/pentaho-solutions/system/karaf/deploy

You need to locate the Websphere MQ classes for JMS Java libraries from your IBM Websphere MQ installation. You can also find these libraries in your IBM Websphere MQ Client SupportPac. The WebsphereMQ Java libraries version that the PDI plugin steps were built against is 9.0.0.3. The libraries that you must have available for distribution into the PDI JMS plugin are:

  • ocom.ibm.mq.osgi.allclientprereqs_9.0.0.3.jar
  • ocom.ibm.mq.osgi.allclient_9.0.0.3.jar
  • ocom.ibm.mq.jmqi.jar
  • odhbcore.jar

Because IBM licensing prevents us from distributing these libraries directly, you will need to add them to your PDI directories.

  • Place JMS Library jars for the ConnectionFactory and other supporting classes in the following directories: 
  • On the PDI client: data-integration/system/karaf/deploy
  • On the Pentaho Server: server/pentaho-server/pentaho-solutions/system/karaf/deploy

General

The JMS Consumer step requires definitions for setup, batch, field, and result fields to stream messages.

PDITransStep_JMSConsumer_SetupTab.png

Enter the following information in the transformation step fields.

Option Description

Step name

Specifies the unique name of the step on the canvas. The Step name is set to JMS Consumer by default.

Transformation

Specify the child transformation to execute by performing any of the following actions:

The selected child transformation must start with the Get Records from Stream step.

If you select a transformation that has the same root path as the current transformation, the variable ${Internal.Entry.Current.Directory} is automatically inserted in place of the common root path. For example, if the current transformation's path is /home/admin/transformation.ktr and you select a transformation in the directory /home/admin/path/sub.ktr, then the path is automatically converted to ${Internal.Entry.Current.Directory}/path/sub.ktr.

If you are working with a repository, you must specify the name of the transformation. If you are not working with a repository, you must specify the XML file name of the transformation.

Transformations previously specified by reference are automatically converted to be specified by the transformation name in the Pentaho Repository.

Create and Save a New Child Transformation

If you do not already have a child transformation, you can create one while setting up the JMS Consumer step. When you click the New button, a new child transformation will automatically generate the required Get Records from Stream step in a new canvas tab. All your fields and types are customized in the child transformation's Get Records from Stream step to match the fields and types specified in the Fields tab of the parent Kafka Consumer step. 

  1. In the JMS Consumer step, click New. The Save As dialog box appears.
  2. Navigate to the location where you want to save your new child transformation, then type in the file name.
  3. Click Save. A notification box displays informing you that the child transformation has been created and opened in a new tab. If you do not want to see this notification in the future, select the Don't show me this again check box.
  4. Click the new transformation tab to view and edit the child transformation. It automatically contains the Get Records from Stream step. Optionally, you can continue to build this transformation and save it.
  5. When finished, return to the JMS Consumer step.

Options

The JMS Consumer step features several tabs. Each tab is described below.

Setup Tab

In this tab, define the connections used for receiving messages, topics, and queues.

Option Description

IBM MQ

Activate this connection type if you are using IBM MQ as your message broker.

ActiveMQ

Activate this connection type if you are using Apache ActiveMQ Artemis and JMS 2.0 as your message broker.

JMS URL Enter the broker URL for the selected connection type.
Username Enter either the Apache ActiveMQ Artemis or IBM MQ username.
Password Enter either the Apache ActiveMQ Artemis or IBM MQ password.
Destination type

Select Topic or Queue from the list to specify the delivery model you want to use. 

  • Topic uses a publish and subscribe delivery model such that one message can be delivered to multiple consumers. Messages are delivered to the topic destination and ultimately to all active consumers who are subscribers of the topic. 
  • Queue uses a point-to-point delivery model. In this model, a message is delivered from a single producer to a single consumer. The messages are delivered to the destination, which is a queue, and then delivered to one of the consumers registered for the queue. 
Destination name Specify the name of the topic or queue.
Receive timeout

Specify the time to wait for incoming messages in milliseconds.

A timeout setting of zero ('0') never expires.

Batch Tab

PDITransStep_JMSConsumer_BatchTab.png

Use this tab to determine how many messages to consume before processing. You can specify message count and/or a specific amount of time.

While either option will trigger consumption, the first satisfied option will start the transformation for the batch.

Option Description

Duration (ms)

Specify a time in milliseconds. This value is the amount of time the step will spend collecting records prior to the execution of the transformation.

If set to a value of ‘0’, then Number of records triggers consumption.

Number of records

Specify a number. After every ‘X’ number of records, the specified transformation will be executed and these ‘X’ records will be passed to the transformation.

If set to a value of ‘0’ then Duration triggers consumption.

Either Number of records or Duration must contain a value greater than ‘0’ to run the transformation.

Fields Tab

PDITransStep_JMSConsumer_FieldsTab.png

Use this tab to define the fields in the record format.

Option Description

Input name

The input name is received from the JMS streams. The following are received by default:

  • message: The individual message contained in a record. Each record consists of a key, a value, and a timestamp.
  • destination: The name of the topic or queue.

Output name

The Output name can be mapped to subscriber and member requirements.

Type

The Type field defines the data format for streaming the record which is the same data type that produced the records. Option is String.

Result fields Tab

PDITransStep_JMSConsumer_ResultFieldsTab.png

Use the Return fields from option on this is tab to select the name of the step from the child transformation that will stream records back to the parent transformation. The data values in these returned fields will be available to any subsequent downstream steps in the parent transformation.

Metadata Injection Support

All fields of this step support metadata injection. You can use this step with ETL Metadata Injection to pass metadata to your transformation at runtime.

See Also

JMS Producer