JMSReader converts JMS messages into CloverDX data records.
|Component||Data source||Input ports||Output ports||Each to all outputs||Different to different outputs||Transformation||Transf. req.||Java||CTL||Auto-propagated metadata|
|Output||0||✓||For correct data records||Any|
All the connected output ports send out all data records.
JMSReader does not propagate metadata.
JMSReader has no metadata templates.
Metadata on the output port may contain a field specified in the Message body field attribute. Metadata can also use Autofilling Functions.
|JMS connection||yes||ID of the JMS connection to be used. See JMS Connections.|
|Processor code||||Transformation of JMS messages to records written in the graph in Java.|
Name of an external file, including the path, containing the transformation of JMS messages to records written in Java.
Name of an external class defining the transformation of JMS messages to records.
The default processor value is sufficient for most cases.
It can process both
|JmsMsg2DataRecordProperties (default) | other class|
|JMS message selector|
Standard JMX "query" used to filter the JMS messages that should be processed. In effect, it is a string query using message properties and syntax that is a subset of SQL expressions. For more information, see Interface Message.
Encoding of JMS messages contents.
This attribute is also used by the default processor implementation (
|ISO-8859-1 (default) | other encoding|
|Processor source charset||Encoding of external file containing the transformation in Java.||ISO-8859-1 (default) | other encoding|
|Max msg count|
Maximum number of messages to be received. 0 means without limitation. For more information, see Limit of Run.
|0 (default) | 1-N|
Maximum time to receive messages in milliseconds. 0 means without limitation. For more information, see Limit of Run.
|0 (default) | 1-N|
|Message body field|
Name of the field to which the message body should be written.
This attribute is used by the default processor implementation (
|bodyField (default) | other name|
One of these may be set.
Any of these transformation attributes implements a
For more information, see Java Interfaces for JMSReader.
For detailed information about transformations, see Defining Transformations.
JMSReader receives JMS messages, converts them into CloverDX data records
and sends these records to the connected output port.
The component uses a processor transformation which implements a
or inherits from a
JmsMsg2DataRecord interface are described below in
Java Interfaces for JMSReader.
Limit of Run
You can choose to limit the number of received messages and/or time of processing.
If you specify the maximum number of messages (Max msg count), the timeout (Timeout)or both, the processing will be limited by the number of messages, or time of processing, or both of these attributes. They need to be set to positive values.
When the specified number of messages is received, or when the process lasts some defined time, the process stops. Whichever of them will be achieved first, such attribute will be applied.
Remember that you can also limit the graph run by using the
JmsMsg2DataReaderinterface. It returns a boolean value and can also limit the run of the graph. Whenever it returns
false, the processing stops.
If you do not specify either of these two attributes (Max msg count and Timeout), the processing will never stop.
This is the default setting of JMSReader. Both the attributes are set to 0 by default. Thus, the processing is limited by neither the number of messages nor the elapsed time.
Thread Safety and Parallel Access
Each JMS Connection used in a graph creates one JMS session in AUTO_ACKNOWLEDGE mode. All JMS components get the "consumer" or "producer" from the shared session. It's possible to use more consumers/producers in parallel, but the session is single-threaded, so the requests for JMS broker are synchronized. To achieve really parallel access, each JMS component should have its own JMS connection.
Message Body, Message Header etc.
Data that is inserted into the body or header of a message depends
on the implementation of the
The default implementation is
It is the class transforming JMS messages (TextMessage or BytesMessage) to data records.
One field of the record may be filled with body of the message. The name of the field is specified by component attribute Message body field.
If message is of type
use the attribute msgCharset to specify encoding of characters in the message.
All the other fields are saved using string properties in the message header. Property names are same as respective field names. Values contain textual representation of field values. Default property field of Map<StringÎ may be defined to which all "unmappable" properties of header are saved as [key=property name]-Î[value=property value]
Last message has a same format as all the others. Terminating message is not supported.
Java Interfaces for JMSReader
Following are the methods of
void init(DataRecordMetadata metadata, Properties props)
Initializes the processor.
May be used to end processing of input JMS messages when it returns
false. For more information, see Limit of Run.
DataRecord extractRecord(Message msg)
Transforms JMS message to data record.
nullindicates that the message is not accepted by the processor.
Returns error message.
Read Text Message from Message Queue
There is a message queue
clover-queue accessible at
Read 5 records from the queue.
Create a JMS connection
|Initial ctx factory class||org.apache.activemq.jndi.ActiveMQInitialContextFactory|
|Connection factory JNDI name||QueueConnectionFactory|
User name and
Password are credentials for reading messages from message queue.
E.g. Apache ActiveMQ has default values
activemq-all-5.12.0.jar file is a JMS provider.
The library file must be available on your file system and accessible to CloverDX.
You can use another message provider.
Configure JMSReader component. Use the above mentioned connection in the component configuration.
|Max msg count||5|
|Message body field||e.g. field1|
We recommend users to explicitly specify the Message charset attribute.
If the transformation is specified in an external file (with Processor URL), Processor source charset should be specified too.