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 c055e98fa10 CAMEL-21040: ensure more consistency in the document sections c055e98fa10 is described below commit c055e98fa104f87ad5fbe6102c8acbd50572025a Author: Otavio Rodolfo Piske <angusyo...@gmail.com> AuthorDate: Wed Aug 7 08:57:33 2024 +0200 CAMEL-21040: ensure more consistency in the document sections - Also fix typos - Minor issues with examples --- .../camel-djl/src/main/docs/djl-component.adoc | 41 ++++---- .../src/main/docs/langchain4j-chat-component.adoc | 52 +++++++---- .../docs/langchain4j-web-search-component.adoc | 53 ++++++----- .../src/main/docs/pinecone-component.adoc | 2 +- .../src/main/docs/debezium-postgres-component.adoc | 5 +- .../main/docs/debezium-sqlserver-component.adoc | 4 +- .../src/main/docs/digitalocean-component.adoc | 41 ++++---- .../src/main/docs/disruptor-component.adoc | 28 +++--- .../camel-dns/src/main/docs/dns-component.adoc | 2 +- .../src/main/docs/docker-component.adoc | 4 +- .../camel-drill/src/main/docs/drill-component.adoc | 4 +- .../src/main/docs/dropbox-component.adoc | 37 ++++---- .../src/main/docs/dynamic-router-component.adoc | 4 +- .../src/main/docs/ehcache-component.adoc | 6 +- .../docs/elasticsearch-rest-client-component.adoc | 14 +-- .../src/main/docs/elasticsearch-component.adoc | 104 +++++++++++---------- .../camel-etcd3/src/main/docs/etcd3-component.adoc | 10 +- .../camel-exec/src/main/docs/exec-component.adoc | 6 +- .../src/main/docs/file-watch-component.adoc | 2 +- .../camel-file/src/main/docs/file-component.adoc | 66 ++++++------- .../src/main/docs/flatpack-component.adoc | 31 +++--- .../src/main/docs/flatpack-dataformat.adoc | 15 ++- .../camel-flink/src/main/docs/flink-component.adoc | 8 +- .../camel-fop/src/main/docs/fop-component.adoc | 40 ++++---- .../src/main/docs/freemarker-component.adoc | 17 ++-- 25 files changed, 318 insertions(+), 278 deletions(-) diff --git a/components/camel-ai/camel-djl/src/main/docs/djl-component.adoc b/components/camel-ai/camel-djl/src/main/docs/djl-component.adoc index 2f8979d07ec..24b9fe54d15 100644 --- a/components/camel-ai/camel-djl/src/main/docs/djl-component.adoc +++ b/components/camel-ai/camel-djl/src/main/docs/djl-component.adoc @@ -173,7 +173,9 @@ include::partial$component-endpoint-options.adoc[] include::partial$component-endpoint-headers.adoc[] // component headers: END -== Model Zoo +== Usage + +=== Model Zoo The following tables contain supported models in the model zoos per application. @@ -182,7 +184,7 @@ models found for them from the basic, PyTorch, TensorFlow or MXNet DJL model zoos. You may still find more models for an application from other model zoos such as Hugging Face, ONNX, etc. -=== CV - Image Classification +==== CV - Image Classification Application: `cv/image_classification` @@ -265,7 +267,7 @@ Application: `cv/image_classification` |=== -=== CV - Object Detection +==== CV - Object Detection Application: `cv/object_detection` @@ -298,7 +300,7 @@ Application: `cv/object_detection` |=== -=== CV - Semantic Segmentation +==== CV - Semantic Segmentation Application: `cv/semantic_segmentation` @@ -310,7 +312,7 @@ Application: `cv/semantic_segmentation` |=== -=== CV - Instance Segmentation +==== CV - Instance Segmentation Application: `cv/instance_segmentation` @@ -324,7 +326,7 @@ Application: `cv/instance_segmentation` |=== -=== CV - Pose Estimation +==== CV - Pose Estimation Application: `cv/pose_estimation` @@ -341,7 +343,7 @@ Application: `cv/pose_estimation` |=== -=== CV - Action Recognition +==== CV - Action Recognition Application: `cv/action_recognition` @@ -355,7 +357,7 @@ Application: `cv/action_recognition` |=== -=== CV - Image Generation +==== CV - Image Generation Application: `cv/image_generation` @@ -375,7 +377,7 @@ Application: `cv/image_generation` |=== -=== NLP - Question Answer +==== NLP - Question Answer Application: `nlp/question_answer` @@ -393,7 +395,7 @@ Application: `nlp/question_answer` |=== -=== NLP - Sentiment Analysis +==== NLP - Sentiment Analysis Application: `nlp/sentiment_analysis` @@ -405,7 +407,7 @@ Application: `nlp/sentiment_analysis` |=== -=== NLP - Word Embedding +==== NLP - Word Embedding Application: `nlp/word_embedding` @@ -417,7 +419,7 @@ Application: `nlp/word_embedding` |=== -=== Time Series - Forecasting +==== Time Series - Forecasting Application: `timeseries/forecasting` @@ -433,13 +435,13 @@ Application: `timeseries/forecasting` |=== -== DJL Engine implementation +=== DJL Engine implementation Because DJL is deep learning framework-agnostic, you don't have to make a choice between frameworks when creating your projects. You can switch frameworks at any point. To ensure the best performance, DJL also provides automatic CPU/GPU choice based on hardware configuration. -=== PyTorch engine +==== PyTorch engine You can pull the PyTorch engine from the central Maven repository by including the following dependency: @@ -458,7 +460,7 @@ It will automatically determine the appropriate jars for your system based on th More information about https://docs.djl.ai/engines/pytorch/index.html[PyTorch engine installation] -=== TensorFlow engine +==== TensorFlow engine You can pull the TensorFlow engine from the central Maven repository by including the following dependency: @@ -477,7 +479,7 @@ It will automatically determine the appropriate jars for your system based on th More information about https://docs.djl.ai/engines/tensorflow/index.html[TensorFlow engine installation] -=== MXNet engine +==== MXNet engine You can pull the MXNet engine from the central Maven repository by including the following dependency: @@ -500,22 +502,21 @@ More information about https://docs.djl.ai/engines/mxnet/index.html[MXNet engine == Examples -=== MNIST image classification from file - +.MNIST image classification from file [source,java] ---- from("file:/data/mnist/0/10.png") .to("djl:cv/image_classification?artifactId=ai.djl.mxnet:mlp:0.0.1"); ---- -=== Object detection +.Object detection [source,java] ---- from("file:/data/mnist/0/10.png") .to("djl:cv/image_classification?artifactId=ai.djl.mxnet:mlp:0.0.1"); ---- -=== Custom deep learning model +.Custom deep learning model [source,java] ---- // create a deep learning model diff --git a/components/camel-ai/camel-langchain4j-chat/src/main/docs/langchain4j-chat-component.adoc b/components/camel-ai/camel-langchain4j-chat/src/main/docs/langchain4j-chat-component.adoc index e791fae0389..32a3f771154 100644 --- a/components/camel-ai/camel-langchain4j-chat/src/main/docs/langchain4j-chat-component.adoc +++ b/components/camel-ai/camel-langchain4j-chat/src/main/docs/langchain4j-chat-component.adoc @@ -15,7 +15,7 @@ *{component-header}* -The LangChain4j Chat Component allows you to integrate with any LLM supported by https://github.com/langchain4j/langchain4j[LangChain4j]. +The LangChain4j Chat Component allows you to integrate with any Large Language Model (LLM) supported by https://github.com/langchain4j/langchain4j[LangChain4j]. Maven users will need to add the following dependency to their `pom.xml` for this component: @@ -58,14 +58,20 @@ include::partial$component-endpoint-headers.adoc[] include::spring-boot:partial$starter.adoc[] -== Using a specific Chat Model +== Usage + +=== Using a specific Chat Model + The Camel LangChain4j chat component provides an abstraction for interacting with various types of Large Language Models (LLMs) supported by https://github.com/langchain4j/langchain4j[LangChain4j]. -To integrate with a specific Large Language Model, users should follow these steps: +==== Integrating with specific LLM + +To integrate with a specific LLM, users should follow the steps described below, which explain +how to integrate with OpenAI. -=== Example of Integrating with OpenAI Add the dependency for LangChain4j OpenAI support: +.Example [source,xml] ---- <dependency> @@ -75,7 +81,8 @@ Add the dependency for LangChain4j OpenAI support: </dependency> ---- -Init the OpenAI Chat Language Model, and add it to the Camel Registry: +Initialize the OpenAI Chat Language Model, and add it to the Camel Registry: + [source, java] ---- ChatLanguageModel model = OpenAiChatModel.builder() @@ -88,6 +95,7 @@ context.getRegistry().bind("chatModel", model); ---- Use the model in the Camel LangChain4j Chat Producer + [source, java] ---- from("direct:chat") @@ -100,11 +108,12 @@ Use the model in the Camel LangChain4j Chat Producer To switch to another Large Language Model and its corresponding dependency, replace the `langchain4j-open-ai` dependency with the appropriate dependency for the desired model. Update the initialization parameters accordingly in the code snippet provided above. ==== -== Send a prompt with variables +=== Send a prompt with variables + To send a prompt with variables, use the Operation type `LangChain4jChatOperations.CHAT_SINGLE_MESSAGE_WITH_PROMPT`. This operation allows you to send a single prompt message with dynamic variables, which will be replaced with values provided in the request. -Example of route : +.Route example: [source, java] ---- from("direct:chat") @@ -112,7 +121,7 @@ Example of route : ---- -Example of usage: +.Usage example: [source, java] ---- var promptTemplate = "Create a recipe for a {{dishType}} with the following ingredients: {{ingredients}}"; @@ -125,12 +134,13 @@ String response = template.requestBodyAndHeader("direct:chat", variables, LangChain4jChat.Headers.PROMPT_TEMPLATE, promptTemplate, String.class); ---- -== Chat with history +=== Chat with history + You can send a new prompt along with the chat message history by passing all messages in a list of type `dev.langchain4j.data.message.ChatMessage`. Use the Operation type `LangChain4jChatOperations.CHAT_MULTIPLE_MESSAGES`. This operation allows you to continue the conversation with the context of previous messages. -Example of route : +.Route example: [source, java] ---- from("direct:chat") @@ -138,7 +148,7 @@ Example of route : ---- -Example of usage: +.Usage example: [source, java] ---- List<ChatMessage> messages = new ArrayList<>(); @@ -148,7 +158,7 @@ messages.add(new SystemMessage("You are asked to provide recommendations for a r String response = template.requestBody("direct:send-multiple", messages, String.class); ---- -== Chat with Tool +=== Chat with Tool Camel langchain4j-chat component as a consumer can be used to implement a LangChain tool. Right now tools are supported only via the OpenAiChatModel backed by OpenAI APIs. @@ -157,7 +167,7 @@ or via the endpoint option camelToolParameter for a programmatic approach. The parameters can be found as headers in the consumer route, in particular, if you define `parameter.userId=5`, in the consumer route `${header.userId}` can be used. -Example of a producer and a consumer: +.Producer and consumer example: [source, java] ---- from("direct:test") @@ -167,7 +177,7 @@ from("langchain4j-chat:test1?description=Query user database by number¶meter .to("sql:SELECT name FROM users WHERE id = :#number"); ---- -Example of usage: +.Usage example: [source, java] ---- List<ChatMessage> messages = new ArrayList<>(); @@ -181,15 +191,16 @@ List<ChatMessage> messages = new ArrayList<>(); Exchange message = fluentTemplate.to("direct:test").withBody(messages).request(Exchange.class); ---- -== RAG (Retrieval Augmented Generation) +=== Retrieval Augmented Generation (RAG) + Use the RAG feature to enrich exchanges with data retrieved from any type of Camel endpoint. The feature is compatible with all LangChain4 Chat operations and is ideal for orchestrating the RAG workflow, utilizing the extensive library of components and Enterprise Integration Patterns (EIPs) available in Apache Camel. There are two ways for utilizing the RAG feature: -=== Using RAG with Content Enricher and LangChain4jRagAggregatorStrategy +==== Using RAG with Content Enricher and LangChain4jRagAggregatorStrategy Enrich the exchange by retrieving a list of strings using any Camel producer. The `LangChain4jRagAggregatorStrategy` is specifically designed to augment data within LangChain4j chat producers. -Example of usage: +.Usage example: [source, java] ---- // Create an instance of the RAG aggregator strategy @@ -213,7 +224,7 @@ This method leverages a separate Camel route to fetch and process the augmented It is possible to enrich the message from multiple sources within the same exchange. -Example of usage: +.Usage example: [source, java] ---- // Create an instance of the RAG aggregator strategy @@ -225,11 +236,12 @@ from("direct:test") .to("langchain4j-chat:test1?chatOperation=CHAT_SIMPLE_MESSAGE"); ---- -=== Using RAG with Header +==== Using RAG with headers + Directly add augmented data into the header. This method is particularly efficient for straightforward use cases where the augmented data is predefined or static. You must add augmented data as a List of `dev.langchain4j.rag.content.Content` directly inside the header `CamelLangChain4jChatAugmentedData`. -Example of usage: +.Usage example: [source, java] ---- import dev.langchain4j.rag.content.Content; diff --git a/components/camel-ai/camel-langchain4j-web-search/src/main/docs/langchain4j-web-search-component.adoc b/components/camel-ai/camel-langchain4j-web-search/src/main/docs/langchain4j-web-search-component.adoc index 0dcf5b54a5d..643822e9a20 100644 --- a/components/camel-ai/camel-langchain4j-web-search/src/main/docs/langchain4j-web-search-component.adoc +++ b/components/camel-ai/camel-langchain4j-web-search/src/main/docs/langchain4j-web-search-component.adoc @@ -58,13 +58,15 @@ include::partial$component-endpoint-headers.adoc[] include::spring-boot:partial$starter.adoc[] +== Usage + +=== Using a specific Web Search Engine -== Using a specific Web Search Engine The Camel LangChain4j web search component provides an abstraction for interacting with various types of Web Search Engines supported by https://github.com/langchain4j/langchain4j[LangChain4j]. -To integrate with a specific Web Search Engine, users should follow these steps: +To integrate with a specific Web Search Engine, users should follow the steps described below, which explain +how to integrate with https://tavily.com/[Tavily]. -=== Example of integrating with Tavily Add the dependency for LangChain4j Tavily Web Search Engine support : [source,xml] @@ -76,10 +78,10 @@ Add the dependency for LangChain4j Tavily Web Search Engine support : </dependency> ---- -Init the Tavily Web Search Engine, and add it to the Camel Registry: -Initialize the Tavily Web Search Engine, and bind it to the Camel Registry: +Initialize the Web Search Engine instance, and bind it to the Camel Registry: -[source, java] +.Example: +[source,java] ---- @BindToRegistry("web-search-engine") WebSearchEngine tavilyWebSearchEngine = TavilyWebSearchEngine.builder() @@ -90,9 +92,8 @@ WebSearchEngine tavilyWebSearchEngine = TavilyWebSearchEngine.builder() The web search engine will be autowired automatically if its bound name is `web-search-engine`. Otherwise, it should be added as a configured parameter to the Camel route. -Example of route: - -[source, java] +.Example: +[source,java] ---- from("direct:web-search") .to("langchain4j-web-search:test?webSearchEngine=#web-search-engine-test") @@ -105,34 +106,37 @@ replace the `langchain4j-web-search-engine-tavily` dependency with the appropria Update the initialization parameters accordingly in the code snippet provided above. ==== -== Customizing Web Search Results +=== Customizing Web Search Results + By default, the `maxResults` property is set to 1. You can adjust this value to retrieve a list of results. -=== Retrieving single result or list of strings +==== Retrieving a single result or a list of strings + When `maxResults` is set to 1, you can by default retrieve by default the content as a single string. -Example: -[source, java] +.Example: +[source,java] ---- String response = template.requestBody("langchain4j-web-search:test", "Who won the European Cup in 2024?", String.class); ---- When `maxResults` is greater than 1, you can retrieve a list of strings. -Example: -[source, java] +.Example: +[source,java] ---- List<String> responses = template.requestBody("langchain4j-web-search:test?maxResults=3", "Who won the European Cup in 2024?", List.class); ---- -=== Retrieve different types of Results -You can get different type of Results. +=== Retrieving different types of Results + +You can get different types of Results. -When `resultType` = SNIPPET, you will get a single or list (depending of `maxResults` value) of Strings containing the snippets. +When `resultType` = SNIPPET, you will get a single or list (depending on `maxResults` value) of Strings containing the snippets. -When `resultType` = LANGCHAIN4J_WEB_SEARCH_ORGANIC_RESULT, you will get a single or list (depending of `maxResults` value) of Objects of type `WebSearchOrganicResult` containing all the response created under the hood by Langchain4j Web Search. +When `resultType` = LANGCHAIN4J_WEB_SEARCH_ORGANIC_RESULT, you will get a single or list (depending on `maxResults` value) of Objects of type `WebSearchOrganicResult` containing all the response created under the hood by Langchain4j Web Search. -== Advanced usage of WebSearchRequest +=== Advanced usage of WebSearchRequest When defining a WebSearchRequest, the Camel LangChain4j web search component will default to this request, instead of creating one from the body and config parameters. @@ -143,9 +147,8 @@ When using a WebSearchRequest, the body and the parameters of the search will be A WebSearchRequest should be bound to the registry. -Example of binding the request to the registry. - -[source, java] +.Example of binding the request to the registry. +[source,java] ---- @BindToRegistry("web-search-request") WebSearchRequest request = WebSearchRequest.builder() @@ -156,8 +159,8 @@ WebSearchRequest request = WebSearchRequest.builder() The request will be autowired automatically if its bound name is `web-search-request`. Otherwise, it should be added as a configured parameter to the Camel route. -Example of route: -[source, java] +.Example of route: +[source,java] ---- from("direct:web-search") .to("langchain4j-web-search:test?webSearchRequest=#searchRequestTest"); diff --git a/components/camel-ai/camel-pinecone/src/main/docs/pinecone-component.adoc b/components/camel-ai/camel-pinecone/src/main/docs/pinecone-component.adoc index f59d7ee6eb9..1b876f44b13 100644 --- a/components/camel-ai/camel-pinecone/src/main/docs/pinecone-component.adoc +++ b/components/camel-ai/camel-pinecone/src/main/docs/pinecone-component.adoc @@ -15,7 +15,7 @@ *{component-header}* -The Pionecone Component provides support for interacting with the https://pinecone.io/[Milvus Vector Database]. +The Pinecone Component provides support for interacting with the https://pinecone.io/[Pinecone Vector Database]. == URI format diff --git a/components/camel-debezium/camel-debezium-postgres/src/main/docs/debezium-postgres-component.adoc b/components/camel-debezium/camel-debezium-postgres/src/main/docs/debezium-postgres-component.adoc index 89e976cfad9..b745639ab0a 100644 --- a/components/camel-debezium/camel-debezium-postgres/src/main/docs/debezium-postgres-component.adoc +++ b/components/camel-debezium/camel-debezium-postgres/src/main/docs/debezium-postgres-component.adoc @@ -71,7 +71,10 @@ https://debezium.io/documentation/reference/0.10/connectors/postgresql.html#conn include::partial$component-endpoint-headers.adoc[] // component headers: END -== Message body +== Usage + +=== Message body + The message body if is not `null` (in case of tombstones), it contains the state of the row after the event occurred as `Struct` format or `Map` format if you use the included Type Converter from `Struct` to `Map`. [NOTE] diff --git a/components/camel-debezium/camel-debezium-sqlserver/src/main/docs/debezium-sqlserver-component.adoc b/components/camel-debezium/camel-debezium-sqlserver/src/main/docs/debezium-sqlserver-component.adoc index b90695b1720..650504c34ac 100644 --- a/components/camel-debezium/camel-debezium-sqlserver/src/main/docs/debezium-sqlserver-component.adoc +++ b/components/camel-debezium/camel-debezium-sqlserver/src/main/docs/debezium-sqlserver-component.adoc @@ -70,7 +70,9 @@ https://debezium.io/documentation/reference/0.10/connectors/sqlserver.html#conne include::partial$component-endpoint-headers.adoc[] // component headers: END -== Message body +== Usage + +=== Message body The message body if is not `null` (in case of tombstones), it contains the state of the row after the event occurred as `Struct` format or `Map` format if you use the included Type Converter from `Struct` to `Map`. [NOTE] diff --git a/components/camel-digitalocean/src/main/docs/digitalocean-component.adoc b/components/camel-digitalocean/src/main/docs/digitalocean-component.adoc index ad23fb431ce..404aff55188 100644 --- a/components/camel-digitalocean/src/main/docs/digitalocean-component.adoc +++ b/components/camel-digitalocean/src/main/docs/digitalocean-component.adoc @@ -55,18 +55,20 @@ All **operation** values are defined in `DigitalOceanOperations` enumeration. All **header** names used by the component are defined in `DigitalOceanHeaders` enumeration. -== Message body result +== Usage + +=== Message body result All message bodies returned are using objects provided by the **digitalocean-api-java** library. -== API Rate Limits +=== API Rate Limits DigitalOcean REST API encapsulated by camel-digitalocean component is subjected to API Rate Limiting. ou can find the per-method limits in the https://developers.digitalocean.com/documentation/v2/#rate-limit[API Rate Limits documentation]. -== Account endpoint +=== Account endpoint [width="100%",cols="2,5,^1,2",options="header"] |=== @@ -74,7 +76,7 @@ ou can find the per-method limits in the https://developers.digitalocean.com/doc | `get` | get account info | | `com.myjeeva.digitalocean.pojo.Account` |=== -== BlockStorages endpoint +=== BlockStorages endpoint [width="100%",cols="2,5,^5a,1",options="header"] |=== @@ -159,7 +161,7 @@ ou can find the per-method limits in the https://developers.digitalocean.com/doc | `List<com.myjeeva.digitalocean.pojo.Action>` |=== -== Droplets endpoint +=== Droplets endpoint [width="100%",cols="2,5,^1,2",options="header"] |=== @@ -266,7 +268,7 @@ ou can find the per-method limits in the https://developers.digitalocean.com/doc | `listAllNeighbors` | retrieve a list of any droplets that are running on the same physical hardware | | `List<com.myjeeva.digitalocean.pojo.Droplet>` |=== -== Images endpoint +=== Images endpoint [width="100%",cols="2,5,^1,2",options="header"] |=== @@ -294,7 +296,7 @@ ou can find the per-method limits in the https://developers.digitalocean.com/doc | `convert` | convert an image, for example, a backup to a snapshot| `CamelDigitalOceanId` _Integer_ | `com.myjeeva.digitalocean.pojo.Action` |=== -== Snapshots endpoint +=== Snapshots endpoint [width="100%",cols="2,5,^1,2",options="header"] |=== @@ -304,7 +306,7 @@ ou can find the per-method limits in the https://developers.digitalocean.com/doc | `delete` | delete an snapshot| `CamelDigitalOceanId` _Integer_ | `com.myjeeva.digitalocean.pojo.Delete` |=== -== Keys endpoint +=== Keys endpoint [width="100%",cols="2,5,^1,2",options="header"] |=== @@ -329,7 +331,7 @@ ou can find the per-method limits in the https://developers.digitalocean.com/doc | `delete` | delete a key by fingerprint| `CamelDigitalOceanKeyFingerprint` _String_ | `com.myjeeva.digitalocean.pojo.Delete` |=== -== Regions endpoint +=== Regions endpoint [width="100%",cols="2,5,^1,2",options="header"] |=== @@ -337,7 +339,7 @@ ou can find the per-method limits in the https://developers.digitalocean.com/doc | `list` | list all the regions that are available | | `List<com.myjeeva.digitalocean.pojo.Region>` |=== -== Sizes endpoint +=== Sizes endpoint [width="100%",cols="2,5,^1,2",options="header"] |=== @@ -345,7 +347,7 @@ ou can find the per-method limits in the https://developers.digitalocean.com/doc | `list` | list all the sizes that are available | | `List<com.myjeeva.digitalocean.pojo.Size>` |=== -== Floating IPs endpoint +=== Floating IPs endpoint [width="100%",cols="2,5,^1,2",options="header"] |=== @@ -366,7 +368,7 @@ ou can find the per-method limits in the https://developers.digitalocean.com/doc | `listActions` | retrieve all actions that have been executed on a Floating IP | `CamelDigitalOceanFloatingIPAddress` _String_ | `List<com.myjeeva.digitalocean.pojo.Action>` |=== -== Tags endpoint +=== Tags endpoint [width="100%",cols="2,5,^4,2",options="header"] |=== @@ -385,8 +387,7 @@ ou can find the per-method limits in the https://developers.digitalocean.com/doc == Examples -Get your account info - +.Get your account info [source,java] ---- from("direct:getAccountInfo") @@ -394,8 +395,7 @@ from("direct:getAccountInfo") .to("digitalocean:account?oAuthToken=XXXXXX") ---- -Create a droplet - +.Create a droplet [source,java] ---- from("direct:createDroplet") @@ -407,8 +407,7 @@ from("direct:createDroplet") .to("digitalocean:droplet?oAuthToken=XXXXXX") ---- -List all your droplets - +.List all your droplets [source,java] ---- from("direct:getDroplets") @@ -416,8 +415,7 @@ from("direct:getDroplets") .to("digitalocean:droplets?oAuthToken=XXXXXX") ---- -Retrieve information for the Droplet (dropletId = 34772987) - +.Retrieve information for the Droplet (dropletId = 34772987) [source,java] ---- from("direct:getDroplet") @@ -426,8 +424,7 @@ from("direct:getDroplet") .to("digitalocean:droplet?oAuthToken=XXXXXX") ---- -Shutdown information for the Droplet (dropletId = 34772987) - +.Shutdown information for the Droplet (dropletId = 34772987) [source,java] ---- from("direct:shutdown") diff --git a/components/camel-disruptor/src/main/docs/disruptor-component.adoc b/components/camel-disruptor/src/main/docs/disruptor-component.adoc index c039ade687d..6c72e10b380 100644 --- a/components/camel-disruptor/src/main/docs/disruptor-component.adoc +++ b/components/camel-disruptor/src/main/docs/disruptor-component.adoc @@ -88,9 +88,9 @@ include::partial$component-endpoint-options.adoc[] // endpoint options: END +== Usage - -== Wait strategies +=== Wait strategies The wait strategy effects the type of waiting performed by the consumer threads that are currently waiting for the next exchange to be @@ -119,12 +119,13 @@ barrier after an initially spinning. |This strategy is a good compromise between without incurring significant latency spikes. |======================================================================= -== Use of Request Reply +=== Using Request/Reply -The Disruptor component supports using xref:eips:requestReply-eip.adoc[Request -Reply], where the caller will wait for the Async route to complete. For -instance: +The Disruptor component supports using xref:eips:requestReply-eip.adoc[Request/Reply], +where the caller will wait for the Async route to complete. +For instance: +.Request/Reply example with disruptor [source,java] ------------------------------------------------------------------------------ from("mina:tcp://0.0.0.0:9876?textline=true&sync=true").to("disruptor:input"); @@ -137,12 +138,13 @@ buffer. As it is a Request Reply message, we wait for the response. When the consumer on the _disruptor:input_ buffer is complete, it copies the response to the original message response. -== Concurrent consumers +=== Concurrent consumers By default, the Disruptor endpoint uses a single consumer thread, but you can configure it to use concurrent consumer threads. So instead of -thread pools you can use: +thread pools, you can use: +.Concurrent consumers example [source,java] -------------------------------------------------------------- from("disruptor:stageName?concurrentConsumers=5").process(...) @@ -153,7 +155,7 @@ increase/shrink dynamically at runtime depending on load. Whereas the number of concurrent consumers is always fixed and supported by the Disruptor internally, so performance will be higher. -== Thread pools +=== Thread pools Be aware that adding a thread pool to a Disruptor endpoint by doing something like: @@ -170,7 +172,9 @@ of the performance gains achieved by using the Disruptor. Instead, it is advices to directly configure the number of threads that process messages on a Disruptor endpoint using the concurrentConsumers option. -== Example +== Examples + +=== Requests to async queue In the route below, we use the Disruptor to send the request to this async queue. @@ -204,7 +208,7 @@ another thread for further processing. Since this is from a unit test, it will be sent to a mock endpoint where we can do assertions in the unit test. -== Using multipleConsumers +=== Using multipleConsumers In this example, we have defined two consumers and registered them as spring beans. @@ -243,7 +247,7 @@ public class FooEventConsumer { } ------------------------------------------- -== Extracting disruptor information +=== Extracting disruptor information If needed, information such as buffer size, etc. can be obtained without using JMX in this fashion: diff --git a/components/camel-dns/src/main/docs/dns-component.adoc b/components/camel-dns/src/main/docs/dns-component.adoc index 4be3372f6e5..f343a75b627 100644 --- a/components/camel-dns/src/main/docs/dns-component.adoc +++ b/components/camel-dns/src/main/docs/dns-component.adoc @@ -119,7 +119,7 @@ Dig is a Unix command-line utility to run DNS queries. The query must be provided in the header with key `"dns.query"`. -== Dns Activation Policy +=== Dns Activation Policy The `DnsActivationPolicy` can be used to dynamically start and stop routes based on dns state. diff --git a/components/camel-docker/src/main/docs/docker-component.adoc b/components/camel-docker/src/main/docs/docker-component.adoc index 7c66b626966..d10146abb2c 100644 --- a/components/camel-docker/src/main/docs/docker-component.adoc +++ b/components/camel-docker/src/main/docs/docker-component.adoc @@ -46,7 +46,9 @@ include::partial$component-endpoint-options.adoc[] include::partial$component-endpoint-headers.adoc[] // component headers: END -== Header Strategy +== Usage + +=== Header Strategy All URI options can be passed as Header properties. Values found in a message header take precedence over URI parameters. A header property diff --git a/components/camel-drill/src/main/docs/drill-component.adoc b/components/camel-drill/src/main/docs/drill-component.adoc index a863e715d27..4539141f6c3 100644 --- a/components/camel-drill/src/main/docs/drill-component.adoc +++ b/components/camel-drill/src/main/docs/drill-component.adoc @@ -57,7 +57,9 @@ include::partial$component-endpoint-options.adoc[] include::partial$component-endpoint-headers.adoc[] // component headers: END -== Drill Producer +== Usage + +=== Drill Producer The producer executes a query using the *CamelDrillQuery* header and puts the results into the body. diff --git a/components/camel-dropbox/src/main/docs/dropbox-component.adoc b/components/camel-dropbox/src/main/docs/dropbox-component.adoc index 77cb24e2b20..4b57a314b53 100644 --- a/components/camel-dropbox/src/main/docs/dropbox-component.adoc +++ b/components/camel-dropbox/src/main/docs/dropbox-component.adoc @@ -91,7 +91,9 @@ include::partial$component-endpoint-options.adoc[] include::partial$component-endpoint-headers.adoc[] // component headers: END -== Del operation +== Usage + +=== Del operation Delete files on Dropbox. @@ -106,8 +108,7 @@ Below are listed the options for this operation: |`remotePath` |`true` |Folder or file to delete on Dropbox |=== -=== Examples - +.Examples [source,java] ---- from("direct:start") @@ -121,7 +122,7 @@ from("direct:start") .to("mock:result"); ---- -=== Result Message Body +==== Result Message Body The following objects are set on message body result: @@ -132,7 +133,7 @@ The following objects are set on message body result: |`String` |name of the path deleted on dropbox |=== -== Get (download) operation +=== Get (download) operation Download files from Dropbox. @@ -147,8 +148,7 @@ Below are listed the options for this operation: |`remotePath` |`true` |Folder or file to download from Dropbox |=== -=== Examples - +.Examples [source,java] ---- from("direct:start") @@ -166,7 +166,7 @@ from("dropbox://get?accessToken=XXX&clientIdentifier=XXX&expireIn=1000&refreshTo .to("file:///home/kermit/"); ---- -=== Result Message Body +==== Result Message Body The following objects are set on message body result: @@ -181,7 +181,7 @@ remote file downloaded and as value the stream representing the file downloaded |=== -== Move operation +=== Move operation Move files on Dropbox between one folder to another. @@ -198,8 +198,7 @@ Below are listed the options for this operation: |`newRemotePath` |`true` |Destination file or folder |=== -=== Examples - +.Examples [source,java] ---- from("direct:start") @@ -208,7 +207,7 @@ from("direct:start") .to("mock:result"); ---- -=== Result Message Body +==== Result Message Body The following objects are set on message body result: @@ -219,7 +218,7 @@ The following objects are set on message body result: |`String` |name of the path moved on dropbox |=== -== Put (upload) operation +=== Put (upload) operation Upload files on Dropbox. @@ -250,8 +249,7 @@ Caused by: java.lang.IllegalArgumentException: 'path': bad path: must start with |=== -=== Examples - +.Examples [source,java] ---- from("direct:start").to("dropbox://put?accessToken=XXX&clientIdentifier=XXX&expireIn=1000&refreshToken=XXXX" @@ -278,7 +276,7 @@ The name of the file can be provided in the header `DropboxConstants.HEADER_PUT_ or `Exchange.FILE_NAME` in that order of precedence. If no header has been provided then the message id (uuid) is used as the file name. -=== Result Message Body +==== Result Message Body The following objects are set on message body result: @@ -293,7 +291,7 @@ remote file uploaded and as value the result of the upload operation, OK or KO |=== -== Search operation +=== Search operation Search inside a remote Dropbox folder including its subdirectories. @@ -313,8 +311,7 @@ will be matched. The query is required to be provided in either the endpoint con or as a header `CamelDropboxQuery` on the Camel message. |=== -=== Examples - +.Examples [source,java] ---- from("dropbox://search?accessToken=XXX&clientIdentifier=XXX&expireIn=1000&refreshToken=XXXX" @@ -328,7 +325,7 @@ from("direct:start") .to("mock:result"); ---- -=== Result Message Body +==== Result Message Body The following objects are set on message body result: diff --git a/components/camel-dynamic-router/src/main/docs/dynamic-router-component.adoc b/components/camel-dynamic-router/src/main/docs/dynamic-router-component.adoc index 9f01d03354e..56638edaed2 100644 --- a/components/camel-dynamic-router/src/main/docs/dynamic-router-component.adoc +++ b/components/camel-dynamic-router/src/main/docs/dynamic-router-component.adoc @@ -119,7 +119,7 @@ Spring XML:: ---- ==== -== Dynamic Router EIP Component Use Cases +== Examples The benefit of the Dynamic Router EIP Component can best be seen, perhaps, through looking at some use cases. These examples are not the only possibilities with this component, but they show the basics of two main usages -- message @@ -316,7 +316,7 @@ In the `camel-spring-boot-examples` project, the `dynamic-router-eip-multimodule in this category that you can run and/or experiment with to get a practical feel for how you might use this in your own multi-JVM application stack. -== JMX Control and Monitoring Operations +=== JMX Control and Monitoring Operations The Dynamic Router Control component supports some JMX operations that allow you to control and monitor the component. It is beyond the scope of this document to go into detail about JMX, so this is a list of the operations that are diff --git a/components/camel-ehcache/src/main/docs/ehcache-component.adoc b/components/camel-ehcache/src/main/docs/ehcache-component.adoc index 4640bb84315..135d3f72421 100644 --- a/components/camel-ehcache/src/main/docs/ehcache-component.adoc +++ b/components/camel-ehcache/src/main/docs/ehcache-component.adoc @@ -56,7 +56,9 @@ include::partial$component-endpoint-options.adoc[] include::partial$component-endpoint-headers.adoc[] // component headers: END -== Ehcache based idempotent repository example: +== Examples + +=== Ehcache based idempotent repository example: [source,java] ------------------------------------------------------------------------------------------------ @@ -70,7 +72,7 @@ from("direct:in") -== Ehcache based aggregation repository example: +=== Ehcache based aggregation repository example: [source,java] --------------------------------------------------------------------------------------------------------------------------------- diff --git a/components/camel-elasticsearch-rest-client/src/main/docs/elasticsearch-rest-client-component.adoc b/components/camel-elasticsearch-rest-client/src/main/docs/elasticsearch-rest-client-component.adoc index d6d9005646e..19470fcb83e 100644 --- a/components/camel-elasticsearch-rest-client/src/main/docs/elasticsearch-rest-client-component.adoc +++ b/components/camel-elasticsearch-rest-client/src/main/docs/elasticsearch-rest-client-component.adoc @@ -86,7 +86,9 @@ You can set the message exchange body to a `Map` of `String` keys & values for t |=== -== Index Content Example +== Examples + +=== Index Content Example To index some content. @@ -107,7 +109,7 @@ from("direct:index") .to("elasticsearch-rest-client://myCluster?operation=INDEX_OR_UPDATE&indexName=myIndex"); ---- -== Get By ID Example +=== Get By ID Example [source,java] ---- @@ -116,7 +118,7 @@ from("direct:getById") .to("elasticsearch-rest-client://myCluster?operation=GET_BY_ID&indexName=myIndex"); ---- -== Delete Example +=== Delete Example To delete indexed content, provide the `ID` message header. @@ -127,7 +129,7 @@ from("direct:getById") .to("elasticsearch-rest-client://myCluster?operation=DELETE&indexName=myIndex"); ---- -== Create Index Example +=== Create Index Example To create a new index. @@ -151,7 +153,7 @@ from("direct:createIndex") .to("elasticsearch-rest-client://myCluster?operation=CREATE_INDEX&indexName=myIndex"); ---- -== Delete Index Example +=== Delete Index Example To delete an index. @@ -161,7 +163,7 @@ from("direct:deleteIndex") .to("elasticsearch-rest-client://myCluster?operation=DELETE_INDEX&indexName=myIndex"); ---- -== Search Example +=== Search Example Search with a JSON query. diff --git a/components/camel-elasticsearch/src/main/docs/elasticsearch-component.adoc b/components/camel-elasticsearch/src/main/docs/elasticsearch-component.adoc index 95397256821..437fed6e3be 100644 --- a/components/camel-elasticsearch/src/main/docs/elasticsearch-component.adoc +++ b/components/camel-elasticsearch/src/main/docs/elasticsearch-component.adoc @@ -110,7 +110,9 @@ to configure it globally at the component level thanks to the option _enableDocu |=== -== Configure the component and enable basic authentication +== Usage + +=== Configure the component and enable basic authentication To use the Elasticsearch component, it has to be configured with a minimum configuration. [source,java] @@ -135,7 +137,55 @@ elasticsearchComponent.setCertificatePath(certPath); camelContext.addComponent("elasticsearch", elasticsearchComponent); ---- -== Index Example +=== Document type + +For all the search operations, it is possible to indicate the type of document to retrieve to get the result already unmarshalled with the expected type. + +The document type can be set using the header "documentClass" or via the uri parameter of the same name. + +=== Using Camel Elasticsearch with Spring Boot + +When you use `camel-elasticsearch-starter` with Spring Boot v2, then you must declare the following +dependency in your own `pom.xml`. + +[source,xml] +---- +<dependency> + <groupId>jakarta.json</groupId> + <artifactId>jakarta.json-api</artifactId> + <version>2.0.2</version> +</dependency> +---- + +This is needed because Spring Boot v2 provides jakarta.json-api:1.1.6, and Elasticsearch requires to use json-api v2. + +=== Use RestClient provided by Spring Boot + +By default, Spring Boot will auto configure an Elasticsearch RestClient that will be used by camel, it is possible to customize the client with the following basic properties: + +[source,properties] +---- +spring.elasticsearch.uris=myelkhost:9200 +spring.elasticsearch.username=elkuser +spring.elasticsearch.password=secure!! +---- + +More information can be found in https://docs.spring.io/spring-boot/docs/current/reference/html/application-properties.html#application-properties.data.spring.elasticsearch.connection-timeout + +=== Disable Sniffer when using Spring Boot + +When Spring Boot is on the classpath, the Sniffer client for Elasticsearch is enabled by default. This option can be disabled in the Spring Boot Configuration: + +[source,yaml] +---- +spring: + autoconfigure: + exclude: org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientAutoConfiguration +---- + +== Examples + +=== Index Example Below is a simple INDEX example @@ -165,7 +215,7 @@ map.put("content", "test"); String indexId = template.requestBody("direct:index", map, String.class); ---- -== Search Example +=== Search Example Searching on specific field(s) and value use the Operation ´Search´. Pass in the query JSON String or the Map @@ -244,7 +294,7 @@ from("direct:search") .end(); ---- -== MultiSearch Example +=== MultiSearch Example MultiSearching on specific field(s) and value uses the Operation ´MultiSearch´. Pass in the MultiSearchRequest instance @@ -275,50 +325,4 @@ MsearchRequest.Builder builder = new MsearchRequest.Builder().index("twitter").s List<MultiSearchResponseItem<?>> response = template.requestBody("direct:multiSearch", builder, List.class); ---- -== Document type - -For all the search operations, it is possible to indicate the type of document to retrieve to get the result already unmarshalled with the expected type. - -The document type can be set using the header "documentClass" or via the uri parameter of the same name. - -== Using Camel Elasticsearch with Spring Boot - -When you use `camel-elasticsearch-starter` with Spring Boot v2, then you must declare the following -dependency in your own `pom.xml`. - -[source,xml] ----- -<dependency> - <groupId>jakarta.json</groupId> - <artifactId>jakarta.json-api</artifactId> - <version>2.0.2</version> -</dependency> ----- - -This is needed because Spring Boot v2 provides jakarta.json-api:1.1.6, and Elasticsearch requires to use json-api v2. - -=== Use RestClient provided by Spring Boot - -By default, Spring Boot will auto configure an Elasticsearch RestClient that will be used by camel, it is possible to customize the client with the following basic properties: - -[source,properties] ----- -spring.elasticsearch.uris=myelkhost:9200 -spring.elasticsearch.username=elkuser -spring.elasticsearch.password=secure!! ----- - -More information can be found in https://docs.spring.io/spring-boot/docs/current/reference/html/application-properties.html#application-properties.data.spring.elasticsearch.connection-timeout - -=== Disable Sniffer when using Spring Boot - -When Spring Boot is on the classpath, the Sniffer client for Elasticsearch is enabled by default. This option can be disabled in the Spring Boot Configuration: - -[source,yaml] ----- -spring: - autoconfigure: - exclude: org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientAutoConfiguration ----- - include::spring-boot:partial$starter.adoc[] diff --git a/components/camel-etcd3/src/main/docs/etcd3-component.adoc b/components/camel-etcd3/src/main/docs/etcd3-component.adoc index 8aaf94a560d..9236c73729b 100644 --- a/components/camel-etcd3/src/main/docs/etcd3-component.adoc +++ b/components/camel-etcd3/src/main/docs/etcd3-component.adoc @@ -52,7 +52,9 @@ include::partial$component-endpoint-options.adoc[] include::partial$component-endpoint-headers.adoc[] // component headers: END -== Producer Operations (Since 3.20) +== Usage + +=== Producer Operations (Since 3.20) Apache Camel supports different etcd operations. @@ -83,7 +85,7 @@ the key `CamelEtcdKeyCharset`. You indicate if the key is a prefix by setting the exchange header with the key `CamelEtcdIsPrefix` to `true`. -== Consumer (Since 3.20) +=== Consumer (Since 3.20) The consumer of the etcd components allows watching changes on the matching key-value pair(s). One exchange is created per event with the header `CamelEtcdPath` set to the path of the corresponding key-value pair and the body of type `WatchEvent`. @@ -95,11 +97,11 @@ the key `CamelEtcdIsPrefix` to `true`. By default, the consumer receives only the latest changes, but it is also possible to start watching events from a specific revision by setting the option `fromIndex` to the expected starting index. -== AggregationRepository +=== AggregationRepository The Etcd v3 component provides an `AggregationStrategy` to use etcd as the backend datastore. -== RoutePolicy (Since 3.20) +=== RoutePolicy (Since 3.20) The Etcd v3 component provides a `RoutePolicy` to use etcd as clustered lock. diff --git a/components/camel-exec/src/main/docs/exec-component.adoc b/components/camel-exec/src/main/docs/exec-component.adoc index 8072836ee55..c2e93598687 100644 --- a/components/camel-exec/src/main/docs/exec-component.adoc +++ b/components/camel-exec/src/main/docs/exec-component.adoc @@ -59,7 +59,9 @@ include::partial$component-endpoint-options.adoc[] include::partial$component-endpoint-headers.adoc[] // component headers: END -== Message body +== Usage + +=== Message body If the component receives an `in` message body that is convertible to `java.io.InputStream`, it is used to feed input to the @@ -92,7 +94,7 @@ will return the content of the _out file_. If no _out file_ is used, then this component will convert the `stdout` of the process to the target type. For more details, please refer to the xref:exec-component.adoc[usage examples] below. -== Usage examples +== Examples === Executing word count (Linux) diff --git a/components/camel-file-watch/src/main/docs/file-watch-component.adoc b/components/camel-file-watch/src/main/docs/file-watch-component.adoc index a95cebf233c..bc0381f4b1a 100644 --- a/components/camel-file-watch/src/main/docs/file-watch-component.adoc +++ b/components/camel-file-watch/src/main/docs/file-watch-component.adoc @@ -36,7 +36,7 @@ include::partial$component-endpoint-options.adoc[] include::partial$component-endpoint-headers.adoc[] // component headers: END -== Examples: +== Examples === Recursive watch all events (file creation, file deletion, file modification): diff --git a/components/camel-file/src/main/docs/file-component.adoc b/components/camel-file/src/main/docs/file-component.adoc index b1cc3af5d48..c3f3fefe8f2 100644 --- a/components/camel-file/src/main/docs/file-component.adoc +++ b/components/camel-file/src/main/docs/file-component.adoc @@ -76,7 +76,9 @@ include::partial$component-endpoint-headers.adoc[] By default, it will override any existing file if one exists with the same name. ==== -== Move, Pre Move and Delete operations +== Usage + +=== Move, Pre Move and Delete operations By default, Camel will move consumed files to the `.camel` subfolder relative to the directory where the file was consumed. @@ -93,7 +95,7 @@ from("file://inbox?delete=true").to("bean:handleOrder"); There is a sample <<File2-ReadingFromADirectoryAndTheDefaultMoveOperation,showing reading from a directory and the default move operation>> below. ==== -=== Move, Delete and the Routing process +==== Move, Delete and the Routing process Any move or delete operations are executed after the routing has completed. So, during processing of the `Exchange` the file is still located in the inbox folder. @@ -127,7 +129,7 @@ Then that's using the xref:languages:file-language.adoc[File Language] which we This can be either relative or absolute. If relative, the directory is created as a subfolder from within the folder where the file was consumed. -=== Move and Pre Move operations +==== Move and Pre Move operations We have introduced a `preMove` operation to move files *before* they are processed. This allows you to mark which files have been scanned as @@ -148,7 +150,7 @@ from("file://inbox?preMove=inprogress&move=.done").to("bean:handleOrder"); So in this situation, the file is in the `inprogress` folder when being processed, and after it's processed, it's moved to the `.done` folder. -=== Fine-grained control over Move and PreMove option +==== Fine-grained control over Move and PreMove option The `move` and `preMove` options are Expression-based, so we have the full power of the xref:languages:file-language.adoc[File Language] to do advanced configuration @@ -170,7 +172,7 @@ the pattern, we can do: move=backup/${date:now:yyyyMMdd}/${file:name} ---- -=== About moveFailed +==== About moveFailed The `moveFailed` option allows you to move files that *could not* be processed successfully to another location such as an error folder of your @@ -183,7 +185,7 @@ For example, to move the files in an error folder with a timestamp you can use See more examples at xref:languages:file-language.adoc[File Language] ==== -== Exchange Properties, file consumer only +=== Exchange Properties, file consumer only As the file consumer implements the `BatchConsumer` it supports batching the files it polls. By batching, we mean that Camel will add the @@ -205,7 +207,7 @@ This allows you, for instance, to know how many files exist in this batch and for instance, let the Aggregator2 aggregate this number of files. -== Using charset +=== Using charset The `charset` option allows configuring the encoding of the files on both the consumer and producer endpoints. For example, if you read utf-8 @@ -291,7 +293,7 @@ DEBUG GenericFileConverter - Read file /Users/davsclaus/workspace/came DEBUG FileOperations - Using Reader to write file: target/charset/output.txt with charset: iso-8859-1 ---------------------------------------------------------------------------------------------------------------------------------------------- -== Common gotchas with folder and filenames +=== Common gotchas with folder and filenames When Camel is producing files (writing files), there are a few gotchas affecting how to set a filename of your choice. By default, Camel will @@ -331,7 +333,7 @@ And a syntax where we set the filename on the endpoint with the from("direct:report").to("file:target/reports/?fileName=report.txt"); ---- -== Filename Expression +=== Filename Expression Filename can be set either using the *expression* option or as a string-based xref:languages:file-language.adoc[File Language] expression in the @@ -339,7 +341,7 @@ string-based xref:languages:file-language.adoc[File Language] expression in the for syntax and samples. [[File2-Consumingfilesfromfolderswhereothersdropfilesdirectly]] -== Consuming files from folders where others drop files directly +=== Consuming files from folders where others drop files directly Beware if you consume files from a folder where other applications write files too. Take a look at the different `readLock` options to see @@ -354,9 +356,9 @@ good at detecting this. You may also want to look at the `doneFileName` option, which uses a marker file (_done file_) to signal when a file is done and ready to be consumed. -== Done files +=== Done files -=== Using done files +==== Using done files See also section <<File2-WritingDoneFiles,_writing done files_>> below. @@ -419,7 +421,7 @@ You can also use a prefix for the _done file_, such as: [[File2-WritingDoneFiles]] -=== Writing done files +==== Writing done files After you have written a file, you may want to write an additional _done file_ as a kind of marker, to indicate to others that the file is finished and has been written. @@ -474,7 +476,7 @@ Will, for example, create a file named `foo.done` if the target file was ==== [[File2-Usingflatten]] -== Using flatten +=== Using flatten If you want to store the files in the `outputdir` directory in the same directory, disregarding the source directory layout (e.g., to flatten out @@ -493,13 +495,13 @@ outputdir/foo.txt outputdir/bar.txt ---- -== Writing to files +=== Writing to files Camel is also able to write files, i.e., produce files. In the sample below, we receive some reports on the SEDA queue that we process before they are being written to a directory. -=== Write to subdirectory using `Exchange.FILE_NAME` +==== Write to subdirectory using `Exchange.FILE_NAME` Using a single route, it is possible to write a file to any number of subdirectories. If you have a route setup as such: @@ -523,7 +525,7 @@ Exchange.FILE_NAME = foo/bye.txt => /rootDirectory/foo/bye.txt This allows you to have a single route to write files to multiple destinations. -=== Writing file through the temporary directory relative to the final destination +==== Writing file through the temporary directory relative to the final destination Sometimes you need to temporarily write the files to some directory relative to the destination directory. Such a situation usually happens @@ -539,7 +541,7 @@ from("direct:start"). to("file:///var/myapp/finalDirectory?tempPrefix=/../filesInProgress/"); ---- -== Avoiding reading the same file more than once (idempotent consumer) +=== Avoiding reading the same file more than once (idempotent consumer) Camel supports Idempotent Consumer directly within the component, so it will skip already processed files. @@ -589,9 +591,9 @@ consumed before: DEBUG FileConsumer is idempotent and the file has been consumed before. Will skip this file: target\idempotent\report.txt ---- -== Idempotent Repository +=== Idempotent Repository -=== Using a file-based idempotent repository +==== Using a file-based idempotent repository In this section we will use the file-based idempotent repository `org.apache.camel.processor.idempotent.FileIdempotentRepository` instead @@ -611,7 +613,7 @@ idempotent repository and define our file consumer to use our repository with the `idempotentRepository` using `#` sign to indicate Registry lookup: -=== Using a JPA based idempotent repository +==== Using a JPA based idempotent repository In this section, we will use the JPA based idempotent repository instead of the in-memory based that is used as default. @@ -662,17 +664,17 @@ option: </route> ---- -== Filtering Strategies +=== Filtering Strategies Camel supports pluggable filtering strategies. They are described below. -=== Filter using the `GenericFilter` +==== Filter using the `GenericFilter` The `filter` option allows you to implement a custom filter in Java code by implementing the `org.apache.camel.component.file.GenericFileFilter` interface. -==== Implementing a GenericFilter +===== Implementing a GenericFilter The interface has an `accept` method that returns a boolean. The meaning of the return values are: @@ -684,7 +686,7 @@ The meaning of the return values are: There is also a `isDirectory` method on `GenericFile` to inform whether the file is a directory. This allows you to filter unwanted directories, to avoid traversing down unwanted directories. -==== Using the `GenericFilter` +===== Using the `GenericFilter` You can then configure the endpoint with such a filter to skip certain files being processed. @@ -706,7 +708,7 @@ spring XML file: </route> ---- -=== Filtering using ANT path matcher +==== Filtering using ANT path matcher The ANT path matcher is based on http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/util/AntPathMatcher.html[AntPathMatcher]. @@ -728,11 +730,11 @@ The sample below demonstrates how to use it: from("file://inbox?antInclude=**/*.txt").to("..."); ---- -== Sorting Strategies +=== Sorting Strategies Camel supports pluggable sorting strategies. They are described below. -=== Sorting using Comparator +==== Sorting using Comparator This strategy it to use the build in `java.util.Comparator` in Java. You can then configure the endpoint with such a comparator and have Camel sort the files before @@ -766,7 +768,7 @@ Registry by prefixing the id with `#`. So writing Registry for a bean with the ID, `mySorter`. ==== -=== Sorting using sortBy +==== Sorting using sortBy Camel supports pluggable sorting strategies. This strategy uses the xref:languages:file-language.adoc[File Language] to configure the sorting. The @@ -845,7 +847,7 @@ per group, so we could reverse the file names: sortBy=date:file:yyyyMMdd;reverse:file:name ---- -== Using GenericFileProcessStrategy +=== Using GenericFileProcessStrategy The option `processStrategy` can be used to use a custom `GenericFileProcessStrategy` that allows you to implement your own @@ -866,7 +868,7 @@ resources etc. * in the `commit()` method we can move the actual file and also delete the _ready_ file. -== Using bridgeErrorHandler +=== Using bridgeErrorHandler If you want to use the Camel Error Handler to deal with any exception occurring in the file consumer, then you can @@ -899,7 +901,7 @@ The Exchange is processed directly by the Camel Error Handler, and does not allo prior actions such as interceptors, onCompletion to take action. ==== -== Debug logging +=== Debug logging This component has log level *TRACE* that can be helpful if you have problems. diff --git a/components/camel-flatpack/src/main/docs/flatpack-component.adoc b/components/camel-flatpack/src/main/docs/flatpack-component.adoc index 7abce250bce..dfaf5279963 100644 --- a/components/camel-flatpack/src/main/docs/flatpack-component.adoc +++ b/components/camel-flatpack/src/main/docs/flatpack-component.adoc @@ -50,7 +50,7 @@ include::partial$component-endpoint-options.adoc[] include::partial$component-endpoint-headers.adoc[] // component headers: END -== Examples +== Usage * `flatpack:fixed:foo.pzmap.xml` creates a fixed-width endpoint using the `foo.pzmap.xml` file configuration. @@ -59,7 +59,7 @@ the `foo.pzmap.xml` file configuration. * `flatpack:foo` creates a delimited endpoint called `foo` with no file configuration. -== Message Body +=== Message Body The component delivers the data in the IN message as a `org.apache.camel.component.flatpack.DataSetList` object that has @@ -70,7 +70,7 @@ converters for `java.util.Map` or `java.util.List`. + Each `Map` contains the key for the column name and its corresponding value. -For example to get the firstname from the sample below: +For example, to get the firstname from the sample below: [source,java] ------------------------------------------------ @@ -88,7 +88,7 @@ However, you can also always get it as a `List` (even for String firstName = row.get("FIRSTNAME"); --------------------------------------------------- -== Header and Trailer records +=== Header and Trailer records The header and trailer notions in Flatpack are supported. However, you *must* use fixed record IDs: @@ -119,7 +119,7 @@ trailer. You can omit one or both of them if not needed. </RECORD> --------------------------------------------------------------------------- -== Using the endpoint +=== Using as an Endpoint A common use case is sending a file to this endpoint for further processing in a separate route. For example: @@ -142,7 +142,7 @@ processing in a separate route. For example: You can also convert the payload of each message created to a `Map` for easy Bean Integration -== Flatpack DataFormat +=== Flatpack DataFormat The xref:flatpack-component.adoc[Flatpack] component ships with the Flatpack data format that can be used to format between fixed width or delimited text @@ -160,7 +160,7 @@ Splitter. *Notice:* The Flatpack library does currently not support header and trailers for the marshal operation. -== Options +==== Options The data format has the following options: @@ -189,9 +189,9 @@ expected and ignores the extra characters. expected and ignores the extra characters. |======================================================================= -== Usage +=== Using the data format -To use the data format, simply instantiate an instance and invoke the +To use the data format, instantiate an instance and invoke the marshal or unmarshal operation in the route builder: [source,java] @@ -217,21 +217,20 @@ df.setIgnoreFirstRecord(false); from("seda:people").marshal(df).convertBodyTo(String.class).to("jms:queue:people"); ----------------------------------------------------------------------------------- -In the code above we marshal the data from a Object representation as a +In the code above we marshal the data from an Object representation as a `List` of rows as `Maps`. The rows as `Map` contains the column name as the key, and the corresponding value. This structure can be created -in Java code from e.g. a processor. We marshal the data according to the +in Java code from e.g., a processor. We marshal the data according to the Flatpack format and convert the result as a `String` object and store it on a JMS queue. -== Dependencies +=== Dependencies -To use Flatpack in your camel routes you need to add the a dependency on +To use Flatpack in your camel routes, you need to add a dependency on *camel-flatpack* which implements this data format. -If you use maven you could just add the following to your pom.xml, -substituting the version number for the latest & greatest release (see -the download page for the latest versions). +If you use maven, you could add the following to your `pom.xml`, +substituting the version number for the latest release. [source,xml] ----------------------------------------- diff --git a/components/camel-flatpack/src/main/docs/flatpack-dataformat.adoc b/components/camel-flatpack/src/main/docs/flatpack-dataformat.adoc index 855f62ba19c..13285418b0a 100644 --- a/components/camel-flatpack/src/main/docs/flatpack-dataformat.adoc +++ b/components/camel-flatpack/src/main/docs/flatpack-dataformat.adoc @@ -35,7 +35,7 @@ include::partial$dataformat-options.adoc[] == Usage -To use the data format, simply instantiate an instance and invoke the +To use the data format, instantiate an instance and invoke the marshal or unmarshal operation in the route builder: [source,java] @@ -61,23 +61,22 @@ df.setIgnoreFirstRecord(false); from("seda:people").marshal(df).convertBodyTo(String.class).to("jms:queue:people"); ----------------------------------------------------------------------------------- -In the code above we marshal the data from a Object representation as a +In the code above we marshal the data from an Object representation as a `List` of rows as `Maps`. The rows as `Map` contains the column name as the key, and the corresponding value. This structure can be created -in Java code from e.g. a processor. We marshal the data according to the +in Java code from e.g., a processor. We marshal the data according to the Flatpack format and convert the result as a `String` object and store it on a JMS queue. == Dependencies -To use Flatpack in your camel routes you need to add the a dependency on +To use Flatpack in your camel routes, you need to add a dependency on *camel-flatpack* which implements this data format. -If you use maven you could just add the following to your pom.xml, -substituting the version number for the latest & greatest release (see -the download page for the latest versions). +If you use maven, you could add the following to your `pom.xml`, +substituting the version number for the latest release. -[source,java] +[source,xml] ----------------------------------------- <dependency> <groupId>org.apache.camel</groupId> diff --git a/components/camel-flink/src/main/docs/flink-component.adoc b/components/camel-flink/src/main/docs/flink-component.adoc index b64e3de9203..d4172f7e413 100644 --- a/components/camel-flink/src/main/docs/flink-component.adoc +++ b/components/camel-flink/src/main/docs/flink-component.adoc @@ -61,7 +61,9 @@ include::partial$component-endpoint-options.adoc[] include::partial$component-endpoint-headers.adoc[] // component headers: END -== Flink DataSet Callback +== Examples + +=== Flink DataSet Callback [source,java] ----------------------------------- @@ -80,7 +82,7 @@ public DataSetCallback<Long> dataSetCallback() { } ----------------------------------- -== Flink DataStream Callback +=== Flink DataStream Callback [source,java] --------------------------- @@ -97,7 +99,7 @@ public VoidDataStreamCallback dataStreamCallback() { } --------------------------- -== Camel-Flink Producer call +=== Camel-Flink Producer call [source,java] ----------------------------------- diff --git a/components/camel-fop/src/main/docs/fop-component.adoc b/components/camel-fop/src/main/docs/fop-component.adoc index 167f5184770..2f91526beae 100644 --- a/components/camel-fop/src/main/docs/fop-component.adoc +++ b/components/camel-fop/src/main/docs/fop-component.adoc @@ -36,7 +36,9 @@ for this component: fop://outputFormat?[options] ---------------------------- -== Output Formats +== Usage + +=== Output Formats The primary output format is PDF, but other output http://xmlgraphics.apache.org/fop/0.95/output.html[formats] are also @@ -86,7 +88,7 @@ include::partial$component-endpoint-options.adoc[] include::partial$component-endpoint-headers.adoc[] // component headers: END -== Configuration file +=== Configuration file The location of a configuration file with the following http://xmlgraphics.apache.org/fop/1.0/configuration.html[structure]. @@ -95,44 +97,44 @@ default. You can use `file:`, or `classpath:` as prefix to load the resource from file or classpath. In previous releases, the file is always loaded from the file system. -== Message Operations +=== Message Operations [width="100%",cols="10%,10%,80%",options="header",] |======================================================================= |name |default value |description -|CamelFop.Output.Format | | Overrides the output format for that message +|`CamelFop.Output.Format` | | Overrides the output format for that message -|CamelFop.Encrypt.userPassword | | PDF user password +|`CamelFop.Encrypt.userPassword` | | PDF user password -|CamelFop.Encrypt.ownerPassword | | PDF owner passoword +|`CamelFop.Encrypt.ownerPassword` | | PDF owner passoword -|CamelFop.Encrypt.allowPrint | true |Allows printing the PDF +|`CamelFop.Encrypt.allowPrint` | `true` |Allows printing the PDF -|CamelFop.Encrypt.allowCopyContent |true |Allows copying content of the PDF +|`CamelFop.Encrypt.allowCopyContent` |`true` |Allows copying content of the PDF -|CamelFop.Encrypt.allowEditContent |true |Allows editing content of the PDF +|`CamelFop.Encrypt.allowEditContent` |`true` |Allows editing content of the PDF -|CamelFop.Encrypt.allowEditAnnotations |true |Allows editing annotation of the PDF +|`CamelFop.Encrypt.allowEditAnnotations` |`true` |Allows editing annotation of the PDF -|CamelFop.Render.producer |Apache FOP |Metadata element for the system/software that produces the document +|`CamelFop.Render.producer` |Apache FOP |Metadata element for the system/software that produces the document -|CamelFop.Render.creator | | Metadata element for the user that created the document +|`CamelFop.Render.creator` | | Metadata element for the user that created the document -|CamelFop.Render.creationDate | | Creation Date +|`CamelFop.Render.creationDate` | | Creation Date -|CamelFop.Render.author | | Author of the content of the document +|`CamelFop.Render.author` | | Author of the content of the document -|CamelFop.Render.title | | Title of the document +|`CamelFop.Render.title` | | Title of the document -|CamelFop.Render.subject | | Subject of the document +|`CamelFop.Render.subject` | | Subject of the document -|CamelFop.Render.keywords | | Set of keywords applicable to this document +|`CamelFop.Render.keywords` | | Set of keywords applicable to this document |======================================================================= -== Example +=== Example -Below is an example route that renders PDFs from xml data and xslt +Below is an example route that renders PDFs from XML data and XSLT template and saves the PDF files in the target folder: [source,java] diff --git a/components/camel-freemarker/src/main/docs/freemarker-component.adoc b/components/camel-freemarker/src/main/docs/freemarker-component.adoc index 7f64f8bd20e..9baf600a80a 100644 --- a/components/camel-freemarker/src/main/docs/freemarker-component.adoc +++ b/components/camel-freemarker/src/main/docs/freemarker-component.adoc @@ -55,6 +55,9 @@ include::partial$component-endpoint-options.adoc[] // endpoint options: END +// component headers: START +include::partial$component-endpoint-headers.adoc[] +// component headers: END == Headers @@ -70,7 +73,9 @@ ${request.setHeader('fruit', 'Apple')} The header, `fruit`, is now accessible from the `message.out.headers`. -== FreeMarker Context +== Usage + +=== FreeMarker Context Camel will provide exchange information in the FreeMarker context (just a `Map`). The `Exchange` is transferred as: @@ -108,24 +113,20 @@ variableMap.put("exchange", exchange); exchange.getIn().setHeader("CamelFreemarkerDataModel", variableMap); -------------------------------------------------------------------- -== Hot reloading +=== Hot reloading The FreeMarker template resource is by default *not* hot reloadable for both file and classpath resources (expanded jar). If you set `contentCache=false`, then Camel will not cache the resource and hot reloading is thus enabled. This scenario can be used in development. -== Dynamic templates +=== Dynamic templates Camel provides two headers by which you can define a different resource location for a template or the template content itself. If any of these headers is set, then Camel uses this over the endpoint configured resource. This allows you to provide a dynamic template at runtime. -// component headers: START -include::partial$component-endpoint-headers.adoc[] -// component headers: END - == Examples For example, you could use something like: @@ -178,7 +179,7 @@ from("direct:in"). to("freemarker:dummy?allowTemplateFromHeader=true"); --------------------------------------------------------------------------------------------- -== The Email Example +=== The Email Example In this sample, we want to use FreeMarker templating for an order confirmation email. The email template is laid out in FreeMarker as: