JMS Producer
The JMS Producer destination writes data to a Java Messaging Service (JMS). Before you use JMS Producer, install the drivers required for your JMS implementation. For information about supported versions, see Supported Systems and Versions.
When you configure a JMS Producer, you configure how the destination connects to the JMS
server and the JMS destination name. You can optionally specify the JMS destination
type, JMS credentials, and configure any additional JMS configuration properties that
you require. You can configure the destination to include record header attributes with
a jms.header
prefix as JMS message headers.
Installing JMS Drivers
Before you use the JMS Producer destination, install the JMS drivers for the implementation that you are using.
For example, to use the Oracle version of JMS, you need to install the Oracle JMS
drivers: wljmsclient.jar
and wlclient.jar
. Or to
use the ActiveMQ version, install all the ActiveMQ jars: activemq-all-*.jar.
You install the driver into the JMS stage library, streamsets-datacollector-jms-lib
, which includes the destination.
For information about installing additional drivers, see Install External Libraries.
Include Headers
You can configure
the destination to include record header attributes with a jms.header
prefix as headers in the JMS messages.
jms.header
prefix in
the following situations:- When you configure the JMS Consumer origin to include JMS headers as record
header attributes. The origin names JMS record header attributes as follows:
jms.header.<header name>
. - When you configure an Expression Evaluator or a scripting processor to add
record header attributes with a
jms.header
prefix.For more information, see Generating Attributes for Record-Based Writes.
For example, let's say that you build a pipeline that includes the JMS Consumer origin and the JMS Producer destination to move data from one JMS server to another. You want to retain the message header values included in the source JMS messages in the JMS messages written to the target JMS server. You configure the origin to include JMS headers as record header attributes, and then configure the destination to include these record header attributes as JMS headers in the messages.
By default, the destination includes the jms.header
prefix in the JMS
header names. You can optionally configure the destination to remove the prefix before
including the headers in the JMS messages.
Additional JMS Properties
- Additional JMS Configuration Properties on the JMS tab
- Additional Security Properties on the Credentials tab
You can define any additional JMS or JNDI property in either location. However, only additional security properties defined on the Credentials tab support using credential functions to retrieve sensitive information from supported credential stores.
If you define the same property in both locations, additional security properties defined on the Credentials tab take precedence.
When you add a configuration property to either location, enter the exact property name and the value. The JMS Consumer does not validate the property names or values.
Working with TIBCO EMS
- java.naming.security.principal = <username>
- java.naming.security.credentials = <password>
Configuring for TIBCO and SSL
- com.tibco.tibjms.naming.security_protocol = ssl
- com.tibco.tibjms.naming.ssl_enable_verify_host = false
- com.tibco.tibjms.naming.ssl_expected_hostname = <tibco _server_hostname>
- com.tibco.tibjms.naming.ssl_identity = <path_to>/server-cert.p12
- com.tibco.tibjms.naming.ssl_password = <password>
- com.tibco.tibjms.naming.ssl_trusted_certs = <path_to>/cert_chain.pem
-
com.tibco.tibjms.naming.ssl_vendor = j2se-default
For example:
- com.tibco.tibjms.naming.security_protocol = ssl
- com.tibco.tibjms.naming.ssl_enable_verify_host = false
- com.tibco.tibjms.naming.ssl_expected_hostname = server1
- com.tibco.tibjms.naming.ssl_identity = /tibco/ems/certs/server-cert.p12
- com.tibco.tibjms.naming.ssl_password = password
- com.tibco.tibjms.naming.ssl_trusted_certs = /tibco/ems/certs/cert_chain.pem
-
com.tibco.tibjms.naming.ssl_vendor = j2se-default
Data Formats
- Avro
- The stage writes records based on the Avro schema. You can use one of the following methods to specify the location of the Avro schema definition:
- Binary
- The stage writes binary data to a single field in the record.
- Delimited
- The destination writes records as delimited data. When you use this data format, the root field must be list or list-map.
- JSON
- The destination writes records as JSON data. You can use one of
the following formats:
- Array - Each file includes a single array. In the array, each element is a JSON representation of each record.
- Multiple objects - Each file includes multiple JSON objects. Each object is a JSON representation of a record.
- Protobuf
- Writes one record in a message. Uses the user-defined message type and the definition of the message type in the descriptor file to generate the message.
- SDC Record
- The destination writes records in the SDC Record data format.
- Text
- The destination writes data from a single text field to the destination system. When you configure the stage, you select the field to use.
- XML
- The destination creates a valid XML document for each record. The
destination requires the record to have a single root field that
contains the rest of the record data. For details and
suggestions for how to accomplish this, see Record Structure Requirement.
The destination can include indentation to produce human-readable documents. It can also validate that the generated XML conforms to the specified schema definition. Records with invalid schemas are handled based on the error handling configured for the destination.
Configuring a JMS Producer Destination
Configure a JMS Producer destination to write to JMS.
-
In the Properties panel, on the General tab, configure the
following properties:
General Property Description Name Stage name. Description Optional description. Required Fields Fields that must include data for the record to be passed into the stage. Tip: You might include fields that the stage uses.Records that do not include all required fields are processed based on the error handling configured for the pipeline.
Preconditions Conditions that must evaluate to TRUE to allow a record to enter the stage for processing. Click Add to create additional preconditions. Records that do not meet all preconditions are processed based on the error handling configured for the stage.
On Record Error Error record handling for the stage: - Discard - Discards the record.
- Send to Error - Sends the record to the pipeline for error handling.
- Stop Pipeline - Stops the pipeline.
-
On the JMS tab, configure the following properties:
JMS Property Description JMS Initial Context Factory JMS initial context factory. For example, for Apache ActiveMQ you might use:
org.apache.activemq.jndi.ActiveMQInitialContextFactory
.Or for Oracle Weblogic, you might use:
weblogic.jndi.WLInitialContextFactory
.JNDI Connection Factory JNDI connection factory. For example, for ActiveMQ, you might use:
ConnectionFactory
.For Weblogic, you might use:
jms/ConnectionFactory
.JMS Provider URL URL for the JMS provider. For example, for ActiveMQ, you might use:
tcp://localhost:<portno>
.For Weblogic, you might use:
t3/localhost:<portno>
.JMS Destination Name JMS queue or topic name to write to. For example, for ActiveMQ, you might use:
<queue name>
.For Weblogic, you might use:
jms/Queue
.JMS Destination Type Optional destination type: queue, topic, or unknown. Include Headers Includes record header attributes with a jms.header
prefix as headers in the JMS messages.Remove Header Prefix Removes the jms.header
prefix from record header attribute names before including the information as headers in the JMS messages.Available when including headers in the JMS messages.
Additional JMS Configuration Properties Additional JMS or JNDI configuration properties to use. To add properties, click Add and define the JMS or JNDI property name and value.
When you add a configuration property, enter the exact property name and value. The stage does not validate the property names or values.
-
On the Credentials tab, configure the following
properties:
Credentials Property Description Use Credentials Enables using JMS credentials. Username JMS user name. Password JMS password. Tip: To secure sensitive information such as user names and passwords, you can use runtime resources or credential stores.Additional Security Properties Additional JMS or JNDI security properties to use. For example, you might add the
java.naming.security.principal
andjava.naming.security.credentials
properties.To add properties, click Add and define the JMS or JNDI property name and value. When you add a property, enter the exact property name and value. The stage does not validate the property names or values.
You can use credential functions to retrieve sensitive information from supported credential stores.Note: If a JMS stage defines the same property as an additional configuration property on the JMS tab, the additional security properties defined here take precedence. -
On the Data Format tab, configure the following
property:
Data Format Property Description Data Format Type of data to be read. Use one of the following formats: - Avro
- Delimited
- JSON
- Protobuf
- SDC Record
- Text
- XML
-
For Avro data, on the Data Format tab, configure the
following properties:
Avro Property Description Avro Schema Location Location of the Avro schema definition to use when writing data: - In Pipeline Configuration - Use the schema that you provide in the stage configuration.
- In Record Header - Use the schema in the avroSchema record header attribute. Use only when the avroSchema attribute is defined for all records.
- Confluent Schema Registry - Retrieve the schema from Confluent Schema Registry.
Avro Schema Avro schema definition used to write the data. You can optionally use the
runtime:loadResource
function to load a schema definition stored in a runtime resource file.Register Schema Registers a new Avro schema with Confluent Schema Registry. Schema Registry URLs Confluent Schema Registry URLs used to look up the schema or to register a new schema. To add a URL, click Add and then enter the URL in the following format: http://<host name>:<port number>
Basic Auth User Info User information needed to connect to Confluent Schema Registry when using basic authentication. Enter the key and secret from the
schema.registry.basic.auth.user.info
setting in Schema Registry using the following format:<key>:<secret>
Tip: To secure sensitive information such as user names and passwords, you can use runtime resources or credential stores.Look Up Schema By Method used to look up the schema in Confluent Schema Registry: - Subject - Look up the specified Avro schema subject.
- Schema ID - Look up the specified Avro schema ID.
Schema Subject Avro schema subject to look up or to register in Confluent Schema Registry. If the specified subject to look up has multiple schema versions, the stage uses the latest schema version for that subject. To use an older version, find the corresponding schema ID, and then set the Look Up Schema By property to Schema ID.
Schema ID Avro schema ID to look up in Confluent Schema Registry. Include Schema Includes the schema in each message. Note: Omitting the schema definition can improve performance, but requires the appropriate schema management to avoid losing track of the schema associated with the data.Avro Compression Codec The Avro compression type to use. When using Avro compression, do not enable other compression available in the destination.
-
For binary data, on the Data Format tab, configure the
following property:
Binary Property Description Binary Field Path Field that contains the binary data. -
For delimited data, on the Data Format tab, configure the
following properties:
Delimited Property Description Delimiter Format Format for delimited data: - Default CSV - File that includes comma-separated values. Ignores empty lines in the file.
- RFC4180 CSV - Comma-separated file that strictly follows RFC4180 guidelines.
- MS Excel CSV - Microsoft Excel comma-separated file.
- MySQL CSV - MySQL comma-separated file.
- Tab-Separated Values - File that includes tab-separated values.
- PostgreSQL CSV - PostgreSQL comma-separated file.
- PostgreSQL Text - PostgreSQL text file.
- Custom - File that uses user-defined delimiter, escape, and quote characters.
Header Line Indicates whether to create a header line. Delimiter Character Delimiter character for a custom delimiter format. Select one of the available options or use Other to enter a custom character. You can enter a Unicode control character using the format \uNNNN, where N is a hexadecimal digit from the numbers 0-9 or the letters A-F. For example, enter \u0000 to use the null character as the delimiter or \u2028 to use a line separator as the delimiter.
Default is the pipe character ( | ).
Record Separator String Characters to use to separate records. Use any valid Java string literal. For example, when writing to Windows, you might use \r\n to separate records. Available when using a custom delimiter format.
Escape Character Escape character for a custom delimiter format. Select one of the available options or use Other to enter a custom character. Default is the backslash character ( \ ).
Quote Character Quote character for a custom delimiter format. Select one of the available options or use Other to enter a custom character. Default is the quotation mark character ( " ).
Replace New Line Characters Replaces new line characters with the configured string. Recommended when writing data as a single line of text.
New Line Character Replacement String to replace each new line character. For example, enter a space to replace each new line character with a space. Leave empty to remove the new line characters.
Charset Character set to use when writing data. -
For JSON data, on the Data Format tab, configure the
following properties:
JSON Property Description JSON Content Method to write JSON data: - JSON Array of Objects - Each file includes a single array. In the array, each element is a JSON representation of each record.
- Multiple JSON Objects - Each file includes multiple JSON objects. Each object is a JSON representation of a record.
Charset Character set to use when writing data. -
For protobuf data, on the Data Format tab, configure the
following properties:
Protobuf Property Description Protobuf Descriptor File Descriptor file (.desc) to use. The descriptor file must be in the Data Collector resources directory, $SDC_RESOURCES
.For more information about environment variables, see Data Collector Environment Configuration. For information about generating the descriptor file, see Protobuf Data Format Prerequisites.
Message Type Fully-qualified name for the message type to use when writing data. Use the following format:
Use a message type defined in the descriptor file.<package name>.<message type>
. -
For text data, on the Data Format tab, configure the
following properties:
Text Property Description Text Field Path Field that contains the text data to be written. All data must be incorporated into the specified field. Record Separator Characters to use to separate records. Use any valid Java string literal. For example, when writing to Windows, you might use \r\n to separate records. By default, the destination uses \n.
On Missing Field When a record does not include the text field, determines whether the destination reports the missing field as an error or ignores the missing field. Insert Record Separator if No Text When configured to ignore a missing text field, inserts the configured record separator string to create an empty line. When not selected, discards records without the text field.
Charset Character set to use when writing data. -
For XML data, on the Data Format tab, configure the
following properties:
XML Property Description Pretty Format Adds indentation to make the resulting XML document easier to read. Increases the record size accordingly. Validate Schema Validates that the generated XML conforms to the specified schema definition. Records with invalid schemas are handled based on the error handling configured for the destination. Important: Regardless of whether you validate the XML schema, the destination requires the record in a specific format. For more information, see Record Structure Requirement.XML Schema The XML schema to use to validate records.