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 9b74e2e2ace CAMEL-21040: ensure more consistency in the document sections 9b74e2e2ace is described below commit 9b74e2e2ace1ef9fd96c8e7c21db849562a8d508 Author: Otavio Rodolfo Piske <angusyo...@gmail.com> AuthorDate: Wed Aug 7 14:19:44 2024 +0200 CAMEL-21040: ensure more consistency in the document sections - Also fixed typos - Reorganized examples --- .../camel-jdbc/src/main/docs/jdbc-component.adoc | 8 +- .../src/main/docs/jgroups-component.adoc | 4 +- .../camel-jira/src/main/docs/jira-component.adoc | 37 +++---- .../camel-jms/src/main/docs/jms-component.adoc | 43 ++++---- .../camel-jooq/src/main/docs/jooq-component.adoc | 46 ++++----- .../camel-joor/src/main/docs/java-language.adoc | 34 +++---- .../camel-joor/src/main/docs/joor-language.adoc | 32 +++--- .../camel-jpa/src/main/docs/jpa-component.adoc | 92 ++++++++--------- components/camel-jq/src/main/docs/jq-language.adoc | 40 ++++---- .../camel-jslt/src/main/docs/jslt-component.adoc | 4 +- .../src/main/docs/jsonpath-language.adoc | 110 +++++++++++---------- .../camel-jt400/src/main/docs/jt400-component.adoc | 4 +- .../camel-jte/src/main/docs/jte-component.adoc | 6 +- 13 files changed, 235 insertions(+), 225 deletions(-) diff --git a/components/camel-jdbc/src/main/docs/jdbc-component.adoc b/components/camel-jdbc/src/main/docs/jdbc-component.adoc index 7dbf6814b71..33d8c0cfaa0 100644 --- a/components/camel-jdbc/src/main/docs/jdbc-component.adoc +++ b/components/camel-jdbc/src/main/docs/jdbc-component.adoc @@ -63,7 +63,9 @@ include::partial$component-endpoint-options.adoc[] include::partial$component-endpoint-headers.adoc[] // component headers: END -== Result +== Usage + +=== Result By default, the result is returned in the OUT body as an `ArrayList<HashMap<String, Object>>`. The `List` object contains the @@ -74,7 +76,7 @@ the result. *Note:* This component fetches `ResultSetMetaData` to be able to return the column name as the key in the `Map`. -== Generated keys +=== Generated keys If you insert data using SQL INSERT, then the RDBMS may support auto generated keys. You can instruct the xref:jdbc-component.adoc[JDBC] producer to @@ -85,7 +87,7 @@ table above. Using generated keys does not work together with named parameters. -== Using named parameters +=== Using named parameters In the given route below, we want to get all the projects from the `projects` table. diff --git a/components/camel-jgroups/src/main/docs/jgroups-component.adoc b/components/camel-jgroups/src/main/docs/jgroups-component.adoc index a7308a89f17..98e4a4c0a2b 100644 --- a/components/camel-jgroups/src/main/docs/jgroups-component.adoc +++ b/components/camel-jgroups/src/main/docs/jgroups-component.adoc @@ -83,7 +83,7 @@ endpoint. from("direct:start").to("jgroups:clusterName"); -------------------------------------------------- -== Predefined filters +=== Predefined filters JGroups component comes with predefined filters factory class named `JGroupsFilters.` @@ -105,7 +105,7 @@ from("jgroups:clusterName?enableViewMessages=true"). to("seda:masterNodeEventsQueue"); ---------------------------------------------------------------------------------------- -== Predefined expressions +=== Predefined expressions JGroups component comes with predefined expressions factory class named `JGroupsExpressions.` diff --git a/components/camel-jira/src/main/docs/jira-component.adoc b/components/camel-jira/src/main/docs/jira-component.adoc index 55765a47fdb..b3b4fc1aa79 100644 --- a/components/camel-jira/src/main/docs/jira-component.adoc +++ b/components/camel-jira/src/main/docs/jira-component.adoc @@ -94,12 +94,13 @@ include::partial$component-endpoint-options.adoc[] include::partial$component-endpoint-headers.adoc[] // component headers: END +== Usage -== Client Factory +=== Client Factory You can bind the `JiraRestClientFactory` with name *JiraRestClientFactory* in the registry to have it automatically set in the Jira endpoint. -== Authentication +=== Authentication Camel-jira supports the following forms of authentication: @@ -109,11 +110,11 @@ Camel-jira supports the following forms of authentication: We recommend using OAuth or Personal token whenever possible, as it provides the best security for your users and system. -=== Basic authentication requirements: +==== Basic authentication requirements: * A username and a password. -=== OAuth authentication requirements: +==== OAuth authentication requirements: Follow the tutorial in https://developer.atlassian.com/cloud/jira/platform/jira-rest-api-oauth-authentication/[Jira OAuth documentation] to generate the client private key, consumer key, verification code and access token. @@ -123,13 +124,13 @@ to generate the client private key, consumer key, verification code and access t * The consumer key, set in the Jira server settings. * An access token, generated by Jira server. -=== Personal access token authentication requirements: +==== Personal access token authentication requirements: Follow the tutorial to generate the https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html[Personal Token]. * You have to set only the personal token in the `access-token` parameter. -== JQL: +=== JQL The JQL URI option is used by both consumer endpoints. Theoretically, items like the "project key", etc. could be URI options themselves. @@ -154,16 +155,16 @@ issue in the project. Another note is that, similarly, the newComments consumer will have to index every single issue *and* comment on the project. Therefore, for large projects, it's *vital* to optimize the JQL expression as much as -possible. For example, the JIRA Toolkit Plugin includes a "Number of -comments" custom field -- use '"Number of comments" > 0' in your query. -Also try to minimize based on state (status=Open), increase the polling +possible. For example, the JIRA Toolkit Plugin includes a `"Number of +comments"` custom field use `'"Number of comments" > 0'` in your query. +Also try to minimize based on state (`status=Open`), increase the polling delay, etc. Example: ---------------------------------------------------------------------------------------------------------------------------------------------- jira://[type]?[required options]&jql=RAW(project=[project key] AND status in (Open, \"Coding In Progress\") AND \"Number of comments\">0)" ---------------------------------------------------------------------------------------------------------------------------------------------- -== Operations +=== Operations See a list of required headers to set when using the Jira operations. The author field for the producers is automatically set to the authenticated user on the Jira side. @@ -171,7 +172,7 @@ If any required field is not set, then an IllegalArgumentException is throw. There are operations that requires `id` for fields such as the issue type, priority, transition. Check the valid `id` on your jira project as they may differ on a jira installation and project workflow. -== AddIssue +=== AddIssue Required: @@ -188,14 +189,14 @@ Optional: * `IssueWatchersAdd`: A list of strings with the usernames (or id) to add to the watcher list. * `IssueDescription`: The description of the issue. -== AddComment +=== AddComment Required: * `IssueKey`: The issue key identifier. * the body of the exchange is the description. -== Attach +=== Attach Only one file should attach per invocation. @@ -204,13 +205,13 @@ Required: * `IssueKey`: The issue key identifier. * body of the exchange should be of type `File` -== DeleteIssue +=== DeleteIssue Required: * `IssueKey`: The issue key identifier. -== TransitionIssue +=== TransitionIssue Required: @@ -218,7 +219,7 @@ Required: * `IssueTransitionId`: The issue transition `id`. * the body of the exchange is the description. -== UpdateIssue +=== UpdateIssue * `IssueKey`: The issue key identifier. * `IssueTypeId` or `IssueTypeName`: The `id` of the issue type or the name of the issue type, you can see the valid list in `\http://jira_server/rest/api/2/issue/createmeta?projectKeys=SAMPLE_KEY`. @@ -229,13 +230,13 @@ Required: * `IssueComponents`: A list of string with the valid component names. * `IssueDescription`: The description of the issue. -== Watcher +=== Watcher * `IssueKey`: The issue key identifier. * `IssueWatchersAdd`: A list of strings with the usernames (or id) to add to the watcher list. * `IssueWatchersRemove`: A list of strings with the usernames to remove from the watcher list. -== WatchUpdates (consumer) +=== WatchUpdates (consumer) * `watchedFields` Comma separated list of fields to watch for changes i.e. `Status,Priority,Assignee,Components` etc. * `sendOnlyUpdatedField` By default, only the changed field is sent as the body. diff --git a/components/camel-jms/src/main/docs/jms-component.adoc b/components/camel-jms/src/main/docs/jms-component.adoc index 109d8217410..5a1980ef039 100644 --- a/components/camel-jms/src/main/docs/jms-component.adoc +++ b/components/camel-jms/src/main/docs/jms-component.adoc @@ -331,8 +331,9 @@ You can, however, use any Expression to send whatever you like. For example, you can invoke a method on a Bean or use a custom processor. +== Usage -== Message Mapping between JMS and Camel +=== Message Mapping between JMS and Camel Camel automatically maps messages between `javax.jms.Message` and `org.apache.camel.Message`. @@ -426,7 +427,7 @@ from("file://inbox/order").setHeader("CamelJmsMessageType", JmsMessageType.Text) The possible values are defined in the `enum` class, `org.apache.camel.jms.JmsMessageType`. -== Message format when sending +=== Message format when sending The exchange sent over the JMS wire must conform to the http://java.sun.com/j2ee/1.4/docs/api/javax/jms/Message.html[JMS Message @@ -463,7 +464,7 @@ at *DEBUG* level if it drops a given header value. For example: - Ignoring non primitive header: order of class: org.apache.camel.component.jms.issues.DummyOrder with value: DummyOrder{orderId=333, itemId=4444, quantity=2} ---------------------------------------------------------------------------------------------------------------------------------------------------------------- -== Message format when receiving +=== Message format when receiving Camel adds the following properties to the `Exchange` when it receives a message: @@ -509,7 +510,7 @@ As all the above information is standard JMS, you can check the http://java.sun.com/javaee/5/docs/api/javax/jms/Message.html[JMS documentation] for further details. -== About using Camel to send and receive messages and JMSReplyTo +=== About using Camel to send and receive messages and JMSReplyTo The JMS component is complex, and you have to pay close attention to how it works in some cases. So this is a short summary of some @@ -527,7 +528,7 @@ endpoint: `disableReplyTo`, `preserveMessageQos`, `explicitQosEnabled`. All this can be a tad complex to understand and configure to support your use case. -=== JmsProducer +==== JmsProducer The `JmsProducer` behaves as follows, depending on configuration: @@ -554,7 +555,7 @@ instruct Camel to keep the `JMSReplyTo`. In all situations the sending the message. |======================================================================= -=== JmsConsumer +==== JmsConsumer The `JmsConsumer` behaves as follows, depending on configuration: @@ -584,7 +585,7 @@ from("activemq:queue:in") .to("bean:handleOrder"); ------------------------------------------------------ -== Reuse endpoint and send to different destinations computed at runtime +=== Reuse endpoint and send to different destinations computed at runtime If you need to send messages to a lot of different JMS destinations, it makes sense to reuse a JMS endpoint and specify the real destination in @@ -638,7 +639,7 @@ them to the created JMS message to avoid the accidental loops in the routes (in scenarios when the message will be forwarded to another JMS endpoint). -== Configuring different JMS providers +=== Configuring different JMS providers You can configure your JMS provider in Spring XML as follows: @@ -659,7 +660,7 @@ spring context for the scheme name you use for Endpoint URIs and having the Component resolve the endpoint URIs. -=== Using JNDI to find the ConnectionFactory +==== Using JNDI to find the ConnectionFactory If you are using a J2EE container, you might need to look up JNDI to find the JMS `ConnectionFactory` rather than use the usual `<bean>` @@ -680,7 +681,7 @@ http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html jee schema] in the Spring reference documentation for more details about JNDI lookup. -== Concurrent Consuming +=== Concurrent Consuming A common requirement with JMS is to consume messages concurrently in multiple threads to make an application more responsive. You @@ -699,7 +700,7 @@ You can configure this option in one of the following ways: * On the endpoint URI or, * By invoking `setConcurrentConsumers()` directly on the `JmsEndpoint`. -=== Concurrent Consuming with async consumer +==== Concurrent Consuming with async consumer Notice that each concurrent consumer will only pick up the next available message from the JMS broker, when the current message has been fully @@ -716,7 +717,7 @@ from("jms:SomeQueue?concurrentConsumers=20&asyncConsumer=true"). bean(MyClass.class); ---------------------------------------------------------------- -== Request-reply over JMS +=== Request-reply over JMS Camel supports Request Reply over JMS. In essence the MEP of the Exchange should be `InOut` when you send a @@ -805,7 +806,7 @@ from(xxx) In this route, we instruct Camel to route replies asynchronously using a thread pool with five threads. -=== Request-reply over JMS and using a shared fixed reply queue +==== Request-reply over JMS and using a shared fixed reply queue If you use a fixed reply queue when doing Request Reply over JMS as shown in the example @@ -839,7 +840,7 @@ Notice this will cause the Camel to send pull requests to the message broker more frequently, and thus require more network traffic. + It is generally recommended to use temporary queues if possible. -=== Request-reply over JMS and using an exclusive fixed reply queue +==== Request-reply over JMS and using an exclusive fixed reply queue In the previous example, Camel would anticipate the fixed reply queue named "bar" was shared, and thus it uses a `JMSSelector` to only consume @@ -883,7 +884,7 @@ node in the cluster may pick up messages intended as a reply on another node. For clustered environments, it's recommended to use shared reply queues instead. -== Synchronizing clocks between senders and receivers +=== Synchronizing clocks between senders and receivers When doing messaging between systems, it is desirable that the systems have synchronized clocks. For example, when sending a xref:jms-component.adoc[JMS] @@ -900,7 +901,7 @@ can use the http://activemq.apache.org/timestampplugin.html[timestamp plugin] to synchronize clocks. ==== -== About time to live +=== About time to live Read first above about synchronized clocks. @@ -966,7 +967,7 @@ example, to indicate a 5 sec., you set `timeToLive=5000`. The option also for InOnly messaging. The `requestTimeout` option is not being used for InOnly messaging. -== Enabling Transacted Consumption +=== Enabling Transacted Consumption A common requirement is to consume from a queue in a transaction and then process the message using the Camel route. To do this, just ensure @@ -1012,7 +1013,7 @@ http://tmielke.blogspot.com/2012/03/camel-jms-with-transactions-lessons.html[her and http://forum.springsource.org/showthread.php?123631-JMS-DMLC-not-caching%20connection-when-using-TX-despite-cacheLevel-CACHE_CONSUMER&p=403530&posted=1#post403530[here]. -== Using JMSReplyTo for late replies +=== Using JMSReplyTo for late replies When using Camel as a JMS listener, it sets an Exchange property with the value of the ReplyTo `javax.jms.Destination` object, having the key @@ -1051,7 +1052,7 @@ template.send("activemq:queue:dummy, new Processor() { } ---------------------------------------------------------------------------------------------------------------------------------------- -== Using a request timeout +=== Using a request timeout In the sample below we send a Request Reply style message Exchange (we use the `requestBody` @@ -1059,7 +1060,7 @@ method = `InOut`) to the slow queue for further processing in Camel, and we wait for a return reply: -== Sending an InOnly message and keeping the JMSReplyTo header +=== Sending an InOnly message and keeping the JMSReplyTo header When sending to a xref:jms-component.adoc[JMS] destination using *camel-jms*, the producer will use the MEP to detect if it is `InOnly` or `InOut` messaging. @@ -1083,7 +1084,7 @@ template.send("activemq:queue:foo?preserveMessageQos=true", new Processor() { Notice we use `preserveMessageQos=true` to instruct Camel to keep the `JMSReplyTo` header. -== Setting JMS provider options on the destination +=== Setting JMS provider options on the destination Some JMS providers, like IBM's WebSphere MQ, need options to be set on the JMS destination. For example, you may need to specify the diff --git a/components/camel-jooq/src/main/docs/jooq-component.adoc b/components/camel-jooq/src/main/docs/jooq-component.adoc index 10eec0c6fd8..e44c0e334d7 100644 --- a/components/camel-jooq/src/main/docs/jooq-component.adoc +++ b/components/camel-jooq/src/main/docs/jooq-component.adoc @@ -16,11 +16,26 @@ The JOOQ component enables you to store and retrieve Java objects from persistent storage using JOOQ library. +// component-configure options: START + +// component-configure options: END + +// component options: START +include::partial$component-configure-options.adoc[] +include::partial$component-endpoint-options.adoc[] +// component options: END + +// endpoint options: START + +// endpoint options: END + +== Usage + JOOQ provides DSL to create queries. There are two types of queries: -. org.jooq.Query - can be executed -. org.jooq.ResultQuery - can return results +. `org.jooq.Query`: can be executed +. `org.jooq.ResultQuery`: can return results For example: [source,java] @@ -34,7 +49,7 @@ ResultQuery<Record> resultQuery = create.resultQuery("SELECT * FROM BOOK"); Result<Record> result = resultQuery.fetch(); ---- -== Plain SQL +=== Plain SQL SQL could be executed using JOOQ's objects "Query" or "ResultQuery". Also, the SQL query could be specified inside URI: @@ -45,27 +60,12 @@ from("jooq://org.apache.camel.component.jooq.db.tables.records.BookStoreRecord?q See the examples below. -== Consuming from endpoint +=== Consuming from endpoint Consuming messages from a JOOQ consumer endpoint removes (or updates) entity beans in the database. This allows you to use a database table as a logical queue: consumers take messages from the queue and then delete/update them to logically remove them from the queue. If you do not wish to delete the entity bean when it has been processed, you can specify consumeDelete=false on the URI. - -// component-configure options: START - -// component-configure options: END - -// component options: START -include::partial$component-configure-options.adoc[] -include::partial$component-endpoint-options.adoc[] -// component options: END - -// endpoint options: START - -// endpoint options: END - - === Operations When using jooq as a producer you can use any of the following `JooqOperation` operations: @@ -78,9 +78,9 @@ When using jooq as a producer you can use any of the following `JooqOperation` o | fetch | Execute a query and the result of the query is stored as the new message body |=== -=== Example: -JOOQ configuration: +== Example +.JOOQ configuration: [source,xml] ---- <?xml version="1.0" encoding="UTF-8"?> @@ -124,7 +124,7 @@ JOOQ configuration: </beans> ---- -Camel context configuration: +.Camel context configuration: [source,xml] ---- <?xml version="1.0" encoding="UTF-8"?> @@ -206,7 +206,7 @@ Camel context configuration: </beans> ---- -Sample bean: +.Sample bean: [source,java] ---- @Component diff --git a/components/camel-joor/src/main/docs/java-language.adoc b/components/camel-joor/src/main/docs/java-language.adoc index 14afca9f172..d5e2efa2b6a 100644 --- a/components/camel-joor/src/main/docs/java-language.adoc +++ b/components/camel-joor/src/main/docs/java-language.adoc @@ -15,29 +15,29 @@ The Java language (uses jOOR library to compile Java code) allows using Java cod The jOOR library integrates with the Java compiler and performs runtime compilation of Java code. - == Java Options - // language options: START include::partial$language-options.adoc[] // language options: END -== Variables +== Usage + +=== Variables The Java language allows the following variables to be used in the script: [width="100%",cols="2,1m,7",options="header"] |=== | Variable | Java Type | Description -| context | Context | The CamelContext -| exchange | Exchange | The Camel Exchange -| message | Message | The Camel message -| body | Object | The message body -| optionalBody | The body wrapped in `java.util.Optional`. +| `context` | Context | The CamelContext +| `exchange` | Exchange | The Camel Exchange +| `message` | Message | The Camel message +| `body` | Object | The message body +| `optionalBody` | The body wrapped in `java.util.Optional`. |=== -== Functions +=== Functions The Java language allows the following functions to be used in the script: @@ -87,7 +87,7 @@ And then the function can be shortened: var user = bodyAs(MyUser); ---- -== Dependency Injection +=== Dependency Injection The Camel Java language allows dependency injection by referring to beans by their id from the Camel registry. For optimization purposes, then the beans are injected once in the constructor and the scopes are _singleton_. @@ -156,7 +156,7 @@ Notice how we declare the bean as if it is a local variable via `var bean = #bea When doing this we must use a different name as `myEcho` is the variable used by the dependency injection. Therefore, we use _bean_ as name in the script. -== Auto imports +=== Auto imports The Java language will automatically import from: @@ -169,14 +169,14 @@ import org.apache.camel.*; import org.apache.camel.util.*; ---- -== Configuration file +=== Configuration file You can configure the jOOR language in the `camel-joor.properties` file which by default is loaded from the root classpath. You can specify a different location with the `configResource` option on the Java language. For example, you can add additional imports in the `camel-joor.properties` file by adding: -[source,properties] +[source,java] ---- import com.foo.MyUser; import com.bar.*; @@ -246,7 +246,7 @@ And in XML DSL: </route> ---- -== Multi statements +=== Multi statements It is possible to include multiple statements. The code below shows an example where the `user` header is retrieved in a first statement. @@ -268,7 +268,7 @@ from("seda:orders") .to("seda:user"); ---- -== Hot re-load +=== Hot re-load You can turn off pre-compilation for the Java language and then Camel will recompile the script for each message. You can externalize the code into a resource file, which will be reloaded on each message as shown: @@ -298,7 +298,7 @@ In XML DSL it's easier because you can turn off pre-compilation in the `<java>` </route> ---- -== Lambda-based AggregationStrategy +=== Lambda-based AggregationStrategy The Java language has special support for defining an `org.apache.camel.AggregationStrategy` as a lambda expression. This is useful when using EIP patterns that use aggregation such as the Aggregator, Splitter, Recipient List, Enrich, and others. @@ -325,7 +325,7 @@ For example, to aggregate message bodies together, we can do this as shown: } ---- -== Limitations +=== Limitations The Java Camel language is only supported as a block of Java code that gets compiled into a Java class with a single method. The code that you can write is therefore limited to a number of Java statements. diff --git a/components/camel-joor/src/main/docs/joor-language.adoc b/components/camel-joor/src/main/docs/joor-language.adoc index 7d1bf19e659..545e02c8b13 100644 --- a/components/camel-joor/src/main/docs/joor-language.adoc +++ b/components/camel-joor/src/main/docs/joor-language.adoc @@ -22,27 +22,27 @@ NOTE: Java 8 is not supported. Java 11 is required. == jOOR Options - - // language options: START include::partial$language-options.adoc[] // language options: END -== Variables +== Usage + +=== Variables The jOOR language allows the following variables to be used in the script: [width="100%",cols="2,1m,7",options="header"] |=== | Variable | Java Type | Description -| context | Context | The CamelContext -| exchange | Exchange | The Camel Exchange -| message | Message | The Camel message -| body | Object | The message body -| optionalBody | The body wrapped in `java.util.Optional`. +| `context` | Context | The CamelContext +| `exchange` | Exchange | The Camel Exchange +| `message` | Message | The Camel message +| `body` | Object | The message body +| `optionalBody` | The body wrapped in `java.util.Optional`. |=== -== Functions +=== Functions The jOOR language allows the following functions to be used in the script: @@ -92,7 +92,7 @@ And then the function can be shortened: var user = bodyAs(MyUser); ---- -== Dependency Injection +=== Dependency Injection The Camel jOOR language allows dependency injection by referring to beans by their id from the Camel registry. For optimization purposes, then the beans are injected once in the constructor and the scopes are _singleton_. @@ -161,7 +161,7 @@ Notice how we declare the bean as if it is a local variable via `var bean = #bea When doing this, we must use a different name as `myEcho` is the variable used by the dependency injection. Therefore, we use _bean_ as name in the script. -== Auto imports +=== Auto imports The jOOR language will automatically import from: @@ -174,7 +174,7 @@ import org.apache.camel.*; import org.apache.camel.util.*; ---- -== Configuration file +=== Configuration file You can configure the jOOR language in the `camel-joor.properties` file which by default is loaded from the root classpath. You can specify a different location with the `configResource` option on the jOOR language. @@ -257,7 +257,7 @@ XML DSL:: ==== -== Multi statements +=== Multi statements It is possible to include multiple statements. The code below shows an example where the `user` header is retrieved in a first statement. @@ -279,7 +279,7 @@ from("seda:orders") .to("seda:user"); ---- -== Hot re-load +=== Hot re-load You can turn off pre-compilation for the jOOR language and then Camel will recompile the script for each message. You can externalize the code into a resource file, which will be reloaded on each message as shown: @@ -318,7 +318,7 @@ In XML DSL it's easier because you can turn off pre-compilation in the `<joor>` ==== -== Lambda-based AggregationStrategy +=== Lambda-based AggregationStrategy The jOOR language has special support for defining an `org.apache.camel.AggregationStrategy` as a lambda expression. This is useful when using EIP patterns that use aggregation such as the Aggregator, Splitter, Recipient List, Enrich, and others. @@ -345,7 +345,7 @@ For example, to aggregate message bodies together, we can do this as shown: } ---- -== Limitations +=== Limitations The jOOR Camel language is only supported as a block of Java code that gets compiled into a Java class with a single method. The code that you can write is therefore limited to a number of Java statements. diff --git a/components/camel-jpa/src/main/docs/jpa-component.adoc b/components/camel-jpa/src/main/docs/jpa-component.adoc index 3c9bb8ae64f..8b92c8fa3b6 100644 --- a/components/camel-jpa/src/main/docs/jpa-component.adoc +++ b/components/camel-jpa/src/main/docs/jpa-component.adoc @@ -32,7 +32,39 @@ for this component: </dependency> ------------------------------------------------------------ -== Sending to the endpoint +== URI format + +----------------------------- +jpa:entityClassName[?options] +----------------------------- + +For sending to the endpoint, the _entityClassName_ is optional. If +specified, it helps the http://camel.apache.org/type-converter.html[Type Converter] to +ensure the body is of the correct type. + +For consuming, the _entityClassName_ is mandatory. + + +// component-configure options: START + +// component-configure options: END + +// component options: START +include::partial$component-configure-options.adoc[] +include::partial$component-endpoint-options.adoc[] +// component options: END + +// endpoint options: START + +// endpoint options: END + +// component headers: START +include::partial$component-endpoint-headers.adoc[] +// component headers: END + +== Usage + +=== Sending to the endpoint You can store a Java entity bean in a database by sending it to a JPA producer endpoint. The body of the _In_ message is assumed to be an @@ -57,8 +89,7 @@ JPQL/SQL statement. Please note that you need to specify `useExecuteUpdate` to ` if you execute `UPDATE`/`DELETE` with `namedQuery` as Camel doesn't look into the named query unlike `query` and `nativeQuery`. - -== Consuming from the endpoint +=== Consuming from the endpoint Consuming messages from a JPA consumer endpoint removes (or updates) entity beans in the database. This allows you to use a database table as @@ -82,37 +113,7 @@ which will be invoked on your entity bean before it has been processed If you are consuming a lot of rows (100K+) and experience `OutOfMemory` problems, you should set the `maximumResults` to a sensible value. -== URI format - ------------------------------ -jpa:entityClassName[?options] ------------------------------ - -For sending to the endpoint, the _entityClassName_ is optional. If -specified, it helps the http://camel.apache.org/type-converter.html[Type Converter] to -ensure the body is of the correct type. - -For consuming, the _entityClassName_ is mandatory. - - -// component-configure options: START - -// component-configure options: END - -// component options: START -include::partial$component-configure-options.adoc[] -include::partial$component-endpoint-options.adoc[] -// component options: END - -// endpoint options: START - -// endpoint options: END - -// component headers: START -include::partial$component-endpoint-headers.adoc[] -// component headers: END - -== Configuring EntityManagerFactory +=== Configuring EntityManagerFactory It's strongly advised to configure the JPA component to use a specific `EntityManagerFactory` instance. If failed to do so each `JpaEndpoint` @@ -135,7 +136,7 @@ you do not need to configure this on the `JpaComponent` as shown above. You only need to do so if there is ambiguity, in which case Camel will log a WARN. -== Configuring TransactionStrategy +=== Configuring TransactionStrategy The `TransactionStrategy` is a vendor neutral abstraction that allows `camel-jpa` to easily plug in and work with Spring `TransactionManager` or Quarkus Transaction API. @@ -163,7 +164,7 @@ explicitly configure a JPA component that references the </bean> ------------------------------------------------------------------- -== Using a consumer with a named query +=== Using a consumer with a named query For consuming only selected entities, you can use the `namedQuery` URI query option. First, you have to define the @@ -186,7 +187,7 @@ from("jpa://org.apache.camel.examples.MultiSteps?namedQuery=step1") .to("bean:myBusinessLogic"); ---------------------------------------------------------------------------- -== Using a consumer with a query +=== Using a consumer with a query For consuming only selected entities, you can use the `query` URI query option. You only have to define the query option: @@ -197,7 +198,7 @@ from("jpa://org.apache.camel.examples.MultiSteps?query=select o from org.apache. .to("bean:myBusinessLogic"); --------------------------------------------------------------------------------------------------------------------------------------- -== Using a consumer with a native query +=== Using a consumer with a native query For consuming only selected entities, you can use the `nativeQuery` URI query option. You only have to define the @@ -213,7 +214,7 @@ If you use the native query option, you will receive an object array in the message body. -== Using a producer with a named query +=== Using a producer with a named query For retrieving selected entities or execute bulk update/delete, you can use the `namedQuery` URI query option. First, you have to define the @@ -239,7 +240,7 @@ from("direct:namedQuery") Note that you need to specify `useExecuteUpdate` option to `true` to execute `UPDATE`/`DELETE` statement as a named query. -== Using a producer with a query +=== Using a producer with a query For retrieving selected entities or execute bulk update/delete, you can use the `query` URI query option. You only have to define the query option: @@ -250,7 +251,7 @@ from("direct:query") .to("jpa://org.apache.camel.examples.MultiSteps?query=select o from org.apache.camel.examples.MultiSteps o where o.step = 1"); --------------------------------------------------------------------------------------------------------------------------------------- -== Using a producer with a native query +=== Using a producer with a native query For retrieving selected entities or execute bulk update/delete, you can use the `nativeQuery` URI query option. You only have to define the @@ -265,7 +266,7 @@ from("direct:nativeQuery") If you use the native query option without specifying `resultClass`, you will receive an object array in the message body. -== Using the JPA-Based Idempotent Repository +=== Using the JPA-Based Idempotent Repository The Idempotent Consumer from the http://camel.apache.org/enterprise-integration-patterns.html[EIP patterns] is used to filter out duplicate messages. A JPA-based idempotent repository is provided. @@ -300,12 +301,11 @@ Index: 20, Size: 20 </camelContext> --------------------------------------------------------------- -*When running this Camel component tests inside your IDE* +== Important Development Notes If you run the -https://svn.apache.org/repos/asf/camel/trunk/components/camel-jpa/src/test[tests -of this component] directly inside your IDE, and not through -Maven, then you could see exceptions like these: +https://github.com/apache/camel/tree/main/components/camel-jpa/src/test[tests of this component] +directly inside your IDE, and not through Maven, then you could see exceptions like these: -------------------------------------------------------------------------------------------------------------------------------------------------------- org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is diff --git a/components/camel-jq/src/main/docs/jq-language.adoc b/components/camel-jq/src/main/docs/jq-language.adoc index 5523939e8a7..82ade292985 100644 --- a/components/camel-jq/src/main/docs/jq-language.adoc +++ b/components/camel-jq/src/main/docs/jq-language.adoc @@ -20,28 +20,14 @@ include::partial$language-options.adoc[] // language options: END -== Examples - -For example, you can use JQ in a xref:manual::predicate.adoc[Predicate] with the xref:eips:choice-eip.adoc[Content-Based Router] EIP. - -[source,java] ----- -from("queue:books.new") - .choice() - .when().jq(".store.book.price < 10)") - .to("jms:queue:book.cheap") - .when().jq(".store.book.price < 30)") - .to("jms:queue:book.average") - .otherwise() - .to("jms:queue:book.expensive"); ----- +== Usage -== Message body types +=== Message body types Camel JQ leverages `camel-jackson` for type conversion. To enable camel-jackson POJO type conversion, refer to the Camel Jackson documentation. -== Using header as input +=== Using header as input By default, JQ uses the message body as the input source. However, you can also use a header as input by specifying the `headerName` option. @@ -55,7 +41,7 @@ from("direct:start") .to("mock:result"); ---- -== Camel supplied JQ Functions +=== Camel supplied JQ Functions NOTE: JQ comes with about a hundred built-in functions, and you can see many examples from https://jqlang.github.io/jq/[JQ] documentation. @@ -95,7 +81,7 @@ from("direct:start") .to("mock:result"); ---- -== Transforming a JSon message +=== Transforming a JSon message For basic JSon transformation where you have a fixed structure, you can represent with a combination of using Camel simple and JQ language as: @@ -122,6 +108,22 @@ also make it XML or plain text based: </customer> ---- +== Examples + +For example, you can use JQ in a xref:manual::predicate.adoc[Predicate] with the xref:eips:choice-eip.adoc[Content-Based Router] EIP. + +[source,java] +---- +from("queue:books.new") + .choice() + .when().jq(".store.book.price < 10)") + .to("jms:queue:book.cheap") + .when().jq(".store.book.price < 30)") + .to("jms:queue:book.average") + .otherwise() + .to("jms:queue:book.expensive"); +---- + == Dependencies If you use Maven you could just add the following to your `pom.xml`, substituting the version number for the latest and greatest release (see the download page for the latest versions). diff --git a/components/camel-jslt/src/main/docs/jslt-component.adoc b/components/camel-jslt/src/main/docs/jslt-component.adoc index 9080ed47ea1..5ef7091754c 100644 --- a/components/camel-jslt/src/main/docs/jslt-component.adoc +++ b/components/camel-jslt/src/main/docs/jslt-component.adoc @@ -59,7 +59,9 @@ include::partial$component-endpoint-options.adoc[] include::partial$component-endpoint-headers.adoc[] // component headers: END -== Passing values to JSLT +== Usage + +=== Passing values to JSLT Camel can supply exchange information as variables when applying a JSLT expression on the body. The available variables from the *Exchange* are: diff --git a/components/camel-jsonpath/src/main/docs/jsonpath-language.adoc b/components/camel-jsonpath/src/main/docs/jsonpath-language.adoc index 37e45a1b942..34cdcdb849f 100644 --- a/components/camel-jsonpath/src/main/docs/jsonpath-language.adoc +++ b/components/camel-jsonpath/src/main/docs/jsonpath-language.adoc @@ -22,53 +22,10 @@ using xref:manual::expression.adoc[Expression] or xref:manual::predicate.adoc[Pr include::partial$language-options.adoc[] // language options: END -== Examples +== Usage -For example, you can use JSONPath in a xref:manual::predicate.adoc[Predicate] -with the xref:eips:choice-eip.adoc[Content-Based Router] EIP. -[tabs] -==== - -Java:: -+ -[source,java] ----- -from("queue:books.new") - .choice() - .when().jsonpath("$.store.book[?(@.price < 10)]") - .to("jms:queue:book.cheap") - .when().jsonpath("$.store.book[?(@.price < 30)]") - .to("jms:queue:book.average") - .otherwise() - .to("jms:queue:book.expensive"); ----- - -XML DSL:: -+ -[source,xml] ----- -<route> - <from uri="direct:start"/> - <choice> - <when> - <jsonpath>$.store.book[?(@.price < 10)]</jsonpath> - <to uri="mock:cheap"/> - </when> - <when> - <jsonpath>$.store.book[?(@.price < 30)]</jsonpath> - <to uri="mock:average"/> - </when> - <otherwise> - <to uri="mock:expensive"/> - </otherwise> - </choice> -</route> ----- - -==== - -== JSONPath Syntax +=== JSONPath Syntax Using the JSONPath syntax takes some time to learn, even for basic predicates. So for example, to find out all the cheap books you have to do: @@ -113,8 +70,53 @@ store.book.price < ${header.limit} See the https://github.com/json-path/JsonPath[JSONPath] project page for more syntax examples. +== Examples + +For example, you can use JSONPath in a xref:manual::predicate.adoc[Predicate] +with the xref:eips:choice-eip.adoc[Content-Based Router] EIP. + +[tabs] +==== + +Java:: ++ +[source,java] +---- +from("queue:books.new") + .choice() + .when().jsonpath("$.store.book[?(@.price < 10)]") + .to("jms:queue:book.cheap") + .when().jsonpath("$.store.book[?(@.price < 30)]") + .to("jms:queue:book.average") + .otherwise() + .to("jms:queue:book.expensive"); +---- + +XML DSL:: ++ +[source,xml] +---- +<route> + <from uri="direct:start"/> + <choice> + <when> + <jsonpath>$.store.book[?(@.price < 10)]</jsonpath> + <to uri="mock:cheap"/> + </when> + <when> + <jsonpath>$.store.book[?(@.price < 30)]</jsonpath> + <to uri="mock:average"/> + </when> + <otherwise> + <to uri="mock:expensive"/> + </otherwise> + </choice> +</route> +---- + +==== -== Supported message body types +=== Supported message body types Camel JSONPath supports message body using the following types: @@ -135,7 +137,7 @@ If a message body is of unsupported type, then an exception is thrown by default However, you can configure JSONPath to suppress exceptions (see below) -== Suppressing exceptions +=== Suppressing exceptions By default, jsonpath will throw an exception if the json payload does not have a valid path accordingly to the configured jsonpath expression. In @@ -181,7 +183,7 @@ XML DSL:: This option is also available on the `@JsonPath` annotation. -== Inline Simple expressions +=== Inline Simple expressions It's possible to inlined xref:languages:simple-language.adoc[Simple] language in the JSONPath expression using the simple syntax `$\{xxx}`. @@ -250,7 +252,7 @@ XML DSL:: ==== -== JSONPath injection +=== JSONPath injection You can use xref:manual::bean-integration.adoc[Bean Integration] to invoke a method on a bean and use various languages such as JSONPath (via the `@JsonPath` annotation) @@ -267,7 +269,7 @@ public class Foo { } ---- -== Encoding Detection +=== Encoding Detection The encoding of the JSON document is detected automatically, if the document is encoded in unicode (UTF-8, @@ -277,7 +279,7 @@ you enter the document in String format to JSONPath, or you can specify the encoding in the header `CamelJsonPathJsonEncoding` which is defined as a constant in: `JsonpathConstants.HEADER_JSON_ENCODING`. -== Split JSON data into sub rows as JSON +=== Split JSON data into sub rows as JSON You can use JSONPath to split a JSON document, such as: @@ -306,7 +308,7 @@ from("direct:start") Then each book is logged as a String JSON value. -== Unpack a single-element array into an object +=== Unpack a single-element array into an object It is possible to unpack a single-element array into an object: @@ -319,7 +321,7 @@ from("direct:start") If a book array contains only one book, it will be converted into a Book object. -== Using header as input +=== Using header as input By default, JSONPath uses the message body as the input source. However, you can also use a header as input by specifying the `headerName` option. @@ -351,7 +353,7 @@ The same example in XML DSL would be: </route> ---- -== Transforming a JSon message +=== Transforming a JSon message For basic JSon transformation where you have a fixed structure, you can represent with a combination of using Camel simple and JSonPath language as: diff --git a/components/camel-jt400/src/main/docs/jt400-component.adoc b/components/camel-jt400/src/main/docs/jt400-component.adoc index 98f27dd1575..b514d7008e8 100644 --- a/components/camel-jt400/src/main/docs/jt400-component.adoc +++ b/components/camel-jt400/src/main/docs/jt400-component.adoc @@ -87,12 +87,12 @@ For a message queue provider endpoint, the _In_ message body contents are presumed to be text and sent to the queue as an informational message. Inquiry messages or messages requiring a message ID are not supported. -== Connection pool +=== Connection pool You can explicitly configure a connection pool on the Jt400Component, or as an uri option on the endpoint. -== Program call +=== Program call This endpoint expects the input to be an `Object[]`, whose object types are `int`, `long`, `CharSequence` (such as `String`), or `byte[]`. All other diff --git a/components/camel-jte/src/main/docs/jte-component.adoc b/components/camel-jte/src/main/docs/jte-component.adoc index c0c1d571b0a..157aa5aaccc 100644 --- a/components/camel-jte/src/main/docs/jte-component.adoc +++ b/components/camel-jte/src/main/docs/jte-component.adoc @@ -58,8 +58,9 @@ include::partial$component-endpoint-options.adoc[] // endpoint options: END +== Usage -== JTE Context +=== JTE Context Camel will provide exchange information in the JTE context, as a `org.apache.camel.component.jte.Model` class with the following information: @@ -85,8 +86,7 @@ with the following information: You can set up your custom JTE data model in the message header with the key "*CamelJteDataModel*" just like this - -== 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