RabbitMQ Consumer
RabbitMQ Consumer reads AMQP messages from a single RabbitMQ queue.
When you configure the origin, 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 read messages from one or more exchanges.
You can configure the origin to generate a single record for each RabbitMQ message. By default, if a message includes multiple objects, the origin generates a record for each object.
You can add custom configuration options and define connection credentials as needed.
Queue
RabbitMQ Consumer reads messages from a specified queue.
When you configure the origin, you define the queue name and other properties. If a queue of the specified name does not exist, RabbitMQ creates the queue based on the properties that you defined.
If the queue does exist but the properties are incorrect, error messages display when trying to connect.
Record Header Attributes
The RabbitMQ Consumer origin includes information from RabbitMQ basic properties in the record header attributes of the generated record. When the origin processes Avro data, it includes the Avro schema in an avroSchema record header attribute.
You can use the record:attribute or record:attributeOrDefault functions to access the information in the attributes. For more information about working with record header attributes, see Working with Header Attributes.
- avroSchema - When processing Avro data, provides the Avro schema.
- appId - Provides information from the RabbitMQ app-id property.
- contentType - Provides information from the RabbitMQ content-type property.
- contentEncoding - Provides information from the RabbitMQ content-encoding property.
- correlationId - Provides information from the RabbitMQ correlation-id property.
- deliveryMode - Provides information from the RabbitMQ delivery-mode property.
- deliveryTag - Provides information from the RabbitMQ delivery-tag property.
- exchange - Provides information from the RabbitMQ exchange-name property.
- expiration - Provides information from the RabbitMQ expiration property.
- messageId - Provides information from the RabbitMQ message-id property.
- messageType - Provides information from the RabbitMQ type property.
- priority - Provides information from the RabbitMQ priority property.
- redelivered - Provides information from the RabbitMQ redelivered property.
- replyTo - Provides information from the RabbitMQ reply-to property.
- routingKey - Provides information from the RabbitMQ routing-key property.
- timestamp - Provides information from the RabbitMQ timestamp property.
- userId - Provides information from the RabbitMQ user-id property.
Data Formats
The RabbitMQ Consumer origin processes data differently based on the data format. The origin can process the following types of data:
- Avro
- Generates a record for every message. Includes a "precision" and "scale" field attribute for each Decimal field. For more information about field attributes, see Field Attributes.
- Binary
- Generates a record with a single byte array field at the root of the record.
- Delimited
- Generates a record for each delimited line. 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
- Generates a record for each JSON object. You can process JSON files that include multiple JSON objects or a single JSON array.
- Log
- Generates a record for every log line.
- Protobuf
- Generates a record for every protobuf message. By default, the origin assumes messages contain multiple protobuf messages.
- SDC Record
- Generates a record for every record. Use to process records generated by a Data Collector pipeline using the SDC Record data format.
- Text
- Generates a record for each line of text or for each section of text based on a custom delimiter.
- XML
- Generates records based on a user-defined delimiter element. Use an XML element directly under the root element or define a simplified XPath expression. If you do not define a delimiter element, the origin treats the XML file as a single record.
Configuring a RabbitMQ Consumer
Configure a RabbitMQ Consumer to read messages from a RabbitMQ queue.