This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch feature/CAMEL-24237-catalog-docs in repository https://gitbox.apache.org/repos/asf/camel.git
commit fe7b24833697cec638c8c3b66e97ed267138d8e2 Author: Claus Ibsen <[email protected]> AuthorDate: Wed Jul 22 13:16:04 2026 +0200 CAMEL-24237: Add pausable and resumable EIP documentation Co-Authored-By: Claude Opus 4.6 <[email protected]> Signed-off-by: Claus Ibsen <[email protected]> --- .../org/apache/camel/catalog/docs.properties | 2 + .../apache/camel/catalog/docs/pausable-eip.adoc | 54 +++++++++++++++++++++ .../apache/camel/catalog/docs/resumable-eip.adoc | 56 ++++++++++++++++++++++ .../main/docs/modules/eips/pages/pausable-eip.adoc | 54 +++++++++++++++++++++ .../docs/modules/eips/pages/resumable-eip.adoc | 56 ++++++++++++++++++++++ 5 files changed, 222 insertions(+) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs.properties b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs.properties index 766005ff6e6d..86aa824fbf01 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs.properties +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs.properties @@ -464,6 +464,7 @@ optaplanner-component paho-component paho-mqtt5-component parquetAvro-dataformat +pausable-eip pdf-component pg-replication-slot-component pgevent-component @@ -521,6 +522,7 @@ resourceresolver-github rest-api-component rest-component rest-openapi-component +resumable-eip resume-strategies return-address robotframework-component diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/pausable-eip.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/pausable-eip.adoc new file mode 100644 index 000000000000..e83f28bb77d5 --- /dev/null +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/pausable-eip.adoc @@ -0,0 +1,54 @@ += Pausable EIP +:doctitle: Pausable +:shortname: pausable +:description: Pauses a consumer based on a condition, allowing it to be resumed later from the last known offset. Useful for controlling ingestion rate on polling consumers. +:since: 3.16 +:supportlevel: Experimental +:tabs-sync-option: + +The Pausable EIP provides pause and resume features for supported consumers. +With this EIP, it is possible to implement logic that controls the behavior of the consumer +based on conditions that are external to the component. For instance, it makes it possible +to pause the consumer if an external system becomes unavailable. + +== EIP options + +// eip options: START +include::partial$eip-options.adoc[] +// eip options: END + +== Example + +To use the Pausable EIP, you need an instance of a consumer listener along with a predicate +that tests whether consumption should continue. + +[tabs] +==== +Java:: ++ +[source,java] +---- +from("kafka:topic") + .pausable(new KafkaConsumerListener(), o -> canContinue()) + .process(exchange -> LOG.info("Received: {}", exchange.getMessage().getBody())) + .to("direct:destination"); +---- +==== + +You can also integrate the Pausable EIP with the xref:circuitBreaker-eip.adoc[Circuit Breaker EIP] +to pause consumption based on downstream system availability: + +[source,java] +---- +from("kafka:topic") + .pausable(new KafkaConsumerListener(), o -> canContinue()) + .circuitBreaker() + .resilience4jConfiguration().circuitBreaker("pausableCircuit").end() + .to("direct:downstream") + .end(); +---- + +== See Also + +* xref:resume-strategies.adoc[Resume Strategies] +* xref:resumable-eip.adoc[Resumable EIP] diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/resumable-eip.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/resumable-eip.adoc new file mode 100644 index 000000000000..5269c53979fd --- /dev/null +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/resumable-eip.adoc @@ -0,0 +1,56 @@ += Resumable EIP +:doctitle: Resumable +:shortname: resumable +:description: Enables resuming processing from the last known offset after a restart, using a resume strategy to track and restore position +:since: 3.16 +:supportlevel: Experimental +:tabs-sync-option: + +The Resumable EIP allows consuming data from the last known offset after a restart, +using a resume strategy to track and restore the position. + +This is useful when consuming large data sources where you want to avoid reprocessing +data that has already been consumed. The resume strategy points the consumer to the exact +offset to resume operations. + +== EIP options + +// eip options: START +include::partial$eip-options.adoc[] +// eip options: END + +== Example + +[tabs] +==== +Java:: ++ +[source,java] +---- +KafkaResumeStrategyConfigurationBuilder kafkaConfigurationBuilder = + KafkaResumeStrategyConfigurationBuilder.newBuilder() + .withBootstrapServers("kafka-address:9092") + .withTopic("offset") + .withResumeCache(new MyChoiceOfResumeCache<>(100)); + +from("some:component") + .resumable().configuration(kafkaConfigurationBuilder) + .process(this::process); +---- +==== + +=== Intermittent Mode + +Enable intermittent mode to avoid updating the offset for every exchange: + +[source,java] +---- +from("some:component") + .resumable(new MyTestResumeStrategy()).intermittent(true) + .process(this::process); +---- + +== See Also + +* xref:resume-strategies.adoc[Resume Strategies] +* xref:pausable-eip.adoc[Pausable EIP] diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/pausable-eip.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/pausable-eip.adoc new file mode 100644 index 000000000000..e83f28bb77d5 --- /dev/null +++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/pausable-eip.adoc @@ -0,0 +1,54 @@ += Pausable EIP +:doctitle: Pausable +:shortname: pausable +:description: Pauses a consumer based on a condition, allowing it to be resumed later from the last known offset. Useful for controlling ingestion rate on polling consumers. +:since: 3.16 +:supportlevel: Experimental +:tabs-sync-option: + +The Pausable EIP provides pause and resume features for supported consumers. +With this EIP, it is possible to implement logic that controls the behavior of the consumer +based on conditions that are external to the component. For instance, it makes it possible +to pause the consumer if an external system becomes unavailable. + +== EIP options + +// eip options: START +include::partial$eip-options.adoc[] +// eip options: END + +== Example + +To use the Pausable EIP, you need an instance of a consumer listener along with a predicate +that tests whether consumption should continue. + +[tabs] +==== +Java:: ++ +[source,java] +---- +from("kafka:topic") + .pausable(new KafkaConsumerListener(), o -> canContinue()) + .process(exchange -> LOG.info("Received: {}", exchange.getMessage().getBody())) + .to("direct:destination"); +---- +==== + +You can also integrate the Pausable EIP with the xref:circuitBreaker-eip.adoc[Circuit Breaker EIP] +to pause consumption based on downstream system availability: + +[source,java] +---- +from("kafka:topic") + .pausable(new KafkaConsumerListener(), o -> canContinue()) + .circuitBreaker() + .resilience4jConfiguration().circuitBreaker("pausableCircuit").end() + .to("direct:downstream") + .end(); +---- + +== See Also + +* xref:resume-strategies.adoc[Resume Strategies] +* xref:resumable-eip.adoc[Resumable EIP] diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/resumable-eip.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/resumable-eip.adoc new file mode 100644 index 000000000000..5269c53979fd --- /dev/null +++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/resumable-eip.adoc @@ -0,0 +1,56 @@ += Resumable EIP +:doctitle: Resumable +:shortname: resumable +:description: Enables resuming processing from the last known offset after a restart, using a resume strategy to track and restore position +:since: 3.16 +:supportlevel: Experimental +:tabs-sync-option: + +The Resumable EIP allows consuming data from the last known offset after a restart, +using a resume strategy to track and restore the position. + +This is useful when consuming large data sources where you want to avoid reprocessing +data that has already been consumed. The resume strategy points the consumer to the exact +offset to resume operations. + +== EIP options + +// eip options: START +include::partial$eip-options.adoc[] +// eip options: END + +== Example + +[tabs] +==== +Java:: ++ +[source,java] +---- +KafkaResumeStrategyConfigurationBuilder kafkaConfigurationBuilder = + KafkaResumeStrategyConfigurationBuilder.newBuilder() + .withBootstrapServers("kafka-address:9092") + .withTopic("offset") + .withResumeCache(new MyChoiceOfResumeCache<>(100)); + +from("some:component") + .resumable().configuration(kafkaConfigurationBuilder) + .process(this::process); +---- +==== + +=== Intermittent Mode + +Enable intermittent mode to avoid updating the offset for every exchange: + +[source,java] +---- +from("some:component") + .resumable(new MyTestResumeStrategy()).intermittent(true) + .process(this::process); +---- + +== See Also + +* xref:resume-strategies.adoc[Resume Strategies] +* xref:pausable-eip.adoc[Pausable EIP]
