RabbitMQ Producer

RabbitMQ Producer writes AMQP messages to a single RabbitMQ queue.

When you configure the destination, you specify the information needed to connect to RabbitMQ client. You also define a queue and the bindings to use. You can use multiple bindings to write messages to one or more exchanges. You can optionally configure AMQP message properties.

You can add custom configuration options and define connection credentials as needed.

Data Formats

RabbitMQ Producer writes data to RabbitMQ based on the data format that you select. You can use the following data formats:
Avro
The destination 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 destination 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 compress data with an Avro-supported compression codec. When using Avro compression, avoid using any other compression properties in the destination.
Binary
The destination writes binary data from 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.
  • PostgreSQL CSV - PostgreSQL comma-separated file.
  • PostgreSQL Text - PostgreSQL text file.
  • Tab-Separated Values - File that includes tab-separated values.
  • Custom - File that uses user-defined delimiter, 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. When necessary, merge record data into the field earlier in the pipeline.
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, you can configure the destination to 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, you can configure the destination to discard the record or to write the record separator characters to create an empty line for the record. By default, the destination discards the record.

Configuring a RabbitMQ Producer

Configure a RabbitMQ Producer to write messages to RabbitMQ.

  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.
  2. On the RabbitMQ tab, configure the following properties:
    RabbitMQ Property Description
    URI RabbitMQ URI.

    Typically uses the following format: amqp:<host>:<port>/<virtualhost>.

    Additional Client Configuration Additional RabbitMQ client configuration properties to use. To add properties, click Add and define the RabbitMQ client property name and value.

    Use the property names and values as expected by RabbitMQ.

    One Message per Batch For each batch, writes the records to each partition as a single message.
    Mandatory Requires at least one active consumer subscribed to the queue.

    When selected, if the queue has no active consumers, RabbitMQ returns an error that can stop the pipeline.

    Set AMQP Message Properties Enables RabbitMQ AMQP message properties configuration. When not selected, the destination uses the default RabbitMQ properties.

    For more information about AMQP message properties, see the RabbitMQ documentation.

    Content Type MIME content type.
    Content Encoding MIME content encoding.
    Headers Message headers.
    Delivery Mode Determines if the messages are saved to disk. To save messages to disk, select Persistent.
    Priority Message priority. Select a value from 1 to 9.
    Correlation ID Correlation ID.
    Reply To Queue name for responses.
    Expiration Time before deleting messages.
    Message ID Message identifier string.
    Set Current Time Uses the current time as the timestamp associated with the message.
    Timestamp String to use as the timestamp for the messages.
    Message Type Type of event or command that the message represents.
    User ID User ID. When used, the user ID must be defined with RabbitMQ.
    App ID Application ID.
    Use Credentials Enables the use of RabbitMQ credentials.
  3. On the Credentials tab, enter the RabbitMQ credentials to use if you enabled credentials.
    Tip: To secure sensitive information such as usernames and passwords, you can use runtime resources or credential stores.
  4. On the Queue tab, configure the following queue properties:
    These properties directly correspond to RabbitMQ properties. For more information, see the RabbitMQ documentation.
    Queue Property Description
    Name Name of the queue to use or create.
    Durable Creates a durable queue when selected.

    The stage creates a durable queue by default.

    Exclusive Creates an exclusive queue when selected. When exclusive, the queue allows only the Data Collector to use it.

    The stage creates an exclusive queue by default.

    Auto-Delete Automatically deletes a queue after all consumers unsubscribe.

    When used with an exclusive queue, the queue is automatically deleted when you stop the pipeline.

    Declaration Properties Additional queue declaration properties to use.
  5. On the Exchange tab, optionally configure the following binding properties for the bindings that you want to use. When no bindings are configured, the default exchange is used.
    These properties directly correspond to RabbitMQ properties. For more information, see the RabbitMQ documentation.
    Exchange Property Description
    Name Binding name.
    Type Binding type.
    Durable Creates a durable exchange.
    Auto-Delete Automatically deletes an exchange when all queues are finished using it.
    Routing Key Routing key.

    Leave empty to default to the queue name.

    Declaration Properties Additional exchange properties to use.
    Binding Properties Additional binding properties to use.
  6. Optionally configure advanced options on the Advanced tab.
    These properties directly correspond to RabbitMQ properties. For more information, see the RabbitMQ documentation.
    Generally, you should use the defaults for these properties:
    Advanced Property Description
    Automatic Recovery Enabled Determines whether to attempt to reestablish a connection.
    Network Recovery Interval Milliseconds to wait before attempting to reestablish a network connection.

    Default is 5000.

    Connection Timeout (ms) Milliseconds for the connection to establish. Use 0 to opt out of a connection timeout.

    Default is 0.

    Handshake Timeout (ms) Milliseconds for the handshake to complete.
    Shutdown Timeout (ms) Milliseconds for the shutdown to complete.
    Heartbeat Timeout (secs) Seconds to wait for a heartbeat to verify that RabbitMQ is up and the connection still available.

    Use 0 to avoid requesting heartbeats. Default is 0.

    Maximum Frame Size (bytes) Maximum frame size in bytes. Use for performance tuning.

    Setting a larger value can improve throughput. Setting a smaller value can improve latency.

    Use 0 for no limit. Default is 0.

    Maximum Channel Number Maximum number of channels allowed.
  7. On the Data Format tab, configure the following property:
    Data Format Property Description
    Data Format
    Data format for messages:
    • Avro
    • Binary
    • Delimited
    • JSON
    • Protobuf
    • SDC Record
    • Text
  8. 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 the Confluent Schema Registry.
    Avro Schema Avro schema definition used to write the data.

    You can optionally use the runtime:loadResource function to use a schema definition stored in a runtime resource file.

    Register Schema Select to register a new Avro schema with the 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. Use the following format to enter the URL:
    http://<host name>:<port number>
    Look Up Schema By Method used to look up the schema in the 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 the Confluent Schema Registry.

    If the specified subject to look up has multiple schema versions, the origin 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 the 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.

  9. For binary data, on the Data Format tab, configure the following property:
    Binary Property Description
    Binary Field Path Field that contains the binary data.
  10. 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.
    • PostgreSQL CSV - PostgreSQL comma-separated file.
    • PostgreSQL Text - PostgreSQL text file.
    • Tab-Separated Values - File that includes tab-separated values.
    • Custom - File that uses user-defined delimiter, escape, and quote characters.
    Header Line Indicates whether to create a header line.
    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.

    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 ( | ).

    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 ( " ).

    Charset Character set to use when writing data.
  11. For JSON data, on the Data Format tab, configure the following property:
    JSON Property Description
    JSON Content Determines how JSON data is written:
    • 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.
  12. 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 The 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.
  13. 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.