This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new 39ab02a Regen 39ab02a is described below commit 39ab02a61c34a27564e1a4d636203c7718a016cd Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Wed Jan 23 11:41:18 2019 +0100 Regen --- bom/camel-bom/pom.xml | 10 ++ camel-core/readme.adoc | 44 +++++ components/readme.adoc | 2 +- docs/components/modules/ROOT/nav.adoc | 2 + .../modules/ROOT/pages/controlbus-component.adoc | 191 +++++++++++++++++++++ .../modules/ROOT/pages/scheduler-component.adoc | 165 ++++++++++++++++++ .../camel-spring-boot-dependencies/pom.xml | 10 ++ 7 files changed, 423 insertions(+), 1 deletion(-) diff --git a/bom/camel-bom/pom.xml b/bom/camel-bom/pom.xml index 6052274..47b45cc 100644 --- a/bom/camel-bom/pom.xml +++ b/bom/camel-bom/pom.xml @@ -2080,6 +2080,16 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-scheduler</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-scheduler-starter</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-schematron</artifactId> <version>${project.version}</version> </dependency> diff --git a/camel-core/readme.adoc b/camel-core/readme.adoc index 9d6c5f1..2fe4c11 100644 --- a/camel-core/readme.adoc +++ b/camel-core/readme.adoc @@ -6,6 +6,50 @@ // components: START +======= +Number of Components: 12 in 1 JAR artifacts (0 deprecated) + +[width="100%",cols="4,1,5",options="header"] +|=== +| Component | Available From | Description + +| link:src/main/docs/bean-component.adoc[Bean] (camel-core) + +`bean:beanName` | 1.0 | The bean component is for invoking Java beans from Camel. + +| link:src/main/docs/class-component.adoc[Class] (camel-core) + +`class:beanName` | 2.4 | The Class Component is for invoking Java Classes (Java beans) from Camel. + +| link:src/main/docs/dataset-component.adoc[Dataset] (camel-core) + +`dataset:name` | 1.3 | The dataset component provides a mechanism to easily perform load & soak testing of your system. + +| link:src/main/docs/file-component.adoc[File] (camel-core) + +`file:directoryName` | 1.0 | The file component is used for reading or writing files. + +| link:src/main/docs/mock-component.adoc[Mock] (camel-core) + +`mock:name` | 1.0 | The mock component is used for testing routes and mediation rules using mocks. + +| link:src/main/docs/properties-component.adoc[Properties] (camel-core) + +`properties:key` | 2.3 | The properties component is used for using property placeholders in endpoint uris. + +| link:src/main/docs/rest-component.adoc[REST] (camel-core) + +`rest:method:path:uriTemplate` | 2.14 | The rest component is used for either hosting REST services (consumer) or calling external REST services (producer). + +| link:src/main/docs/rest-api-component.adoc[REST API] (camel-core) + +`rest-api:path/contextIdPattern` | 2.16 | The rest-api component is used for providing Swagger API of the REST services which has been defined using the rest-dsl in Camel. + +| link:src/main/docs/saga-component.adoc[Saga] (camel-core) + +`saga:action` | 2.21 | The saga component provides access to advanced options for managing the flow in the Saga EIP. + +| link:src/main/docs/test-component.adoc[Test] (camel-core) + +`test:name` | 1.3 | The test component extends the mock component by on startup to pull messages from another endpoint to set the expected message bodies. + +| link:src/main/docs/validator-component.adoc[Validator] (camel-core) + +`validator:resourceUri` | 1.1 | Validates the payload of a message using XML Schema and JAXP Validation. + +| link:src/main/docs/xslt-component.adoc[XSLT] (camel-core) + +`xslt:resourceUri` | 1.3 | Transforms the message using a XSLT template. + +|=== // components: END diff --git a/components/readme.adoc b/components/readme.adoc index fd08267..179a689 100644 --- a/components/readme.adoc +++ b/components/readme.adoc @@ -172,7 +172,7 @@ Number of Components: 289 in 204 JAR artifacts (0 deprecated) | link:camel-consul/src/main/docs/consul-component.adoc[Consul] (camel-consul) + `consul:apiEndpoint` | 2.18 | The camel consul component allows you to work with Consul, a distributed, highly available, datacenter-aware, service discovery and configuration system. -| link:@@@ARTIFACTID@@@/src/main/docs/controlbus-component.adoc[Control Bus] (@@@ARTIFACTID@@@) + +| link:camel-controlbus/src/main/docs/controlbus-component.adoc[Control Bus] (camel-controlbus) + `controlbus:command:language` | 2.11 | The controlbus component provides easy management of Camel applications based on the Control Bus EIP pattern. | link:camel-corda/src/main/docs/corda-component.adoc[corda] (camel-corda) + diff --git a/docs/components/modules/ROOT/nav.adoc b/docs/components/modules/ROOT/nav.adoc index 633373f..afd13f0 100644 --- a/docs/components/modules/ROOT/nav.adoc +++ b/docs/components/modules/ROOT/nav.adoc @@ -59,6 +59,7 @@ * xref:coap-component.adoc[CoAP Component] * xref:cometd-component.adoc[CometD Component] * xref:consul-component.adoc[Consul Component] +* xref:controlbus-component.adoc[Control Bus Component] * xref:corda-component.adoc[corda Component] * xref:couchbase-component.adoc[Couchbase Component] * xref:couchdb-component.adoc[CouchDB Component] @@ -261,6 +262,7 @@ * xref:sap-netweaver-component.adoc[SAP NetWeaver Component] * xref:xquery-component.adoc[XQuery Component] * xref:xquery-language.adoc[XQuery Language] +* xref:scheduler-component.adoc[Scheduler Component] * xref:schematron-component.adoc[Schematron Component] * xref:javaScript-language.adoc[JavaScript Language (deprecated)] * xref:php-language.adoc[PHP Language (deprecated)] diff --git a/docs/components/modules/ROOT/pages/controlbus-component.adoc b/docs/components/modules/ROOT/pages/controlbus-component.adoc new file mode 100644 index 0000000..593dd00 --- /dev/null +++ b/docs/components/modules/ROOT/pages/controlbus-component.adoc @@ -0,0 +1,191 @@ +[[controlbus-component]] +== Control Bus Component + +*Available as of Camel version 2.11* + +The http://www.eaipatterns.com/ControlBus.html[Control Bus] from the +EIP patterns allows for the +integration system to be monitored and managed from within the +framework. + +image:ControlBus.gif[image] + +Use a Control Bus to manage an enterprise integration system. The +Control Bus uses the same messaging mechanism used by the application +data, but uses separate channels to transmit data that is relevant to +the management of components involved in the message flow. + +In Camel you can manage and monitor using JMX, or +by using a Java API from the `CamelContext`, or from the +`org.apache.camel.api.management` package, + + or use the event notifier which has an example +here. + +From Camel 2.11 onwards we have introduced a new +<<controlbus-component,ControlBus Component>> that allows you to +send messages to a control bus Endpoint that reacts +accordingly. + +=== ControlBus Component + +*Available as of Camel 2.11* + +The *controlbus:* component provides easy management of Camel +applications based on the <<controlbus-component,Control Bus>> EIP +pattern. +For example, by sending a message to an Endpoint +you can control the lifecycle of routes, or gather performance +statistics. + +[source] +---- +controlbus:command[?options] +---- + +Where *command* can be any string to identify which type of command to +use. + +=== Commands + +[width="100%",cols="10%,90%",options="header",] +|=== +|Command |Description + +|`route` |To control routes using the `routeId` and `action` parameter. + +|`language` |Allows you to specify a <<language-component,Language>> to use for +evaluating the message body. If there is any result from the evaluation, +then the result is put in the message body. +|=== + +=== Options + + +// component options: START +The Control Bus component has no options. +// component options: END + + + +// endpoint options: START +The Control Bus endpoint is configured using URI syntax: + +---- +controlbus:command:language +---- + +with the following path and query parameters: + +==== Path Parameters (2 parameters): + + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *command* | *Required* Command can be either route or language | | String +| *language* | Allows you to specify the name of a Language to use for evaluating the message body. If there is any result from the evaluation, then the result is put in the message body. | | Language +|=== + + +==== Query Parameters (6 parameters): + + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *action* (producer) | To denote an action that can be either: start, stop, or status. To either start or stop a route, or to get the status of the route as output in the message body. You can use suspend and resume from Camel 2.11.1 onwards to either suspend or resume a route. And from Camel 2.11.1 onwards you can use stats to get performance statics returned in XML format; the routeId option can be used to define which route to get the performance stats for, if routeId is not defined, [...] +| *async* (producer) | Whether to execute the control bus task asynchronously. Important: If this option is enabled, then any result from the task is not set on the Exchange. This is only possible if executing tasks synchronously. | false | boolean +| *loggingLevel* (producer) | Logging level used for logging when task is done, or if any exceptions occurred during processing the task. | INFO | LoggingLevel +| *restartDelay* (producer) | The delay in millis to use when restarting a route. | 1000 | int +| *routeId* (producer) | To specify a route by its id. The special keyword current indicates the current route. | | String +| *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean +|=== +// endpoint options: END + + +You can append query options to the URI in the following format, +`?option=value&option=value&...` + + +=== Using route command + +The route command allows you to do common tasks on a given route very +easily, for example to start a route, you can send an empty message to +this endpoint: + +[source,java] +---- +template.sendBody("controlbus:route?routeId=foo&action=start", null); +---- + +To get the status of the route, you can do: + +[source,java] +---- +String status = template.requestBody("controlbus:route?routeId=foo&action=status", null, String.class); +---- + +[[ControlBus-Gettingperformancestatistics]] +=== Getting performance statistics + +*Available as of Camel 2.11.1* + +This requires JMX to be enabled (is by default) then you can get the +performance statics per route, or for the +CamelContext. For example to get the statics for +a route named foo, we can do: + +[source,java] +---- +String xml = template.requestBody("controlbus:route?routeId=foo&action=stats", null, String.class); +---- + +The returned statics is in XML format. Its the same data you can get +from JMX with the `dumpRouteStatsAsXml` operation on the +`ManagedRouteMBean`. + +To get statics for the entire CamelContext you +just omit the routeId parameter as shown below: + +[source,java] +---- +String xml = template.requestBody("controlbus:route?action=stats", null, String.class); +---- + +=== Using Simple language + +You can use the <<simple-language,Simple>> language with the control bus, +for example to stop a specific route, you can send a message to the +`"controlbus:language:simple"` endpoint containing the following +message: + +[source,java] +---- +template.sendBody("controlbus:language:simple", "${camelContext.getRouteController().stopRoute('myRoute')}"); +---- + +As this is a void operation, no result is returned. However, if you want +the route status you can do: + +[source,java] +---- +String status = template.requestBody("controlbus:language:simple", "${camelContext.getRouteStatus('myRoute')}", String.class); +---- + +It's easier to use the `route` command to control lifecycle of +routes. The `language` command allows you to execute a language script +that has stronger powers such as <<groovy-language,Groovy>> or to some +extend the <<simple-language,Simple>> language. + +For example to shutdown Camel itself you can do: + +[source,java] +---- +template.sendBody("controlbus:language:simple?async=true", "${camelContext.stop()}"); +---- + +We use `async=true` to stop Camel asynchronously as otherwise we +would be trying to stop Camel while it was in-flight processing the +message we sent to the control bus component. + +TIP: You can also use other languages such as <<groovy-language,Groovy>>, etc. diff --git a/docs/components/modules/ROOT/pages/scheduler-component.adoc b/docs/components/modules/ROOT/pages/scheduler-component.adoc new file mode 100644 index 0000000..daaba42 --- /dev/null +++ b/docs/components/modules/ROOT/pages/scheduler-component.adoc @@ -0,0 +1,165 @@ +[[scheduler-component]] +== Scheduler Component + +*Available as of Camel version 2.15* + +The *scheduler:* component is used to generate message exchanges when a +scheduler fires. This component is similar to the + <<timer-component,Timer>> component, but it offers more functionality in +terms of scheduling. Also this component uses +JDK `ScheduledExecutorService`. Where as the timer uses a JDK `Timer`. + +You can only consume events from this endpoint. + +=== URI format + +[source] +---- +scheduler:name[?options] +---- + +Where `name` is the name of the scheduler, which is created and shared +across endpoints. So if you use the same name for all your scheduler +endpoints, only one scheduler thread pool and thread will be used - but +you can configure the thread pool to allow more concurrent threads. + +You can append query options to the URI in the following format, +`?option=value&option=value&...` + +*Note:* The IN body of the generated exchange is `null`. So +`exchange.getIn().getBody()` returns `null`. + +=== Options + +// component options: START +The Scheduler component supports 2 options, which are listed below. + + + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *concurrentTasks* (scheduler) | Number of threads used by the scheduling thread pool. Is by default using a single thread | 1 | int +| *resolveProperty Placeholders* (advanced) | Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders. | true | boolean +|=== +// component options: END + + +// endpoint options: START +The Scheduler endpoint is configured using URI syntax: + +---- +scheduler:name +---- + +with the following path and query parameters: + +==== Path Parameters (1 parameters): + + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *name* | *Required* The name of the scheduler | | String +|=== + + +==== Query Parameters (20 parameters): + + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean +| *sendEmptyMessageWhenIdle* (consumer) | If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead. | false | boolean +| *exceptionHandler* (consumer) | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. | | ExceptionHandler +| *exchangePattern* (consumer) | Sets the exchange pattern when the consumer creates an exchange. | | ExchangePattern +| *pollStrategy* (consumer) | A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation to control error handling usually occurred during the poll operation before an Exchange have been created and being routed in Camel. | | PollingConsumerPoll Strategy +| *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean +| *backoffErrorThreshold* (scheduler) | The number of subsequent error polls (failed due some error) that should happen before the backoffMultipler should kick-in. | | int +| *backoffIdleThreshold* (scheduler) | The number of subsequent idle polls that should happen before the backoffMultipler should kick-in. | | int +| *backoffMultiplier* (scheduler) | To let the scheduled polling consumer backoff if there has been a number of subsequent idles/errors in a row. The multiplier is then the number of polls that will be skipped before the next actual attempt is happening again. When this option is in use then backoffIdleThreshold and/or backoffErrorThreshold must also be configured. | | int +| *concurrentTasks* (scheduler) | Number of threads used by the scheduling thread pool. Is by default using a single thread | 1 | int +| *delay* (scheduler) | Milliseconds before the next poll. You can also specify time values using units, such as 60s (60 seconds), 5m30s (5 minutes and 30 seconds), and 1h (1 hour). | 500 | long +| *greedy* (scheduler) | If greedy is enabled, then the ScheduledPollConsumer will run immediately again, if the previous run polled 1 or more messages. | false | boolean +| *initialDelay* (scheduler) | Milliseconds before the first poll starts. You can also specify time values using units, such as 60s (60 seconds), 5m30s (5 minutes and 30 seconds), and 1h (1 hour). | 1000 | long +| *runLoggingLevel* (scheduler) | The consumer logs a start/complete log line when it polls. This option allows you to configure the logging level for that. | TRACE | LoggingLevel +| *scheduledExecutorService* (scheduler) | Allows for configuring a custom/shared thread pool to use for the consumer. By default each consumer has its own single threaded thread pool. | | ScheduledExecutor Service +| *scheduler* (scheduler) | To use a cron scheduler from either camel-spring or camel-quartz2 component | none | ScheduledPollConsumer Scheduler +| *schedulerProperties* (scheduler) | To configure additional properties when using a custom scheduler or any of the Quartz2, Spring based scheduler. | | Map +| *startScheduler* (scheduler) | Whether the scheduler should be auto started. | true | boolean +| *timeUnit* (scheduler) | Time unit for initialDelay and delay options. | MILLISECONDS | TimeUnit +| *useFixedDelay* (scheduler) | Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details. | true | boolean +|=== +// endpoint options: END + + +=== More information + +This component is a scheduler +http://camel.apache.org/polling-consumer.html[Polling Consumer] where +you can find more information about the options above, and examples at +the http://camel.apache.org/polling-consumer.html[Polling +Consumer] page. + +=== Exchange Properties + +When the timer is fired, it adds the following information as properties +to the `Exchange`: + +[width="100%",cols="10%,10%,80%",options="header",] +|=== +|Name |Type |Description + +|`Exchange.TIMER_NAME` |`String` |The value of the `name` option. + +|`Exchange.TIMER_FIRED_TIME` |`Date` |The time when the consumer fired. +|=== + +=== Sample + +To set up a route that generates an event every 60 seconds: + +[source,java] +---- +from("scheduler://foo?delay=60s").to("bean:myBean?method=someMethodName"); +---- + +The above route will generate an event and then invoke the +`someMethodName` method on the bean called `myBean` in the +Registry such as JNDI or Spring. + +And the route in Spring DSL: + +[source,xml] +---- +<route> + <from uri="scheduler://foo?delay=60s"/> + <to uri="bean:myBean?method=someMethodName"/> +</route> +---- + +=== Forcing the scheduler to trigger immediately when completed + +To let the scheduler trigger as soon as the previous task is complete, +you can set the option `greedy=true`. But beware then the scheduler will +keep firing all the time. So use this with caution. + +=== Forcing the scheduler to be idle + +There can be use cases where you want the scheduler to trigger and be +greedy. But sometimes you want "tell the scheduler" that there was no +task to poll, so the scheduler can change into idle mode using the +backoff options. To do this you would need to set a property on the +exchange with the key `Exchange.SCHEDULER_POLLED_MESSAGES` to a boolean +value of false. This will cause the consumer to indicate that there was +no messages polled. + +The consumer will otherwise as by default return 1 message polled to the +scheduler, every time the consumer has completed processing the +exchange. + +=== See Also + +* <<timer-component,Timer>> +* <<quartz-component,Quartz>> diff --git a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml index 47f4d48..645379c 100644 --- a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml +++ b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml @@ -2290,6 +2290,16 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-scheduler</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-scheduler-starter</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-schematron</artifactId> <version>${project.version}</version> </dependency>