This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git
The following commit(s) were added to refs/heads/main by this push:
new 456f3e6b1 chore: the RabbitMQ Kamelets can scale, retry and
dead-letter, and the sink can set the content type (#3170) (#3238)
456f3e6b1 is described below
commit 456f3e6b1d8ca95f2bc0b9228f3b1c36ea0889c2
Author: Claus Ibsen <[email protected]>
AuthorDate: Wed Nov 18 22:39:38 2026 +0100
chore: the RabbitMQ Kamelets can scale, retry and dead-letter, and the sink
can set the content type (#3170) (#3238)
spring-rabbitmq-source takes new optional options:
- exchangeType: the type of the exchange that autoDeclare creates
(direct, fanout, headers, topic); with topic, routingKey is a pattern.
- concurrentConsumers and prefetchCount: how many consumers receive in
parallel, each on its own channel, and how many messages RabbitMQ
sends ahead to each.
- acknowledgeMode: AUTO or NONE. MANUAL is left out: a Kamelet cannot
acknowledge, so the messages would stay unacknowledged.
- maximumRetryAttempts and retryDelay: how many times a failing message
is tried again, and how long apart.
- deadLetterExchange, deadLetterRoutingKey, deadLetterQueue and
deadLetterExchangeType: with autoDeclare, create a dead letter
exchange and queue and set them on the queue, so that a message that
still fails after the retries moves to the dead letter queue.
spring-rabbitmq-sink takes allowNullBody, to send a message with no
body as an empty message, and contentType, to send every message with
a content type such as application/json instead of text/plain or
application/octet-stream.
maximumRetryAttempts counts the retries, not the tries: a message is
tried 6 times when it is not set, so the description of the source,
which said 5, is corrected. rejectAndDontRequeue and
maxConcurrentConsumers are left out: with false, the first drops the
message after the retries instead of requeuing it, and the second works
only with the SMLC container, which the Kamelet does not use.
With the new options unset, the endpoint URIs are the same as before.
The connection factory and the trust store options are unchanged.
Co-authored-by: Claude Opus 5.5 <[email protected]>
---
.../partials/spring-rabbitmq-sink-description.adoc | 31 +++++++++++-
.../spring-rabbitmq-source-description.adoc | 57 +++++++++++++++++++++-
kamelets/spring-rabbitmq-sink.kamelet.yaml | 25 +++++++++-
kamelets/spring-rabbitmq-source.kamelet.yaml | 57 +++++++++++++++++++++-
.../main/resources/META-INF/kamelets-index.json | 4 +-
.../kamelets/spring-rabbitmq-sink.kamelet.yaml | 25 +++++++++-
.../kamelets/spring-rabbitmq-source.kamelet.yaml | 57 +++++++++++++++++++++-
7 files changed, 243 insertions(+), 13 deletions(-)
diff --git a/docs/modules/ROOT/partials/spring-rabbitmq-sink-description.adoc
b/docs/modules/ROOT/partials/spring-rabbitmq-sink-description.adoc
index 7946d1e08..bd859f894 100644
--- a/docs/modules/ROOT/partials/spring-rabbitmq-sink-description.adoc
+++ b/docs/modules/ROOT/partials/spring-rabbitmq-sink-description.adoc
@@ -42,4 +42,33 @@ RabbitMQ provides enterprise-grade features:
=== Message Patterns
-Supports publish-subscribe and message queuing. It sends each message and does
not wait for a reply.
\ No newline at end of file
+Supports publish-subscribe and message queuing. It sends each message and does
not wait for a reply.
+
+=== Content type
+
+Text is sent with the content type `text/plain`, and bytes with
`application/octet-stream`. Set `contentType` to send
+every message with another content type, such as `application/json`, so that
the applications that read the queue know
+the format. A message with no body fails, unless `allowNullBody` is true: then
it is sent as an empty message.
+
+=== Usage example
+
+The following route publishes the JSON that is posted to `/orders` to the
exchange `orders`, with the routing key
+`new-order` and the content type `application/json`:
+
+[source,yaml,subs='+attributes,macros']
+----
+- route:
+ from:
+ uri: "kamelet:webhook-source"
+ parameters:
+ subpath: "orders"
+ steps:
+ - to:
+ uri: "kamelet:spring-rabbitmq-sink"
+ parameters:
+ host: "localhost"
+ port: 5672
+ exchangeName: "orders"
+ routingKey: "new-order"
+ contentType: "application/json"
+----
diff --git a/docs/modules/ROOT/partials/spring-rabbitmq-source-description.adoc
b/docs/modules/ROOT/partials/spring-rabbitmq-source-description.adoc
index 51db6ac7b..e570bfe25 100644
--- a/docs/modules/ROOT/partials/spring-rabbitmq-source-description.adoc
+++ b/docs/modules/ROOT/partials/spring-rabbitmq-source-description.adoc
@@ -13,8 +13,61 @@ JSON. The headers of the RabbitMQ message become headers.
=== Queues, exchanges and bindings
With `autoDeclare` set to false (the default), the queue in `queues` must
already exist and be bound to the exchange.
-With `autoDeclare` set to true, the Kamelet creates a `direct` exchange named
`exchangeName`, the queue, and the
-binding with `routingKey` when it starts.
+With `autoDeclare` set to true, the Kamelet creates the exchange named
`exchangeName`, the queue, and the binding with
+`routingKey` when it starts. The exchange is a `direct` exchange unless
`exchangeType` is `fanout`, `headers` or
+`topic`. With `topic`, `routingKey` is a pattern: `orders.*` matches
`orders.new` but not `orders.eu.new`, and
+`orders.#` matches both. When the exchange or the queue already exists with
other settings, such as another type or
+another dead letter exchange, the Kamelet fails to start.
+
+=== Parallel processing
+
+One consumer processes one message at a time. With `concurrentConsumers`, that
many consumers receive from the queue,
+each on its own channel, and process messages in parallel, so not in order.
`prefetchCount` is how many messages
+RabbitMQ sends ahead to each consumer before they are acknowledged (250 when
it is not set). Both show in the RabbitMQ
+management UI, on the consumers of the queue.
+
+With `acknowledgeMode` set to `NONE`, RabbitMQ removes each message from the
queue as soon as it is delivered: a
+message whose processing fails is then lost, and does not go to the dead
letter exchange.
+
+=== Retries and dead letters
+
+When the processing of a message fails, the Kamelet tries it again
`maximumRetryAttempts` times (5 when it is not set),
+`retryDelay` milliseconds apart (1000 when it is not set). When it still
fails, RabbitMQ drops it, or sends it to the
+dead letter exchange of the queue.
+
+With `autoDeclare` set to true, the Kamelet can set up the dead letter
exchange too: it creates the exchange in
+`deadLetterExchange` (of type `deadLetterExchangeType`, `direct` when it is
not set), creates the queue in `queues` with
+it as its dead letter exchange and `deadLetterRoutingKey` as its dead letter
routing key, and creates the queue in
+`deadLetterQueue` bound to the exchange with that key. `deadLetterQueue` needs
`deadLetterRoutingKey`. With
+`autoDeclare` false, these options are not used: set the dead letter exchange
on the queue in RabbitMQ instead, for
+example with a policy.
+
+The following route tries a failing message 3 times in all, 2 seconds apart,
and then moves it to the queue
+`orders.dlq`. The message there has an `x-death` header that says which queue
it failed in.
+
+[source,yaml,subs='+attributes,macros']
+----
+- route:
+ from:
+ uri: "kamelet:spring-rabbitmq-source"
+ parameters:
+ host: "localhost"
+ port: 5672
+ exchangeName: "orders"
+ queues: "orders"
+ routingKey: "new-order"
+ autoDeclare: true
+ concurrentConsumers: 4
+ prefetchCount: 10
+ maximumRetryAttempts: 2
+ retryDelay: 2000
+ deadLetterExchange: "orders.dlx"
+ deadLetterRoutingKey: "failed"
+ deadLetterQueue: "orders.dlq"
+ steps:
+ - to:
+ uri: "kamelet:log-sink"
+----
=== Usage example
diff --git a/kamelets/spring-rabbitmq-sink.kamelet.yaml
b/kamelets/spring-rabbitmq-sink.kamelet.yaml
index 6476aef25..67e535e46 100644
--- a/kamelets/spring-rabbitmq-sink.kamelet.yaml
+++ b/kamelets/spring-rabbitmq-sink.kamelet.yaml
@@ -35,7 +35,7 @@ spec:
Use it to hand work or events to applications that read from RabbitMQ
queues. Use `spring-rabbitmq-source` to read from them.
- Input: the body is the payload, as text or bytes. Text is sent with the
content type `text/plain`, and bytes with `application/octet-stream`. A Map
fails, and so does an empty body: turn structured data into JSON text first,
for example with `json-serialize-action`. The headers of the message, except
the Camel ones, are sent as headers of the RabbitMQ message.
+ Input: the body is the payload, as text or bytes. Text is sent with the
content type `text/plain`, and bytes with `application/octet-stream`, unless
`contentType` says otherwise. A Map fails: turn structured data into JSON text
first, for example with `json-serialize-action`, and set `contentType` to
`application/json`. A message with no body fails, unless `allowNullBody` is
true. The headers of the message, except the Camel ones, are sent as headers of
the RabbitMQ message.
Output: the message is unchanged.
@@ -129,6 +129,16 @@ spec:
format: password
x-descriptors:
- urn:camel:group:credentials
+ allowNullBody:
+ title: "Allow Null Body"
+ description: "If true, a message with no body is sent as an empty
RabbitMQ message, with the content type `application/octet-stream`, or the one
in `contentType`. When it is not set, a message with no body fails."
+ type: boolean
+ contentType:
+ title: "Content Type"
+ description: "The content type to send every message with, such as
`application/json` or `application/json; charset=utf-8`, so that the
applications that read it know its format. When it is not set, text is sent as
`text/plain`, and bytes as `application/octet-stream`."
+ type: string
+ example: "application/json"
+ pattern: "^[A-Za-z0-9!#$&^_.+-]+/[A-Za-z0-9!#$&^_.+-]+( *;
*[A-Za-z0-9!#$&^_.+-]+=[A-Za-z0-9!#$&^_.+-]+)*$"
dependencies:
- "camel:spring-rabbitmq"
- "camel:kamelet"
@@ -155,6 +165,17 @@ spec:
from:
uri: kamelet:source
steps:
+ - choice:
+ when:
+ - expression:
+ simple:
+ expression: "'{{?contentType}}' != ''"
+ steps:
+ - setHeader:
+ name: CamelSpringRabbitmqContentType
+ expression:
+ constant:
+ expression: "{{?contentType}}"
- to:
- uri:
"spring-rabbitmq://{{exchangeName}}?autoDeclareProducer={{autoDeclareProducer}}&confirm={{confirm}}&confirmTimeout={{confirmTimeout}}&connectionFactory=#bean:{{connectionFactory}}&queues={{?queues}}&routingKey={{?routingKey}}"
+ uri:
"spring-rabbitmq://{{exchangeName}}?autoDeclareProducer={{autoDeclareProducer}}&confirm={{confirm}}&confirmTimeout={{confirmTimeout}}&connectionFactory=#bean:{{connectionFactory}}&queues={{?queues}}&routingKey={{?routingKey}}&allowNullBody={{?allowNullBody}}"
pattern: InOnly
diff --git a/kamelets/spring-rabbitmq-source.kamelet.yaml
b/kamelets/spring-rabbitmq-source.kamelet.yaml
index b3e84b3e4..85d25b915 100644
--- a/kamelets/spring-rabbitmq-source.kamelet.yaml
+++ b/kamelets/spring-rabbitmq-source.kamelet.yaml
@@ -37,7 +37,7 @@ spec:
Output: the body is text when the content type of the message starts
with `text`, and bytes otherwise. The headers of the RabbitMQ message become
headers, along with `CamelSpringRabbitmqExchangeName`,
`CamelSpringRabbitmqRoutingKey` and `CamelSpringRabbitmqContentType`.
- Good to know: with `autoDeclare` false, the default, the queue must
exist already, bound to the exchange; until it does, the source keeps trying
again. With `autoDeclare` true, it creates the exchange as a `direct` exchange,
the queue in `queues` and the binding with `routingKey`. Without `queues`, it
reads from a new queue with a generated name. A message whose processing fails
is tried 5 times, one second apart, and then dropped, or sent to the dead
letter exchange of the queue w [...]
+ Good to know: with `autoDeclare` false, the default, the queue must
exist already, bound to the exchange; until it does, the source keeps trying
again. With `autoDeclare` true, it creates the exchange, as a `direct` exchange
unless `exchangeType` says otherwise, the queue in `queues` and the binding
with `routingKey`; when the exchange or the queue exists already with other
settings, such as another type or another dead letter exchange, the source
fails to start. Without `queues`, [...]
required:
- host
- port
@@ -110,6 +110,59 @@ spec:
format: password
x-descriptors:
- urn:camel:group:credentials
+ exchangeType:
+ title: "Exchange Type"
+ description: "The type of the exchange that the source creates when
`autoDeclare` is true: `direct`, `fanout`, `headers` or `topic`. When it is not
set, it is `direct`. With `topic`, `routingKey` can be a pattern: `orders.*`
matches `orders.new`, and `orders.#` also matches `orders.eu.new`. Not used
when `autoDeclare` is false."
+ type: string
+ enum: ["direct", "fanout", "headers", "topic"]
+ concurrentConsumers:
+ title: "Concurrent Consumers"
+ description: "How many consumers receive from the queue at the same
time, each on its own channel, so that as many messages are processed in
parallel. When it is not set, there is one consumer, and the messages are
processed one at a time."
+ type: integer
+ example: 4
+ prefetchCount:
+ title: "Prefetch Count"
+ description: "How many messages RabbitMQ sends ahead to each consumer,
before they are acknowledged. When it is not set, it is 250."
+ type: integer
+ example: 10
+ acknowledgeMode:
+ title: "Acknowledge Mode"
+ description: "When RabbitMQ removes a message from the queue: with
`AUTO`, once it has been processed, or has failed after the retries; with
`NONE`, as soon as it is delivered, so a message whose processing fails is lost
and does not go to the dead letter exchange. When it is not set, `AUTO` is
used."
+ type: string
+ enum: ["AUTO", "NONE"]
+ maximumRetryAttempts:
+ title: "Maximum Retry Attempts"
+ description: "How many times a message whose processing fails is tried
again, after the first try. When it is not set, it is tried again 5 times, so 6
times in all. With 0, it is not tried again."
+ type: integer
+ example: 3
+ retryDelay:
+ title: "Retry Delay"
+ description: "How long to wait before a failing message is tried
again, in milliseconds. When it is not set, it waits 1000 milliseconds."
+ type: integer
+ example: 5000
+ deadLetterExchange:
+ title: "Dead Letter Exchange"
+ description: "The exchange that RabbitMQ sends a message to when its
processing still fails after the retries. The source creates this exchange, and
creates the queue in `queues` with it as its dead letter exchange. Needs
`autoDeclare` true; with `autoDeclare` false, it is not used, and the dead
letter exchange must be set on the queue in RabbitMQ, for example with a
policy."
+ type: string
+ example: "orders.dlx"
+ pattern: "^[A-Za-z0-9_.:-]+$"
+ deadLetterRoutingKey:
+ title: "Dead Letter Routing Key"
+ description: "The routing key that a failed message is sent to
`deadLetterExchange` with, and that binds `deadLetterQueue` to it. When it is
not set, a failed message keeps the routing key it was published with. Needs
`deadLetterExchange` and `autoDeclare` true."
+ type: string
+ example: "failed"
+ pattern: "^[A-Za-z0-9_.:-]+$"
+ deadLetterQueue:
+ title: "Dead Letter Queue"
+ description: "A queue that the source creates and binds to
`deadLetterExchange` with `deadLetterRoutingKey`, to keep the failed messages.
Needs `deadLetterExchange`, `deadLetterRoutingKey` and `autoDeclare` true;
without `deadLetterRoutingKey`, the source fails to start."
+ type: string
+ example: "orders.dlq"
+ pattern: "^[A-Za-z0-9_.:-]+$"
+ deadLetterExchangeType:
+ title: "Dead Letter Exchange Type"
+ description: "The type of the exchange that the source creates in
`deadLetterExchange`: `direct`, `fanout`, `headers` or `topic`. When it is not
set, it is `direct`."
+ type: string
+ enum: ["direct", "fanout", "headers", "topic"]
dataTypes:
out:
headers:
@@ -147,7 +200,7 @@ spec:
constructors:
0: "#bean:{{rabbitConnectionFactory}}"
from:
- uri:
"spring-rabbitmq://{{exchangeName}}?autoDeclare={{autoDeclare}}&connectionFactory=#bean:{{connectionFactory}}&queues={{?queues}}&routingKey={{?routingKey}}"
+ uri:
"spring-rabbitmq://{{exchangeName}}?autoDeclare={{autoDeclare}}&connectionFactory=#bean:{{connectionFactory}}&queues={{?queues}}&routingKey={{?routingKey}}&exchangeType={{?exchangeType}}&concurrentConsumers={{?concurrentConsumers}}&prefetchCount={{?prefetchCount}}&acknowledgeMode={{?acknowledgeMode}}&maximumRetryAttempts={{?maximumRetryAttempts}}&retryDelay={{?retryDelay}}&deadLetterExchange={{?deadLetterExchange}}&deadLetterRoutingKey={{?deadLetterRoutingKey}}&deadLetterQueue
[...]
steps:
- to:
uri: kamelet:sink
diff --git
a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
index ab023c6e2..ffc7def08 100644
--- a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
+++ b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
@@ -2115,7 +2115,7 @@
"supportLevel" : "Preview",
"title" : "RabbitMQ Sink",
"summary" : "Publishes each message to an exchange in a RabbitMQ broker,
which routes it to queues by its routing key.",
- "description" : "Publishes each message to an exchange in a RabbitMQ
broker, which routes it to queues by its routing key.\n\nUse it to hand work or
events to applications that read from RabbitMQ queues. Use
`spring-rabbitmq-source` to read from them.\n\nInput: the body is the payload,
as text or bytes. Text is sent with the content type `text/plain`, and bytes
with `application/octet-stream`. A Map fails, and so does an empty body: turn
structured data into JSON text first, for exam [...]
+ "description" : "Publishes each message to an exchange in a RabbitMQ
broker, which routes it to queues by its routing key.\n\nUse it to hand work or
events to applications that read from RabbitMQ queues. Use
`spring-rabbitmq-source` to read from them.\n\nInput: the body is the payload,
as text or bytes. Text is sent with the content type `text/plain`, and bytes
with `application/octet-stream`, unless `contentType` says otherwise. A Map
fails: turn structured data into JSON text first [...]
"group" : "RabbitMQ",
"namespace" : "Messaging",
"provider" : "Apache Software Foundation"
@@ -2125,7 +2125,7 @@
"supportLevel" : "Preview",
"title" : "RabbitMQ Source",
"summary" : "Receives each message from a queue in a RabbitMQ broker, and
can create that queue and bind it to an exchange with a routing key.",
- "description" : "Receives each message from a queue in a RabbitMQ broker,
and can create that queue and bind it to an exchange with a routing key.\n\nUse
it to process work or events that other applications publish to RabbitMQ. Use
`spring-rabbitmq-sink` to publish them.\n\nOutput: the body is text when the
content type of the message starts with `text`, and bytes otherwise. The
headers of the RabbitMQ message become headers, along with
`CamelSpringRabbitmqExchangeName`, `CamelSpring [...]
+ "description" : "Receives each message from a queue in a RabbitMQ broker,
and can create that queue and bind it to an exchange with a routing key.\n\nUse
it to process work or events that other applications publish to RabbitMQ. Use
`spring-rabbitmq-sink` to publish them.\n\nOutput: the body is text when the
content type of the message starts with `text`, and bytes otherwise. The
headers of the RabbitMQ message become headers, along with
`CamelSpringRabbitmqExchangeName`, `CamelSpring [...]
"group" : "RabbitMQ",
"namespace" : "Messaging",
"provider" : "Apache Software Foundation"
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/spring-rabbitmq-sink.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/spring-rabbitmq-sink.kamelet.yaml
index 6476aef25..67e535e46 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/spring-rabbitmq-sink.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/spring-rabbitmq-sink.kamelet.yaml
@@ -35,7 +35,7 @@ spec:
Use it to hand work or events to applications that read from RabbitMQ
queues. Use `spring-rabbitmq-source` to read from them.
- Input: the body is the payload, as text or bytes. Text is sent with the
content type `text/plain`, and bytes with `application/octet-stream`. A Map
fails, and so does an empty body: turn structured data into JSON text first,
for example with `json-serialize-action`. The headers of the message, except
the Camel ones, are sent as headers of the RabbitMQ message.
+ Input: the body is the payload, as text or bytes. Text is sent with the
content type `text/plain`, and bytes with `application/octet-stream`, unless
`contentType` says otherwise. A Map fails: turn structured data into JSON text
first, for example with `json-serialize-action`, and set `contentType` to
`application/json`. A message with no body fails, unless `allowNullBody` is
true. The headers of the message, except the Camel ones, are sent as headers of
the RabbitMQ message.
Output: the message is unchanged.
@@ -129,6 +129,16 @@ spec:
format: password
x-descriptors:
- urn:camel:group:credentials
+ allowNullBody:
+ title: "Allow Null Body"
+ description: "If true, a message with no body is sent as an empty
RabbitMQ message, with the content type `application/octet-stream`, or the one
in `contentType`. When it is not set, a message with no body fails."
+ type: boolean
+ contentType:
+ title: "Content Type"
+ description: "The content type to send every message with, such as
`application/json` or `application/json; charset=utf-8`, so that the
applications that read it know its format. When it is not set, text is sent as
`text/plain`, and bytes as `application/octet-stream`."
+ type: string
+ example: "application/json"
+ pattern: "^[A-Za-z0-9!#$&^_.+-]+/[A-Za-z0-9!#$&^_.+-]+( *;
*[A-Za-z0-9!#$&^_.+-]+=[A-Za-z0-9!#$&^_.+-]+)*$"
dependencies:
- "camel:spring-rabbitmq"
- "camel:kamelet"
@@ -155,6 +165,17 @@ spec:
from:
uri: kamelet:source
steps:
+ - choice:
+ when:
+ - expression:
+ simple:
+ expression: "'{{?contentType}}' != ''"
+ steps:
+ - setHeader:
+ name: CamelSpringRabbitmqContentType
+ expression:
+ constant:
+ expression: "{{?contentType}}"
- to:
- uri:
"spring-rabbitmq://{{exchangeName}}?autoDeclareProducer={{autoDeclareProducer}}&confirm={{confirm}}&confirmTimeout={{confirmTimeout}}&connectionFactory=#bean:{{connectionFactory}}&queues={{?queues}}&routingKey={{?routingKey}}"
+ uri:
"spring-rabbitmq://{{exchangeName}}?autoDeclareProducer={{autoDeclareProducer}}&confirm={{confirm}}&confirmTimeout={{confirmTimeout}}&connectionFactory=#bean:{{connectionFactory}}&queues={{?queues}}&routingKey={{?routingKey}}&allowNullBody={{?allowNullBody}}"
pattern: InOnly
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/spring-rabbitmq-source.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/spring-rabbitmq-source.kamelet.yaml
index b3e84b3e4..85d25b915 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/spring-rabbitmq-source.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/spring-rabbitmq-source.kamelet.yaml
@@ -37,7 +37,7 @@ spec:
Output: the body is text when the content type of the message starts
with `text`, and bytes otherwise. The headers of the RabbitMQ message become
headers, along with `CamelSpringRabbitmqExchangeName`,
`CamelSpringRabbitmqRoutingKey` and `CamelSpringRabbitmqContentType`.
- Good to know: with `autoDeclare` false, the default, the queue must
exist already, bound to the exchange; until it does, the source keeps trying
again. With `autoDeclare` true, it creates the exchange as a `direct` exchange,
the queue in `queues` and the binding with `routingKey`. Without `queues`, it
reads from a new queue with a generated name. A message whose processing fails
is tried 5 times, one second apart, and then dropped, or sent to the dead
letter exchange of the queue w [...]
+ Good to know: with `autoDeclare` false, the default, the queue must
exist already, bound to the exchange; until it does, the source keeps trying
again. With `autoDeclare` true, it creates the exchange, as a `direct` exchange
unless `exchangeType` says otherwise, the queue in `queues` and the binding
with `routingKey`; when the exchange or the queue exists already with other
settings, such as another type or another dead letter exchange, the source
fails to start. Without `queues`, [...]
required:
- host
- port
@@ -110,6 +110,59 @@ spec:
format: password
x-descriptors:
- urn:camel:group:credentials
+ exchangeType:
+ title: "Exchange Type"
+ description: "The type of the exchange that the source creates when
`autoDeclare` is true: `direct`, `fanout`, `headers` or `topic`. When it is not
set, it is `direct`. With `topic`, `routingKey` can be a pattern: `orders.*`
matches `orders.new`, and `orders.#` also matches `orders.eu.new`. Not used
when `autoDeclare` is false."
+ type: string
+ enum: ["direct", "fanout", "headers", "topic"]
+ concurrentConsumers:
+ title: "Concurrent Consumers"
+ description: "How many consumers receive from the queue at the same
time, each on its own channel, so that as many messages are processed in
parallel. When it is not set, there is one consumer, and the messages are
processed one at a time."
+ type: integer
+ example: 4
+ prefetchCount:
+ title: "Prefetch Count"
+ description: "How many messages RabbitMQ sends ahead to each consumer,
before they are acknowledged. When it is not set, it is 250."
+ type: integer
+ example: 10
+ acknowledgeMode:
+ title: "Acknowledge Mode"
+ description: "When RabbitMQ removes a message from the queue: with
`AUTO`, once it has been processed, or has failed after the retries; with
`NONE`, as soon as it is delivered, so a message whose processing fails is lost
and does not go to the dead letter exchange. When it is not set, `AUTO` is
used."
+ type: string
+ enum: ["AUTO", "NONE"]
+ maximumRetryAttempts:
+ title: "Maximum Retry Attempts"
+ description: "How many times a message whose processing fails is tried
again, after the first try. When it is not set, it is tried again 5 times, so 6
times in all. With 0, it is not tried again."
+ type: integer
+ example: 3
+ retryDelay:
+ title: "Retry Delay"
+ description: "How long to wait before a failing message is tried
again, in milliseconds. When it is not set, it waits 1000 milliseconds."
+ type: integer
+ example: 5000
+ deadLetterExchange:
+ title: "Dead Letter Exchange"
+ description: "The exchange that RabbitMQ sends a message to when its
processing still fails after the retries. The source creates this exchange, and
creates the queue in `queues` with it as its dead letter exchange. Needs
`autoDeclare` true; with `autoDeclare` false, it is not used, and the dead
letter exchange must be set on the queue in RabbitMQ, for example with a
policy."
+ type: string
+ example: "orders.dlx"
+ pattern: "^[A-Za-z0-9_.:-]+$"
+ deadLetterRoutingKey:
+ title: "Dead Letter Routing Key"
+ description: "The routing key that a failed message is sent to
`deadLetterExchange` with, and that binds `deadLetterQueue` to it. When it is
not set, a failed message keeps the routing key it was published with. Needs
`deadLetterExchange` and `autoDeclare` true."
+ type: string
+ example: "failed"
+ pattern: "^[A-Za-z0-9_.:-]+$"
+ deadLetterQueue:
+ title: "Dead Letter Queue"
+ description: "A queue that the source creates and binds to
`deadLetterExchange` with `deadLetterRoutingKey`, to keep the failed messages.
Needs `deadLetterExchange`, `deadLetterRoutingKey` and `autoDeclare` true;
without `deadLetterRoutingKey`, the source fails to start."
+ type: string
+ example: "orders.dlq"
+ pattern: "^[A-Za-z0-9_.:-]+$"
+ deadLetterExchangeType:
+ title: "Dead Letter Exchange Type"
+ description: "The type of the exchange that the source creates in
`deadLetterExchange`: `direct`, `fanout`, `headers` or `topic`. When it is not
set, it is `direct`."
+ type: string
+ enum: ["direct", "fanout", "headers", "topic"]
dataTypes:
out:
headers:
@@ -147,7 +200,7 @@ spec:
constructors:
0: "#bean:{{rabbitConnectionFactory}}"
from:
- uri:
"spring-rabbitmq://{{exchangeName}}?autoDeclare={{autoDeclare}}&connectionFactory=#bean:{{connectionFactory}}&queues={{?queues}}&routingKey={{?routingKey}}"
+ uri:
"spring-rabbitmq://{{exchangeName}}?autoDeclare={{autoDeclare}}&connectionFactory=#bean:{{connectionFactory}}&queues={{?queues}}&routingKey={{?routingKey}}&exchangeType={{?exchangeType}}&concurrentConsumers={{?concurrentConsumers}}&prefetchCount={{?prefetchCount}}&acknowledgeMode={{?acknowledgeMode}}&maximumRetryAttempts={{?maximumRetryAttempts}}&retryDelay={{?retryDelay}}&deadLetterExchange={{?deadLetterExchange}}&deadLetterRoutingKey={{?deadLetterRoutingKey}}&deadLetterQueue
[...]
steps:
- to:
uri: kamelet:sink