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 in the Data Collector documentation.

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.

You can also use a connection to configure the destination.

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 in the Data Collector documentation.

Include Headers

You can configure the destination to include record header attributes with a jms.header prefix as headers in the JMS messages.

Records can include record header attributes with a 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

You can configure additional JMS or JNDI configuration properties for the destination to use in the following locations:
  • 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. For more information about credential stores, see Credential Stores in the Data Collector documentation.

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

To communicate with TIBCO Enterprise Message Service (EMS), add the following additional JMS properties to the JMS Producer:
  • java.naming.security.principal = <username>
  • java.naming.security.credentials = <password>

Configuring for TIBCO and SSL

If you are configuring SSL on the TIBCO EMS server, add the following additional JMS properties. Your connection fails if you do not specify these properties.
  • 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

The JMS Producer destination writes data to JMS based on the data format that you select. You can use the following 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:
  • In Pipeline Configuration - Use the schema that you provide in the stage configuration.
  • In Record Header - Use the schema included in the avroSchema record header attribute.
  • Confluent Schema Registry - Retrieve the schema from Confluent Schema Registry. The Confluent Schema Registry is a distributed storage layer for Avro schemas. You can configure the destination to look up the schema in the Confluent Schema Registry by the schema ID or subject.

    If using the Avro schema in the stage or in the record header attribute, you can optionally configure the stage to register the Avro schema with the Confluent Schema Registry. You can also optionally include the schema definition in the message. Omitting the schema definition can improve performance, but requires the appropriate schema management to avoid losing track of the schema associated with the data.

You can include the Avro schema in the output.
You can also compress data with an Avro-supported compression codec. When using Avro compression, avoid configuring any other compression properties in the stage.
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.
You can use the following delimited format types:
  • 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.
  • Multi Character Delimited - File that uses multiple user-defined characters to delimit fields and lines, and single user-defined escape and quote characters.
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.
For information about generating the descriptor file, see Protobuf Data Format Prerequisites.
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.
You can configure the characters to use as record separators. By default, the destination uses a UNIX-style line ending (\n) to separate records.
When a record does not contain the selected text field, the destination can report the missing field as an error or to ignore the missing field. By default, the destination reports an error.
When configured to ignore a missing text field, the destination can discard the record or write the record separator characters to create an empty line for the record. By default, the destination discards the record.
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.

  1. 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. Not valid for cluster pipelines.
  2. On the JMS tab, configure the following properties:
    JMS Property Description
    Connection Connection that defines the information required to connect to an external system.

    To connect to an external system, you can select a connection that contains the details, or you can directly enter the details in the pipeline. When you select a connection, Control Hub hides other properties so that you cannot directly enter connection details in the pipeline.

    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.

  3. 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. For more information about credential stores, see Credential Stores in the Data Collector documentation.
    Additional Security Properties

    Additional JMS or JNDI security properties to use. For example, you might add the java.naming.security.principal and java.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. For more information about credential stores, see Credential Stores in the Data Collector documentation.
    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.
  4. 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
  5. 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. For more information about credential stores, see Credential Stores in the Data Collector documentation.
    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.

  6. For binary data, on the Data Format tab, configure the following property:
    Binary Property Description
    Binary Field Path Field that contains the binary data.
  7. 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.
  8. For JSON data, on the Data Format tab, configure the following property:
    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.
  9. 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 in the Data Collector documentation. 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: <package name>.<message type>.

    Use a message type defined in the descriptor file.
  10. 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.
  11. 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.