RabbitMQ trigger#
NOTE: RabbitMQ trigger is in tech-preview.
Reads messages from RabbitMQ queues.
Attributes#
| Path | Type | Description |
|---|---|---|
| exchangeName | string | The exchange that contains the queue |
| queueName | string | If specified, the trigger reads messages from this queue |
| topics | list of strings | If specified, the trigger creates a queue with a unique name and subscribes it to these topics |
| reconnectDuration | string of duration | The timeout when trying to reconnect to RabbitMQ. Default is 5 minutes. |
| reconnectInterval | string of duration | The interval to wait before reconnecting to RabbitMQ. Default is 15 seconds. |
| prefetchCount | int | The prefetch count of the broker channel. Default is 0. |
| durableExchange | bool | Define if the exchange is durable. Default is false. |
| durableQueue | bool | Define if the queue is durable. Default is false. |
| onError | string | Determines the behaviour when a message processing error occurs. Possible values: "ack" (acknowledge and remove) or "nack" (reject and optionally requeue). |
| requeueOnError | bool | If true, messages that fail processing are requeued when onError is set to "nack". Default is false. |
Note:
topicsandqueueNameare mutually exclusive. The trigger can either create to an existing queue specified byqueueNameor create its own queue, subscribing it totopics
Note: when running in Kubernetes / docker, the consumer name is the host name (pod name, e.g.:
my-pod-1234) and the connection name is consisted ofnuclio-<func-name>-<trigger-name>to allow differentiation between multiple functions consuming from the same server.
Example#
triggers:
myRabbit:
kind: "rabbit-mq"
url: "amqp://user:pass@10.0.0.1:5672"
attributes:
exchangeName: "myExchangeName"
queueName: "myQueueName"
reconnectDuration: "10m"
reconnectInterval: "60s"
prefetchCount: 1
durableExchange: true
durableQueue: true
onError: "nack"
requeueOnError: true
OR
triggers:
myRabbit:
kind: "rabbit-mq"
url: "amqp://10.0.0.1:5672"
username: "user"
password: "pass"
attributes:
exchangeName: "myExchangeName"
queueName: "myQueueName"
reconnectDuration: "10m"
reconnectInterval: "60s"
prefetchCount: 1
durableExchange: true
durableQueue: true
onError: "nack"
requeueOnError: true
Both configurations are supported.
During the enrichment stage, if credentials are provided within the URL, they are automatically extracted and assigned to username and password fields in the trigger configuration.
The URL is then sanitized (i.e., credentials are removed) to prevent sensitive data from being exposed in logs or configurations.
Note: If both the URL and the trigger configuration specify credentials, the credentials from the URL take precedence and will override any existing username or password values in the trigger specification.