Overview
This node acts as a customizable message consumer from a messaging queue system, designed to trigger workflows based on messages matching a specific routing key pattern. It is particularly useful in scenarios where workflows need to react to dynamic or custom routing keys within a message broker environment.
For example, you might use this node to listen for messages related to order updates, user notifications, or any other event-driven data that follows a certain naming convention in the routing key. By specifying a prefix and pattern, users can finely control which messages trigger their workflows.
Properties
| Name | Meaning |
|---|---|
| Routing Key Prefix | The prefix added before the defined pattern, separated by a dot. For example, "query" could prefix "user.update". |
| Queue | The name of the queue to consume messages from. If left empty, a unique queue name will be generated automatically. |
| Pattern | The suffix pattern (without prefix) used to match routing keys for triggering the workflow. This is required. |
| Options: | Collection of additional options controlling message handling behavior: |
| - Delete From Queue When | Specifies when to acknowledge and remove the message from the queue. Options include: immediately upon receipt, after execution finishes (successfully or not), or later via another node. |
| - JSON Parse Body | Whether to parse the message body as JSON into an object. Defaults to true. |
| - Only Content | Whether to return only the content property of the message. Defaults to true. |
| - Parallel Message Processing Limit | Maximum number of concurrent executions allowed. Use -1 for unlimited. Only applicable if acknowledgment is not immediate. |
Output
The node outputs JSON data representing the consumed message. Depending on the options:
- If
Only Contentis true, the output contains only the main content of the message. - If
JSON Parse Bodyis enabled, the message body is parsed into an object. - Otherwise, the full message structure is available.
No binary data output is indicated.
Dependencies
- Requires connection to a RabbitMQ-compatible message broker.
- Needs appropriate credentials or API authentication configured in n8n to access the message queue.
- No additional external dependencies are indicated in the source code.
Troubleshooting
Common Issues:
- Messages not triggering workflows: Verify that the routing key prefix and pattern correctly match the message routing keys.
- Queue name conflicts: If a static queue name is used, ensure it does not conflict with other consumers.
- JSON parsing errors: If
JSON Parse Bodyis enabled but the message body is not valid JSON, parsing will fail.
Error Messages:
- Parsing errors typically indicate malformed JSON in the message body; consider disabling JSON parsing or validating message format upstream.
- Connection errors suggest misconfigured credentials or network issues with the message broker.