You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2023/12/06 22:41:46 UTC

(camel) branch main updated: (chores) camel-kafka: improve pausable EIP documentation

This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new b60825aa5d7 (chores) camel-kafka: improve pausable EIP documentation
b60825aa5d7 is described below

commit b60825aa5d7a6de5da22fcca6a1d1fd481c60662
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Wed Dec 6 17:06:10 2023 -0300

    (chores) camel-kafka: improve pausable EIP documentation
---
 components/camel-kafka/src/main/docs/kafka-component.adoc | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/components/camel-kafka/src/main/docs/kafka-component.adoc b/components/camel-kafka/src/main/docs/kafka-component.adoc
index f3e088f45d3..2f44d00f73a 100644
--- a/components/camel-kafka/src/main/docs/kafka-component.adoc
+++ b/components/camel-kafka/src/main/docs/kafka-component.adoc
@@ -430,14 +430,17 @@ conditions external to the component itself (such as an external system being un
 [source,java]
 ----
 from("kafka:topic")
-    .pausable(new KafkaConsumerListener(), () -> canContinue())
+    .pausable(new KafkaConsumerListener(), () -> canContinue()) // the pausable check gets called if the exchange fails to be processed ...
     .routeId("pausable-route")
-    .process(exchange -> LOG.info("Got record from Kafka: {}", exchange.getMessage().getBody()))
-    .to("some:destination");
+    .process(this::process) // Kafka consumer will be paused if this one throws an exception ...
+    .to("some:destination"); // or this one
 ----
 
 In this example, consuming messages can pause (by calling the Kafka's Consumer pause method) if the result from `canContinue` is false.
 
+The pausable EIP is meant to be used as a support mechanism when there is an exception somewhere in the route that prevents the exchange from being processed. More specifically,
+the check called by the `pausable` EIP should be used to test for transient conditions preventing the exchange from being processed.
+
 == Kafka Headers propagation
 
 When consuming messages from Kafka, headers will be propagated to camel exchange headers automatically.