gnodet-bot commented on code in PR #30065:
URL: https://github.com/apache/camel/pull/30065#discussion_r4579153237
##########
components/camel-spring-parent/camel-spring-rabbitmq/src/main/docs/spring-rabbitmq-component.adoc:
##########
@@ -102,6 +102,52 @@ YAML::
----
====
+=== Noticing a dead or silent broker
+
+How soon a route notices a broker that stopped answering without closing the
connection (the host is gone, or a
+firewall or NAT drops the packets) depends on the connection factory. The
durations below describe how Spring AMQP and
+the RabbitMQ Java client behave by default, approximately; they are not
guarantees of Camel.
+
+*Publisher confirms.* Without publisher confirms, the producer hands the
message to the client and reports success:
+on a silent or reset connection the send succeeds and the message can be lost
without an error. Configure the
+connection factory with simple publisher confirms. With the default
`confirm=auto` the producer then waits up to
+`confirmTimeout` (5 seconds) for RabbitMQ to confirm each message sent InOnly,
and the send fails when it is not
+confirmed, so the error handler can redeliver it. `confirm=enabled` waits the
same way, and needs the connection factory
+to have publisher confirms.
+
+*Heartbeat.* The RabbitMQ Java client notices a silent connection through the
heartbeat, 60 seconds by default (the
+lower of the values that the client and the broker request). It reads with a
timeout of a quarter of the heartbeat and
+closes the connection after more than 8 such timeouts in a row: about 2.25 ×
the heartbeat, so about 135 seconds by
+default. Until then a consumer receives nothing and logs no error. A lower
heartbeat notices it sooner, for example
+about 34 seconds with 15 seconds.
+
+*Channel operations.* An operation that waits for an answer of the broker on a
channel, such as opening a channel or
+cancelling a consumer when the route stops, waits until the connection is
closed or for up to the `channelRpcTimeout`
+of the client, 10 minutes by default.
Review Comment:
💡 **Style (optional):** The channel operations sentence (45 words) chains
three clauses. Consider splitting:
```suggestion
*Channel operations.* An operation that waits for a broker answer on a
channel (such as opening a channel or
cancelling a consumer when the route stops) blocks until the connection
closes or the `channelRpcTimeout`
expires. The default `channelRpcTimeout` is 10 minutes.
```
##########
components/camel-spring-parent/camel-spring-rabbitmq/src/main/docs/spring-rabbitmq-component.adoc:
##########
@@ -102,6 +102,52 @@ YAML::
----
====
+=== Noticing a dead or silent broker
+
+How soon a route notices a broker that stopped answering without closing the
connection (the host is gone, or a
+firewall or NAT drops the packets) depends on the connection factory. The
durations below describe how Spring AMQP and
+the RabbitMQ Java client behave by default, approximately; they are not
guarantees of Camel.
+
+*Publisher confirms.* Without publisher confirms, the producer hands the
message to the client and reports success:
+on a silent or reset connection the send succeeds and the message can be lost
without an error. Configure the
Review Comment:
💡 **Style (optional):** The first sentence (32 words) chains three clauses
and uses passive voice ("the message can be lost"). Consider:
```suggestion
*Publisher confirms.* Without publisher confirms, the producer hands the
message to the client and reports success.
On a silent or reset connection the send still succeeds, and the client can
lose the message without an error. Configure the
```
##########
components/camel-spring-parent/camel-spring-rabbitmq/src/main/docs/spring-rabbitmq-component.adoc:
##########
@@ -102,6 +102,52 @@ YAML::
----
====
+=== Noticing a dead or silent broker
+
+How soon a route notices a broker that stopped answering without closing the
connection (the host is gone, or a
+firewall or NAT drops the packets) depends on the connection factory. The
durations below describe how Spring AMQP and
+the RabbitMQ Java client behave by default, approximately; they are not
guarantees of Camel.
+
+*Publisher confirms.* Without publisher confirms, the producer hands the
message to the client and reports success:
+on a silent or reset connection the send succeeds and the message can be lost
without an error. Configure the
+connection factory with simple publisher confirms. With the default
`confirm=auto` the producer then waits up to
+`confirmTimeout` (5 seconds) for RabbitMQ to confirm each message sent InOnly,
and the send fails when it is not
+confirmed, so the error handler can redeliver it. `confirm=enabled` waits the
same way, and needs the connection factory
+to have publisher confirms.
+
+*Heartbeat.* The RabbitMQ Java client notices a silent connection through the
heartbeat, 60 seconds by default (the
+lower of the values that the client and the broker request). It reads with a
timeout of a quarter of the heartbeat and
+closes the connection after more than 8 such timeouts in a row: about 2.25 ×
the heartbeat, so about 135 seconds by
+default. Until then a consumer receives nothing and logs no error. A lower
heartbeat notices it sooner, for example
+about 34 seconds with 15 seconds.
+
+*Channel operations.* An operation that waits for an answer of the broker on a
channel, such as opening a channel or
+cancelling a consumer when the route stops, waits until the connection is
closed or for up to the `channelRpcTimeout`
+of the client, 10 minutes by default.
+
+[source,xml]
+----
+<bean id="rabbitConnectionFactory"
class="org.springframework.amqp.rabbit.connection.CachingConnectionFactory">
+ <property name="uri" value="amqp://localhost:5672"/>
+ <property name="publisherConfirmType" value="SIMPLE"/>
+ <property name="requestedHeartBeat" value="15"/>
+</bean>
+----
+
+In Java,
`connectionFactory.getRabbitConnectionFactory().setChannelRpcTimeout(30000)`
sets the channel timeout. With
+Spring Boot:
+
+[source,properties]
+----
+spring.rabbitmq.publisher-confirm-type=simple
+spring.rabbitmq.requested-heartbeat=15s
+spring.rabbitmq.channel-rpc-timeout=30s
+----
+
+After the connection breaks, the broker requeues the messages that the
consumer received but did not acknowledge,
+while the consumer may still process the ones it had already received: expect
duplicates after a reconnect, up to
+`prefetchCount` (250 by default) per consumer. Make the processing idempotent,
or lower `prefetchCount`.
Review Comment:
💡 **Style (optional):** This 42-word sentence chains two distinct ideas
(broker requeuing + consumer duplicates). Consider:
```suggestion
After the connection breaks, the broker requeues the messages that the
consumer received but did not acknowledge.
The consumer may still process the ones it had already received: expect
duplicates after a reconnect, up to
`prefetchCount` (250 by default) per consumer. Make the processing
idempotent, or lower `prefetchCount`.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]