http://git-wip-us.apache.org/repos/asf/camel/blob/9f22fab8/camel-core/src/main/docs/eips/dead-letter-channel.adoc ---------------------------------------------------------------------- diff --git a/camel-core/src/main/docs/eips/dead-letter-channel.adoc b/camel-core/src/main/docs/eips/dead-letter-channel.adoc index dc11f9c..4e96819 100644 --- a/camel-core/src/main/docs/eips/dead-letter-channel.adoc +++ b/camel-core/src/main/docs/eips/dead-letter-channel.adoc @@ -1,6 +1,5 @@ [[DeadLetterChannel-DeadLetterChannel]] -Dead Letter Channel -~~~~~~~~~~~~~~~~~~~ +== Dead Letter Channel Camel supports the http://www.enterpriseintegrationpatterns.com/DeadLetterChannel.html[Dead @@ -41,8 +40,7 @@ logs this at WARN level. This can be turned off by setting logNewException=false. [[DeadLetterChannel-Redelivery]] -Redelivery -^^^^^^^^^^ +=== Redelivery It is common for a temporary outage or database deadlock to cause a message to fail to process; but the chances are if its tried a few more @@ -69,8 +67,7 @@ Once all attempts at redelivering the message fails then the message is forwarded to the dead letter queue. [[DeadLetterChannel-AboutmovingExchangetodeadletterqueueandusinghandled]] -About moving Exchange to dead letter queue and using handled -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +=== About moving Exchange to dead letter queue and using handled *Handled* on link:dead-letter-channel.html[Dead Letter Channel] @@ -161,8 +158,7 @@ to the input queue, with no problem as the message is the same as the original we received. [[DeadLetterChannel-OnRedelivery]] -OnRedelivery -^^^^^^^^^^^^ +=== OnRedelivery When link:dead-letter-channel.html[Dead Letter Channel] is doing redeliver its possible to configure a link:processor.html[Processor] @@ -179,8 +175,7 @@ global scope. [[DeadLetterChannel-Redeliverydefaultvalues]] -Redelivery default values -^^^^^^^^^^^^^^^^^^^^^^^^^ +=== Redelivery default values Redelivery is disabled by default. @@ -222,8 +217,7 @@ You can turn logging of stack traces on/off. If turned off Camel will still log the redelivery attempt. Its just much less verbose. [[DeadLetterChannel-RedeliverDelayPattern]] -Redeliver Delay Pattern -+++++++++++++++++++++++ +=== Redeliver Delay Pattern Delay pattern is used as a single option to set a range pattern for delays. If used then the following options does not apply: (delay, @@ -274,8 +268,7 @@ previous. You can use any delay value you like. For example with reduce that to 1 second. [[DeadLetterChannel-Redeliveryheader]] -Redelivery header -^^^^^^^^^^^^^^^^^ +=== Redelivery header When a message is redelivered the http://camel.apache.org/maven/camel-core/apidocs/org/apache/camel/processor/DeadLetterChannel.html[DeadLetterChannel] @@ -299,8 +292,7 @@ also defined on the `Exchange.REDELIVERY_DELAY`. Is this header is absent, normal redelivery rules apply. [[DeadLetterChannel-Whichendpointfailed]] -Which endpoint failed -+++++++++++++++++++++ +=== Which endpoint failed *Available as of Camel 2.1* @@ -355,8 +347,7 @@ Then the `Exchange.TO_ENDPOINT` and `Exchange.FAILURE_ENDPOINT` will still contain the value of `http://someserver/somepath`. [[DeadLetterChannel-OnPrepareFailure]] -OnPrepareFailure -^^^^^^^^^^^^^^^^ +=== OnPrepareFailure *Available as of Camel 2.16* @@ -397,8 +388,7 @@ Configuring this from XML DSL is as shown: The onPrepare is also available using the default error handler. [[DeadLetterChannel-Whichroutefailed]] -Which route failed -^^^^^^^^^^^^^^^^^^ +=== Which route failed *Available as of Camel 2.10.4/2.11* @@ -421,8 +411,7 @@ This allows for example you to fetch this information in your dead letter queue and use that for error reporting. [[DeadLetterChannel-Controlifredeliveryisallowedduringstoppingshutdown]] -Control if redelivery is allowed during stopping/shutdown -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +=== Control if redelivery is allowed during stopping/shutdown *Available as of Camel 2.11* @@ -448,8 +437,7 @@ DSL And the sample sample with XML DSL [[DeadLetterChannel-Samples]] -Samples -^^^^^^^ +=== Samples The following example shows how to configure the Dead Letter Channel configuration using the link:dsl.html[DSL] @@ -459,8 +447,7 @@ http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/proces as this example shows [[DeadLetterChannel-HowcanImodifytheExchangebeforeredelivery]] -How can I modify the Exchange before redelivery? -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +=== How can I modify the Exchange before redelivery? We support directly in link:dead-letter-channel.html[Dead Letter Channel] to set a link:processor.html[Processor] that is executed @@ -480,8 +467,7 @@ And this is the processor `MyRedeliveryProcessor` where we alter the message. [[DeadLetterChannel-HowcanIlogwhatcausedtheDeadLetterChanneltobeinvoked]] -How can I log what caused the Dead Letter Channel to be invoked? -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +=== How can I log what caused the Dead Letter Channel to be invoked? You often need to know what went wrong that caused the Dead Letter Channel to be used and it does not offer logging for this purpose. So @@ -492,8 +478,7 @@ failed Exchange moved to (which might be a DLQ queue for instance). See also http://stackoverflow.com/questions/13711462/logging-camel-exceptions-and-sending-to-the-dead-letter-channel[http://stackoverflow.com/questions/13711462/logging-camel-exceptions-and-sending-to-the-dead-letter-channel] [[DeadLetterChannel-UsingThisPattern]] -Using This Pattern -++++++++++++++++++ +==== Using This Pattern If you would like to use this EIP Pattern then please read the link:getting-started.html[Getting Started], you may also find the
http://git-wip-us.apache.org/repos/asf/camel/blob/9f22fab8/camel-core/src/main/docs/eips/delay-eip.adoc ---------------------------------------------------------------------- diff --git a/camel-core/src/main/docs/eips/delay-eip.adoc b/camel-core/src/main/docs/eips/delay-eip.adoc index d0c317a..8eae05b 100644 --- a/camel-core/src/main/docs/eips/delay-eip.adoc +++ b/camel-core/src/main/docs/eips/delay-eip.adoc @@ -1,4 +1,4 @@ -## Delay EIP +== Delay EIP The Delayer Pattern allows you to delay the delivery of messages to some destination. [NOTE] @@ -16,7 +16,7 @@ See the Spring DSL samples for Delayer. See this ticket: link:https://issues.apache.org/jira/browse/CAMEL-2654[https://issues.apache.org/jira/browse/CAMEL-2654] ==== -## Options +== Options // eip options: START The Delay EIP supports 3 options which are listed below: @@ -67,7 +67,7 @@ And to delay processing using the Simple language you can use the following DSL: from("activemq:someQueue").delay(simple("${body.delayProperty}")).to("activemq:aDelayedQueue"); -------------------------------------------------------- -## Spring DSL +== Spring DSL The sample below demonstrates the delay in Spring DSL: [source,xml] @@ -109,11 +109,11 @@ The sample below demonstrates the delay in Spring DSL: For further examples of this pattern in use you could look at the link:http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DelayerTest.java?view=markup[junit test case]. -## Asynchronous delaying +== Asynchronous delaying *Available as of Camel 2.4* You can let the Delayer use non blocking asynchronous delaying, which means Camel will use a scheduler to schedule a task to be executed in the future. The task will then continue routing. This allows the caller thread to not block and be able to service other messages etc. -### From Java DSL +=== From Java DSL You use the `asyncDelayed()` to enable the async behavior. [source,java] @@ -121,7 +121,7 @@ You use the `asyncDelayed()` to enable the async behavior. from("activemq:queue:foo").delay(1000).asyncDelayed().to("activemq:aDelayedQueue"); -------------------------------------------------------- -### From Spring XML +=== From Spring XML You use the `asyncDelayed="true"` attribute to enable the async behavior. [source,xml] @@ -135,7 +135,7 @@ You use the `asyncDelayed="true"` attribute to enable the async behavior. </route> -------------------------------------------------------- -### Creating a custom delay +=== Creating a custom delay You can use an expression to determine when to send a message using something like this [source,java] @@ -158,8 +158,8 @@ public class SomeBean { } -------------------------------------------------------- -## Using This Pattern +== Using This Pattern If you would like to use this EIP Pattern then please read the Getting Started, you may also find the Architecture useful particularly the description of Endpoint and URIs. Then you could try out some of the Examples first before trying this pattern out. -## See Also +== See Also Delay Interceptor http://git-wip-us.apache.org/repos/asf/camel/blob/9f22fab8/camel-core/src/main/docs/eips/dynamicRouter-eip.adoc ---------------------------------------------------------------------- diff --git a/camel-core/src/main/docs/eips/dynamicRouter-eip.adoc b/camel-core/src/main/docs/eips/dynamicRouter-eip.adoc index d583744..96a80fc 100644 --- a/camel-core/src/main/docs/eips/dynamicRouter-eip.adoc +++ b/camel-core/src/main/docs/eips/dynamicRouter-eip.adoc @@ -1,4 +1,4 @@ -## Dynamic Router EIP +== Dynamic Router EIP The link:http://www.enterpriseintegrationpatterns.com/DynamicRouter.html[Dynamic Router] from the link:../../../../readme-eip.adoc[EIP patterns] allows you to route messages while avoiding the dependency of the router on all possible destinations while maintaining its efficiency. image:http://www.enterpriseintegrationpatterns.com/img/DynamicRouter.gif[image] @@ -11,7 +11,7 @@ In *Camel 2.5* we introduced a dynamicRouter in the DSL which is like a dynamic You must ensure the expression used for the `dynamicRouter` such as a bean, will return `null` to indicate the end. Otherwise the `dynamicRouter` will keep repeating endlessly. ==== -## Options +== Options // eip options: START The Dynamic Router EIP supports 3 options which are listed below: @@ -26,10 +26,10 @@ The Dynamic Router EIP supports 3 options which are listed below: |======================================================================= // eip options: END -## Dynamic Router in Camel 2.5 onwards +== Dynamic Router in Camel 2.5 onwards From Camel 2.5 the Dynamic Router will set a property (Exchange.SLIP_ENDPOINT) on the Exchange which contains the current endpoint as it advanced though the slip. This allows you to know how far we have processed in the slip. (It's a slip because the Dynamic Router implementation is based on top of Routing Slip). -### Java DSL +=== Java DSL In Java DSL you can use the `dynamicRouter` as shown below: [source,java] @@ -116,7 +116,7 @@ You could also store state as message headers, but they are not guaranteed to be Mind that in Camel 2.9.2 or older, when using a Bean the state is not propagated, so you will have to use a Processor instead. This is fixed in Camel 2.9.3 onwards. ==== -### Spring XML +=== Spring XML The same example in Spring XML would be: [source,xml] @@ -140,7 +140,7 @@ The same example in Spring XML would be: </camelContext> -------------------------------------------------------- -### @DynamicRouter annotation +=== @DynamicRouter annotation You can also use the `@DynamicRouter` annotation, for example the Camel 2.4 example below could be written as follows. The `route` method would then be invoked repeatedly as the message is processed dynamically. The idea is to return the next endpoint uri where to go. Return `null` to indicate the end. You can return multiple endpoints if you like, just as the Routing Slip, where each endpoint is separated by a delimiter. @@ -157,7 +157,7 @@ public class MyDynamicRouter { } -------------------------------------------------------- -## Dynamic Router in Camel 2.4 or older +== Dynamic Router in Camel 2.4 or older The simplest way to implement this is to use the RecipientList Annotation on a Bean method to determine where to route the message. [source,java] @@ -180,5 +180,5 @@ The method can be invoked in a number of ways as described in the Bean Integrati * Spring Remoting * Bean component -## Using This Pattern +== Using This Pattern If you would like to use this EIP Pattern then please read the Getting Started, you may also find the Architecture useful particularly the description of Endpoint and URIs. Then you could try out some of the Examples first before trying this pattern out. http://git-wip-us.apache.org/repos/asf/camel/blob/9f22fab8/camel-core/src/main/docs/eips/enrich-eip.adoc ---------------------------------------------------------------------- diff --git a/camel-core/src/main/docs/eips/enrich-eip.adoc b/camel-core/src/main/docs/eips/enrich-eip.adoc index 9f118f2..85eaa9c 100644 --- a/camel-core/src/main/docs/eips/enrich-eip.adoc +++ b/camel-core/src/main/docs/eips/enrich-eip.adoc @@ -1,9 +1,9 @@ -## Enrich EIP +== Enrich EIP Camel supports the Content Enricher from the EIP patterns using a Message Translator, an arbitrary Processor in the routing logic, or using the enrich DSL element to enrich the message. image:http://www.enterpriseintegrationpatterns.com/img/DataEnricher.gif[image] -### Content enrichment using a Message Translator or a Processor +=== Content enrichment using a Message Translator or a Processor *Using the Fluent Builders* You can use Templating to consume a message from one destination, transform it with something like Velocity or XQuery, and then send it on to another destination. For example using InOnly (one way messaging) @@ -67,7 +67,7 @@ For further examples of this pattern in use you could look at one of the JUnit t </route> -------------------------------------------------------- -### Content enrichment using the `enrich` DSL element +=== Content enrichment using the `enrich` DSL element Camel comes with two flavors of content enricher in the DSL @@ -90,7 +90,7 @@ Instead of using enrich you can use Recipient List and have dynamic endpoints an From *Camel 2.16* onwards both `enrich` and `pollEnrich` supports dynamic endpoints that uses an Expression to compute the uri, which allows to use data from the current Exchange. In other words all what is told above no longer apply and it just works. ==== -### Enrich Options +=== Enrich Options [width="100%",cols="3,2,6",options="header"] |======================================================================= | Option | Default Value | Description @@ -184,7 +184,7 @@ The same example in the Spring DSL (Camel 2.16 or newer) <bean id="aggregationStrategy" class="..." /> -------------------------------------------------------- -### Aggregation strategy is optional +=== Aggregation strategy is optional The aggregation strategy is optional. If you do not provide it Camel will by default just use the body obtained from the resource. [source,java] -------------------------------------------------------- @@ -216,7 +216,7 @@ And for Spring DSL (Camel 2.16 or newer) just omit the strategyRef attribute: </route> -------------------------------------------------------- -### Using dynamic uris +=== Using dynamic uris *Available as of Camel 2.16* From Camel 2.16 onwards `enrich` and `pollEnrich` supports using dynamic uris computed based on information from the current Exchange. For example to enrich from a HTTP endpoint where the header with key orderId is used as part of the content-path of the HTTP url: [source,java] @@ -238,14 +238,14 @@ And in XML DSL </route> -------------------------------------------------------- -### Content enrichment using `pollEnrich` +=== Content enrichment using `pollEnrich` The `pollEnrich` works just as the `enrich` however as it uses a Polling Consumer we have 3 methods when polling * `receive` * `receiveNoWait` * `receive(timeout)` -### PollEnrich Options +=== PollEnrich Options // eip options: START The Enrich EIP supports 7 options which are listed below: @@ -287,7 +287,7 @@ The timeout values is in millis. From *Camel 2.16* onwards both `enrich` and `pollEnrich` supports dynamic endpoints that uses an Expression to compute the uri, which allows to use data from the current Exchange. In other words all what is told above no longer apply and it just works. ==== -### Example +=== Example In this example we enrich the message by loading the content from the file named inbox/data.txt. [source,java] @@ -343,7 +343,7 @@ For example to wait up to 5 seconds you can do (Camel 2.16 or newer): </route> -------------------------------------------------------- -### Using dynamic uris +=== Using dynamic uris *Available as of Camel 2.16* From Camel 2.16 onwards `enrich` and `pollEnrich` supports using dynamic uris computed based on information from the current Exchange. For example to `pollEnrich` from an endpoint that uses a header to indicate a SEDA queue name: [source,java] @@ -365,5 +365,5 @@ And in XML DSL </route> -------------------------------------------------------- -### Using This Pattern +=== Using This Pattern If you would like to use this EIP Pattern then please read the Getting Started, you may also find the Architecture useful particularly the description of Endpoint and URIs. Then you could try out some of the Examples first before trying this pattern out. http://git-wip-us.apache.org/repos/asf/camel/blob/9f22fab8/camel-core/src/main/docs/eips/filter-eip.adoc ---------------------------------------------------------------------- diff --git a/camel-core/src/main/docs/eips/filter-eip.adoc b/camel-core/src/main/docs/eips/filter-eip.adoc index 282f63a..e778254 100644 --- a/camel-core/src/main/docs/eips/filter-eip.adoc +++ b/camel-core/src/main/docs/eips/filter-eip.adoc @@ -1,5 +1,5 @@ -## Filter EIP -### Message Filter +== Filter EIP +=== Message Filter The http://www.enterpriseintegrationpatterns.com/Filter.html[Message Filter] from the link:enterprise-integration-patterns.html[EIP patterns] @@ -11,7 +11,7 @@ The following example shows how to create a Message Filter route consuming messages from an endpoint called *queue:a*, which if the link:predicate.html[Predicate] is true will be dispatched to *queue:b* -### EIP options +=== EIP options // eip options: START The Filter EIP supports 0 options which are listed below: @@ -90,7 +90,7 @@ For further examples of this pattern in use you could look at the http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/FilterTest.java?view=markup[junit test case] -#### *Using stop* +#=== *Using stop* Stop is a bit different than a message filter as it will filter out all messages and end the route entirely (filter only applies to its child @@ -102,7 +102,7 @@ In the example below we do not want to route messages any further that has the word `Bye` in the message body. Notice how we prevent this in the when predicate by using the `.stop()`. -#### Knowing if link:exchange.html[Exchange] was filtered or not +#=== Knowing if link:exchange.html[Exchange] was filtered or not *Available as of Camel 2.5* @@ -120,7 +120,7 @@ with the value set based on the results of the last link:message-filter.html[Message Filter] link:predicate.html[Predicate] evaluated. -#### Using This Pattern +#=== Using This Pattern If you would like to use this EIP Pattern then please read the link:getting-started.html[Getting Started], you may also find the http://git-wip-us.apache.org/repos/asf/camel/blob/9f22fab8/camel-core/src/main/docs/eips/hystrix-eip.adoc ---------------------------------------------------------------------- diff --git a/camel-core/src/main/docs/eips/hystrix-eip.adoc b/camel-core/src/main/docs/eips/hystrix-eip.adoc index c060dae..dae81fd 100644 --- a/camel-core/src/main/docs/eips/hystrix-eip.adoc +++ b/camel-core/src/main/docs/eips/hystrix-eip.adoc @@ -1,4 +1,4 @@ -## Hystrix EIP +== Hystrix EIP Available as of Camel 2.18 @@ -15,7 +15,7 @@ Maven users will need to add the following dependency to their pom.xml to use th </dependency> --------------------- -### Configuration options +=== Configuration options // eip options: START The Hystrix EIP supports 2 options which are listed below: @@ -29,7 +29,7 @@ The Hystrix EIP supports 2 options which are listed below: |======================================================================= // eip options: END -### Example +=== Example Below is an example route showing an Hystrix endpoint that protects against slow operation by falling back to the in-lined fallback route. By default the timeout request is just *1000ms* so the HTTP endpoint has to be fairly quick to succeed. [source,java] --------------------- @@ -61,7 +61,7 @@ And in XML DSL: </camelContext> --------------------- -### onFallback vs onFallbackViaNetwork +=== onFallback vs onFallbackViaNetwork If you are using *onFallback* then that is intended to be local processing only where you can do a message transformation or call a bean or something as the fallback. If you need to call an external service over the network then you should use *onFallbackViaNetwork* that runs in another independent *HystrixCommand* that uses its own thread pool to not exhaust the first command. Configuring Hystrix Example Hystrix has many options as listed in the table above. For example to set a higher timeout to *5* seconds, and also let the circuit breaker wait *10* seconds before attempting a request again when the state was tripped to be open. @@ -124,5 +124,5 @@ You can also configure hystrix globally and then refer to that configuration: </camelContext> --------------------- -### Example +=== Example You can find an example in the source code: link:https://github.com/apache/camel/tree/master/examples/camel-example-hystrix[camel-example-hystrix]. http://git-wip-us.apache.org/repos/asf/camel/blob/9f22fab8/camel-core/src/main/docs/eips/hystrixConfiguration-eip.adoc ---------------------------------------------------------------------- diff --git a/camel-core/src/main/docs/eips/hystrixConfiguration-eip.adoc b/camel-core/src/main/docs/eips/hystrixConfiguration-eip.adoc index ca061db..1e2971d 100644 --- a/camel-core/src/main/docs/eips/hystrixConfiguration-eip.adoc +++ b/camel-core/src/main/docs/eips/hystrixConfiguration-eip.adoc @@ -1,4 +1,4 @@ -## Hystrix Configuration EIP +== Hystrix Configuration EIP // eip options: START http://git-wip-us.apache.org/repos/asf/camel/blob/9f22fab8/camel-core/src/main/docs/eips/loadBalance-eip.adoc ---------------------------------------------------------------------- diff --git a/camel-core/src/main/docs/eips/loadBalance-eip.adoc b/camel-core/src/main/docs/eips/loadBalance-eip.adoc index ee6037f..a32a939 100644 --- a/camel-core/src/main/docs/eips/loadBalance-eip.adoc +++ b/camel-core/src/main/docs/eips/loadBalance-eip.adoc @@ -1,7 +1,7 @@ -## Load Balance EIP +== Load Balance EIP The Load Balancer Pattern allows you to delegate to one of a number of endpoints using a variety of different load balancing policies. -## Built-in load balancing policies +== Built-in load balancing policies Camel provides the following policies out-of-the-box: [width="100%",cols="3,6",options="header"] @@ -25,18 +25,18 @@ If you are proxying and load balancing HTTP, then see link:TODO[this] page for m ==== -## Round Robin +== Round Robin The round robin load balancer is not meant to work with failover, for that you should use the dedicated *failover* load balancer. The round robin load balancer will only change to next endpoint per message. The round robin load balancer is stateful as it keeps state of which endpoint to use next time. -### Using the Fluent Builders +=== Using the Fluent Builders [source,java] -------------------------------------------------------- from("direct:start").loadBalance(). roundRobin().to("mock:x", "mock:y", "mock:z"); -------------------------------------------------------- -### Using the Spring configuration +=== Using the Spring configuration [source,xml] -------------------------------------------------------- <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> @@ -56,7 +56,7 @@ The above example loads balance requests from *direct:start* to one of the avail For further examples of this pattern look at link:http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RoundRobinLoadBalanceTest.java?view=markup[this junit test case]. -## Failover +== Failover The failover load balancer is capable of trying the next processor in case an Exchange failed with an exception during processing. You can constrain the failover to activate only when one exception of a list you specify occurs. If you do not specify a list any exception will cause fail over to occur. This balancer uses the same strategy for matching exceptions as the Exception Clause does for the `onException`. @@ -112,7 +112,7 @@ from("direct:foo"). .to("direct:a", "direct:b"); -------------------------------------------------------- -### Using failover in Spring DSL +=== Using failover in Spring DSL Failover can also be used from Spring DSL and you configure it as: [source,xml] -------------------------------------------------------- @@ -129,7 +129,7 @@ Failover can also be used from Spring DSL and you configure it as: </route> -------------------------------------------------------- -### Using failover in round robin mode +=== Using failover in round robin mode An example using Java DSL: [source,java] -------------------------------------------------------- @@ -168,7 +168,7 @@ By disabling the Error Handler you ensure it does not _intervene_ which allows t By also enabling `roundRobin` mode, then it will keep retrying until it success. You can then configure the `maximumFailoverAttempts` option to a high value to let it eventually exhaust (give up) and fail. ==== -## Weighted Round-Robin and Random Load Balancing +== Weighted Round-Robin and Random Load Balancing *Available as of Camel 2.5* In many enterprise environments where server nodes of unequal processing power & performance characteristics are utilized to host services and processing endpoints, it is frequently necessary to distribute processing load based on their individual server capabilities so that some endpoints are not unfairly burdened with requests. Obviously simple round-robin or random load balancing do not alleviate problems of this nature. A Weighted Round-Robin and/or Weighted Random load balancer can be used to address this problem. The weighted load balancing policy allows you to specify a processing load distribution ratio for each server with respect to others. You can specify this as a positive processing weight for each server. A larger number indicates that the server can handle a larger load. The weight is utilized to determine the payload distribution ratio to different processing endpoints with respect to others. @@ -198,7 +198,7 @@ The parameters that can be used are | distributionRatioDelimiter | String | , | The distributionRatioDelimiter is the delimiter used to specify the distributionRatio. If this attribute is not specified a default delimiter "," is expected as the delimiter used for specifying the distributionRatio. |======================================================================= -### Using Weighted round-robin & random load balancing +=== Using Weighted round-robin & random load balancing *In Camel 2.5* An example using Java DSL: http://git-wip-us.apache.org/repos/asf/camel/blob/9f22fab8/camel-core/src/main/docs/eips/log-eip.adoc ---------------------------------------------------------------------- diff --git a/camel-core/src/main/docs/eips/log-eip.adoc b/camel-core/src/main/docs/eips/log-eip.adoc index ea2f757..1354233 100644 --- a/camel-core/src/main/docs/eips/log-eip.adoc +++ b/camel-core/src/main/docs/eips/log-eip.adoc @@ -1,4 +1,4 @@ -## Log EIP +== Log EIP How can I log the processing of a link:message.html[Message]? @@ -24,7 +24,7 @@ The Log EIP supports 5 options which are listed below: // eip options: END -## Using log DSL +== Using log DSL In *Camel 2.2* you can use the log DSL which allows you to use link:simple.html[Simple] language to construct a dynamic message which gets logged. @@ -70,7 +70,7 @@ For example you can use this to log the file name being processed if you consume from("file://target/files").log(LoggingLevel.DEBUG, "Processing file ${file:name}").to("bean:foo"); -------------------------------------------------------- -### Using log DSL from Spring +=== Using log DSL from Spring In Spring DSL it is also easy to use log DSL as shown below: [source,xml] @@ -106,7 +106,7 @@ Since Camel *2.12.4/2.13.1* it is possible to reference logger instance. For exa </route> -------------------------------------------------------- -### Configuring log name globally +=== Configuring log name globally *Available as of Camel 2.17* By default the log name is the route id. If you want to use a different log name, you would need to configure the logName option. However if you have many logs and you want all of them to use the same log name, then you would need to set that logName option on all of them. @@ -127,7 +127,7 @@ And in XML </properties> -------------------------------------------------------- -### Using slf4j Marker +=== Using slf4j Marker *Available as of Camel 2.9* You can specify a marker name in the DSL @@ -140,14 +140,14 @@ You can specify a marker name in the DSL </route> -------------------------------------------------------- -### Using log DSL in OSGi +=== Using log DSL in OSGi *Improvement as of Camel 2.12.4/2.13.1* When using log DSL inside OSGi (e.g., in Karaf), the underlying logging mechanisms are provided by PAX logging. It searches for a bundle which invokes org.slf4j.LoggerFactory.getLogger() method and associates the bundle with the logger instance. Passing only logger name to log DSL results in associating camel-core bundle with the logger instance created. In some scenarios it is required that the bundle associated with logger should be the bundle which contains route definition. This is possible using provided logger instance both for Java DSL and Spring DSL (see the examples above). -### Masking sensitive information like password +=== Masking sensitive information like password *Available as of Camel 2.19* You can enable security masking for logging by setting `logMask` flag to `true`. @@ -186,5 +186,5 @@ If you want to use a custom masking formatter, put it into registry with the nam Note that the masking formatter must implement `org.apache.camel.spi.MaskingFormatter`. -### Using This Pattern +=== Using This Pattern If you would like to use this EIP Pattern then please read the link:getting-started.html[Getting Started], you may also find the link:architecture.html[Architecture] useful particularly the description of link:endpoint.html[Endpoint] and link:uris.html[URIs]. Then you could try out some of the link:examples.html[Examples] first before trying this pattern out. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/9f22fab8/camel-core/src/main/docs/eips/loop-eip.adoc ---------------------------------------------------------------------- diff --git a/camel-core/src/main/docs/eips/loop-eip.adoc b/camel-core/src/main/docs/eips/loop-eip.adoc index 0e85000..c5351cf 100644 --- a/camel-core/src/main/docs/eips/loop-eip.adoc +++ b/camel-core/src/main/docs/eips/loop-eip.adoc @@ -1,4 +1,4 @@ -## Loop EIP +== Loop EIP The Loop allows for processing a message a number of times, possibly in a different way for each iteration. Useful mostly during testing. [NOTE] @@ -7,7 +7,7 @@ The Loop allows for processing a message a number of times, possibly in a differ Notice by default the loop uses the same exchange throughout the looping. So the result from the previous iteration will be used for the next (eg Pipes and Filters). From Camel 2.8 onwards you can enable copy mode instead. See the options table for more details. ==== -### Options +=== Options // eip options: START The Loop EIP supports 2 options which are listed below: @@ -22,7 +22,7 @@ The Loop EIP supports 2 options which are listed below: // eip options: END -### Exchange properties +=== Exchange properties For each iteration two properties are set on the Exchange. Processors can rely on these properties to process the Message in different ways. [width="100%",cols="3,6",options="header"] |======================================================================= @@ -31,10 +31,10 @@ For each iteration two properties are set on the Exchange. Processors can rely o | CamelLoopIndex | Index of the current iteration (0 based) |======================================================================= -### Examples +=== Examples The following example shows how to take a request from the *direct:x* endpoint, then send the message repetitively to *mock:result*. The number of times the message is sent is either passed as an argument to `loop()`, or determined at runtime by evaluating an expression. The expression *must* evaluate to an int, otherwise a `RuntimeCamelException` is thrown. -#### Using the Fluent Builders +#=== Using the Fluent Builders Pass loop count as an argument [source,java] --------------------- @@ -53,7 +53,7 @@ Use expression to determine loop count from("direct:c").loop().xpath("/hello/@times").to("mock:result"); --------------------- -#### Using the Spring XML Extensions +#=== Using the Spring XML Extensions Pass loop count as an argument [source,xml] --------------------- @@ -80,7 +80,7 @@ Use expression to determine loop count For further examples of this pattern in use you could look at one of the junit test case. -#### Using copy mode +#=== Using copy mode *Available as of Camel 2.8* + Now suppose we send a message to "direct:start" endpoint containing the letter A. + The output of processing this route will be that, each "mock:loop" endpoint will receive "AB" as message. @@ -129,7 +129,7 @@ The equivalent example in XML DSL in copy mode is as follows: </route> --------------------- -#### Using while mode +#=== Using while mode *Available as of Camel 2.17* + The loop can act like a while loop that loops until the expression evaluates to false or null. + For example the route below loops while the length of the message body is 5 or less characters. Notice that the DSL uses *loopDoWhile*. @@ -162,5 +162,5 @@ And the same example in XML: Notice in XML that the while loop is turned on using the *doWhile* attribute. -### Using This Pattern +=== Using This Pattern If you would like to use this EIP Pattern then please read the Getting Started, you may also find the Architecture useful particularly the description of Endpoint and URIs. Then you could try out some of the Examples first before trying this pattern out. http://git-wip-us.apache.org/repos/asf/camel/blob/9f22fab8/camel-core/src/main/docs/eips/random-eip.adoc ---------------------------------------------------------------------- diff --git a/camel-core/src/main/docs/eips/random-eip.adoc b/camel-core/src/main/docs/eips/random-eip.adoc index 11d0e88..597bac0 100644 --- a/camel-core/src/main/docs/eips/random-eip.adoc +++ b/camel-core/src/main/docs/eips/random-eip.adoc @@ -1,4 +1,4 @@ -## Random EIP +== Random EIP // eip options: START http://git-wip-us.apache.org/repos/asf/camel/blob/9f22fab8/camel-core/src/main/docs/eips/recipientList-eip.adoc ---------------------------------------------------------------------- diff --git a/camel-core/src/main/docs/eips/recipientList-eip.adoc b/camel-core/src/main/docs/eips/recipientList-eip.adoc index c7d43e7..8c3b159 100644 --- a/camel-core/src/main/docs/eips/recipientList-eip.adoc +++ b/camel-core/src/main/docs/eips/recipientList-eip.adoc @@ -1,11 +1,11 @@ -## Recipient List EIP +== Recipient List EIP The link:http://www.enterpriseintegrationpatterns.com/RecipientList.html[Recipient List] from the EIP patterns allows you to route messages to a number of dynamically specified recipients. image:http://www.enterpriseintegrationpatterns.com/img/RecipientList.gif[image] The recipients will receive a copy of the *same* Exchange, and Camel will execute them sequentially. -### Options +=== Options // eip options: START The Recipient List EIP supports 15 options which are listed below: @@ -33,13 +33,13 @@ The Recipient List EIP supports 15 options which are listed below: // eip options: END -### Static Recipient List +=== Static Recipient List The following example shows how to route a request from an input *queue:a* endpoint to a static list of destinations -#### Using Annotations +#=== Using Annotations You can use the RecipientList Annotation on a POJO to create a Dynamic Recipient List. For more details see the Bean Integration. -#### Using the Fluent Builders +#=== Using the Fluent Builders [source,java] --------------------- @@ -53,7 +53,7 @@ RouteBuilder builder = new RouteBuilder() { }; --------------------- -#### Using the Spring XML Extensions +#=== Using the Spring XML Extensions [source,xml] --------------------- @@ -69,10 +69,10 @@ RouteBuilder builder = new RouteBuilder() { </camelContext> --------------------- -### Dynamic Recipient List +=== Dynamic Recipient List Usually one of the main reasons for using the Recipient List pattern is that the list of recipients is dynamic and calculated at runtime. The following example demonstrates how to create a dynamic recipient list using an Expression (which in this case extracts a named header value dynamically) to calculate the list of endpoints which are either of type Endpoint or are converted to a String and then resolved using the endpoint URIs. -#### Using the Fluent Builders +#=== Using the Fluent Builders [source,java] --------------------- @@ -94,7 +94,7 @@ from("direct:a").recipientList( header("recipientListHeader").tokenize(",")); --------------------- -##### Iteratable value +##=== Iteratable value The dynamic list of recipients that are defined in the header must be iterable such as: * `java.util.Collection` @@ -104,7 +104,7 @@ The dynamic list of recipients that are defined in the header must be iterable s * a single String with values separated by comma * any other type will be regarded as a single value -#### Using the Spring XML Extensions +#=== Using the Spring XML Extensions [source,xml] --------------------- <camelContext errorHandlerRef="errorHandler" xmlns="http://camel.apache.org/schema/spring"> @@ -119,7 +119,7 @@ The dynamic list of recipients that are defined in the header must be iterable s For further examples of this pattern in action you could take a look at one of the junit test cases. -##### Using delimiter in Spring XML +##=== Using delimiter in Spring XML In Spring DSL you can set the delimiter attribute for setting a delimiter to be used if the header value is a single String with multiple separated endpoints. By default Camel uses comma as delimiter, but this option lets you specify a custom delimiter to use instead. [source,xml] @@ -150,7 +150,7 @@ In *Camel 2.1* its a bit easier as you can pass in the delimiter as 2nd paramete from("direct:a").recipientList(header("myHeader"), "#"); --------------------- -### Sending to multiple recipients in parallel +=== Sending to multiple recipients in parallel *Available as of Camel 2.2* + The Recipient List now supports `parallelProcessing` that for example Splitter also supports. You can use it to use a thread pool to have concurrent tasks sending the Exchange to multiple recipients concurrently. @@ -171,7 +171,7 @@ And in Spring XML it is an attribute on the recipient list tag. </route> --------------------- -### Stop continuing in case one recipient failed +=== Stop continuing in case one recipient failed *Available as of Camel 2.2* + The Recipient List now supports `stopOnException` that for example Splitter also supports. You can use it to stop sending to any further recipients in case any recipient failed. @@ -195,7 +195,7 @@ And in Spring XML its an attribute on the recipient list tag. [NOTE] You can combine parallelProcessing and stopOnException and have them both true. -### Ignore invalid endpoints +=== Ignore invalid endpoints *Available as of Camel 2.3* + The Recipient List now supports `ignoreInvalidEndpoints` (like the Routing Slip). You can use it to skip endpoints which are invalid. @@ -219,7 +219,7 @@ And in Spring XML it is an attribute on the recipient list tag. Then let us say the `myHeader` contains the following two endpoints `direct:foo,xxx:bar`. The first endpoint is valid and works. However the second one is invalid and will just be ignored. Camel logs at INFO level about it, so you can see why the endpoint was invalid. -### Using custom `AggregationStrategy` +=== Using custom `AggregationStrategy` *Available as of Camel 2.2* You can now use your own `AggregationStrategy` with the Recipient List. However this is rarely needed. @@ -249,7 +249,7 @@ And in Spring XML it is again an attribute on the recipient list tag. <bean id="myStrategy" class="com.mycompany.MyOwnAggregationStrategy"/> --------------------- -### Knowing which endpoint when using custom `AggregationStrategy` +=== Knowing which endpoint when using custom `AggregationStrategy` Available as of Camel 2.12 When using a custom `AggregationStrategy` then the `aggregate` method is always invoked in sequential order (also if parallel processing is enabled) of the endpoints the Recipient List is using. @@ -265,12 +265,12 @@ public Exchange aggregate(Exchange oldExchange, Exchange newExchange) { } --------------------- -### Using custom thread pool +=== Using custom thread pool *Available as of Camel 2.2* + A thread pool is only used for `parallelProcessing`. You supply your own custom thread pool via the `ExecutorServiceStrategy` (see Camel's Threading Model), the same way you would do it for the `aggregationStrategy`. By default Camel uses a thread pool with 10 threads (subject to change in future versions). -### Using method call as recipient list +=== Using method call as recipient list You can use a Bean to provide the recipients, for example: [source,java] @@ -315,7 +315,7 @@ from("activemq:queue:test").bean(MessageRouter.class, "routeTo"); Which then would invoke the routeTo method and detect that it is annotated with `@RecipientList` and then act accordingly as if it was a recipient list EIP. -### Using timeout +=== Using timeout *Available as of Camel 2.5* + If you use `parallelProcessing` then you can configure a total `timeout` value in millis. Camel will then process the messages in parallel until the timeout is hit. This allows you to continue processing if one message consumer is slow. For example you can set a timeout value of 20 sec. @@ -386,11 +386,11 @@ The timeout is total, which means that after X time, Camel will aggregate the me The remainders will be cancelled. Camel will also only invoke the `timeout` method in the `TimeoutAwareAggregationStrategy` once, for the first index which caused the timeout. ==== -### Using onPrepare to execute custom logic when preparing messages +=== Using onPrepare to execute custom logic when preparing messages *Available as of Camel 2.8* + See details at Multicast -### Using ExchangePattern in recipients +=== Using ExchangePattern in recipients *Available as of Camel 2.15* The recipient list will by default use the current Exchange Pattern. Though one can imagine use-cases where one wants to send a message to a recipient using a different exchange pattern. For example you may have a route that initiates as an InOnly route, but want to use InOut exchange pattern with a recipient list. To do this in earlier Camel releases, you would need to change the exchange pattern before the recipient list, or use onPrepare option to alter the pattern. From Camel 2.15 onwards, you can configure the exchange pattern directly in the recipient endpoints. + @@ -410,5 +410,5 @@ The recipient list will not alter the original exchange pattern. So in the examp If you want to alter the exchange pattern permanently then use the .setExchangePattern option. See more details at Request Reply and Event Message. ==== -### Using This Pattern +=== Using This Pattern If you would like to use this EIP Pattern then please read the Getting Started, you may also find the Architecture useful particularly the description of Endpoint and URIs. Then you could try out some of the Examples first before trying this pattern out. http://git-wip-us.apache.org/repos/asf/camel/blob/9f22fab8/camel-core/src/main/docs/eips/resequence-eip.adoc ---------------------------------------------------------------------- diff --git a/camel-core/src/main/docs/eips/resequence-eip.adoc b/camel-core/src/main/docs/eips/resequence-eip.adoc index 9889df5..df04b10 100644 --- a/camel-core/src/main/docs/eips/resequence-eip.adoc +++ b/camel-core/src/main/docs/eips/resequence-eip.adoc @@ -1,10 +1,10 @@ -## Resequence EIP +== Resequence EIP The link:http://www.enterpriseintegrationpatterns.com/Resequencer.html[Resequencer] from the link:https://camel.apache.org/enterprise-integration-patterns.html[EIP patterns] allows you to reorganise messages based on some comparator. + By default in Camel we use an Expression to create the comparator; so that you can compare by a message header or the body or a piece of a message etc. image:http://www.enterpriseintegrationpatterns.com/img/Resequencer.gif[image] -### Options +=== Options // eip options: START The Resequence EIP supports 1 options which are listed below: @@ -32,10 +32,10 @@ Camel supports two resequencing algorithms: By default the Resequencer does not support duplicate messages and will only keep the last message, in case a message arrives with the same message expression. However in the batch mode you can enable it to allow duplicates. -### Batch Resequencing +=== Batch Resequencing The following example shows how to use the batch-processing resequencer so that messages are sorted in order of the *body()* expression. That is messages are collected into a batch (either by a maximum number of messages per batch or using a timeout) then they are sorted in order and then sent out to their output. -#### Using the Fluent Builders +#=== Using the Fluent Builders [source,java] --------------------- from("direct:start") @@ -79,7 +79,7 @@ resequencer(header("mySeqNo")) for example to reorder messages using a custom sequence number in the header `mySeqNo`. + You can of course use many different Expression languages such as XPath, XQuery, SQL or various Scripting Languages. -#### Using the Spring XML Extensions +#=== Using the Spring XML Extensions [source,xml] --------------------- <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> @@ -97,16 +97,16 @@ You can of course use many different Expression languages such as XPath, XQuery, </camelContext> --------------------- -### Allow Duplicates +=== Allow Duplicates *Available as of Camel 2.4* + In the `batch` mode, you can now allow duplicates. In Java DSL there is a `allowDuplicates()` method and in Spring XML there is an `allowDuplicates=true` attribute on the `<batch-config/>` you can use to enable it. -### Reverse +=== Reverse *Available as of Camel 2.4* + In the `batch` mode, you can now reverse the expression ordering. By default the order is based on 0..9,A..Z, which would let messages with low numbers be ordered first, and thus also also outgoing first. In some cases you want to reverse order, which is now possible. + In Java DSL there is a `reverse()` method and in Spring XML there is an `reverse=true` attribute on the `<batch-config/>` you can use to enable it. -### Resequence JMS messages based on JMSPriority +=== Resequence JMS messages based on JMSPriority *Available as of Camel 2.4* It's now much easier to use the Resequencer to resequence messages from JMS queues based on JMSPriority. For that to work you need to use the two new options `allowDuplicates` and `reverse`. @@ -123,7 +123,7 @@ from("jms:queue:foo") Notice this is *only* possible in the `batch` mode of the Resequencer. -### Ignore invalid exchanges +=== Ignore invalid exchanges *Available as of Camel 2.9* The Resequencer EIP will from Camel 2.9 onwards throw a `CamelExchangeException` if the incoming Exchange is not valid for the resequencer - ie. the expression cannot be evaluated, such as a missing header. @@ -140,7 +140,7 @@ from("direct:start") This option is available for both batch and stream resequencer. -### Reject Old Exchanges +=== Reject Old Exchanges *Available as of Camel 2.11* This option can be used to prevent out of order messages from being sent regardless of the event that delivered messages downstream (capacity, timeout, etc). If enabled using `rejectOld()`, the Resequencer will throw a `MessageRejectedException` when an incoming Exchange is "older" (based on the Comparator) than the last delivered message. This provides an extra level of control with regards to delayed message ordering. @@ -155,10 +155,10 @@ from("direct:start") This option is available for the stream resequencer only. -### Stream Resequencing +=== Stream Resequencing The next example shows how to use the stream-processing resequencer. Messages are re-ordered based on their sequence numbers given by a seqnum header using gap detection and timeouts on the level of individual messages. -#### Using the Fluent Builders +#=== Using the Fluent Builders [source,java] --------------------- @@ -252,8 +252,8 @@ Using the Spring XML Extensions </camelContext> --------------------- -### Further Examples +=== Further Examples For further examples of this pattern in use you could look at the batch-processing resequencer junit test case and the stream-processing resequencer junit test case -### Using This Pattern +=== Using This Pattern If you would like to use this EIP Pattern then please read the Getting Started, you may also find the Architecture useful particularly the description of Endpoint and URIs. Then you could try out some of the Examples first before trying this pattern out. http://git-wip-us.apache.org/repos/asf/camel/blob/9f22fab8/camel-core/src/main/docs/eips/routingSlip-eip.adoc ---------------------------------------------------------------------- diff --git a/camel-core/src/main/docs/eips/routingSlip-eip.adoc b/camel-core/src/main/docs/eips/routingSlip-eip.adoc index 9513cd6..cf83e09 100644 --- a/camel-core/src/main/docs/eips/routingSlip-eip.adoc +++ b/camel-core/src/main/docs/eips/routingSlip-eip.adoc @@ -1,10 +1,10 @@ -## Routing Slip EIP +== Routing Slip EIP The Routing Slip from the link:https://camel.apache.org/enterprise-integration-patterns.html[EIP patterns] allows you to route a message consecutively through a series of processing steps where the sequence of steps is not known at design time and can vary for each message. image:http://www.enterpriseintegrationpatterns.com/img/RoutingTableSimple.gif[image] -### Options +=== Options // eip options: START The Routing Slip EIP supports 3 options which are listed below: @@ -19,7 +19,7 @@ The Routing Slip EIP supports 3 options which are listed below: |======================================================================= // eip options: END -### Example +=== Example The following route will take any messages sent to the Apache ActiveMQ queue SomeQueue and pass them into the Routing Slip pattern. [source,java] @@ -34,16 +34,16 @@ The Message will be routed in a pipeline fashion, i.e., one after the other. Fro The Routing Slip will compute the slip *beforehand* which means, the slip is only computed once. If you need to compute the slip _on-the-fly_ then use the Dynamic Router pattern instead. -### Configuration Options +=== Configuration Options Here we set the header name and the URI delimiter to something different. -#### Using the Fluent Builders +#=== Using the Fluent Builders [source,java] --------------------- from("direct:c").routingSlip(header("aRoutingSlipHeader"), "#"); --------------------- -#### Using the Spring XML Extensions +#=== Using the Spring XML Extensions [source,xml] --------------------- @@ -57,7 +57,7 @@ from("direct:c").routingSlip(header("aRoutingSlipHeader"), "#"); </camelContext> --------------------- -### Ignore Invalid Endpoints +=== Ignore Invalid Endpoints *Available as of Camel 2.3* The Routing Slip now supports ignoreInvalidEndpoints which the Recipient List also supports. You can use it to skip endpoints which are invalid. @@ -82,7 +82,7 @@ And in Spring XML its an attribute on the recipient list tag: Then let's say the myHeader contains the following two endpoints direct:foo,xxx:bar. The first endpoint is valid and works. However the second endpoint is invalid and will just be ignored. Camel logs at INFO level, so you can see why the endpoint was invalid. -### Expression Support +=== Expression Support *Available as of Camel 2.4* The Routing Slip now supports to take the expression parameter as the Recipient List does. You can tell Camel the expression that you want to use to get the routing slip. @@ -106,8 +106,8 @@ And in Spring XML its an attribute on the recipient list tag. </route> --------------------- -### Further Examples +=== Further Examples For further examples of this pattern in use you could look at the routing slip test cases. -### Using This Pattern +=== Using This Pattern If you would like to use this EIP Pattern then please read the Getting Started, you may also find the Architecture useful particularly the description of Endpoint and URIs. Then you could try out some of the Examples first before trying this pattern out. http://git-wip-us.apache.org/repos/asf/camel/blob/9f22fab8/camel-core/src/main/docs/eips/sample-eip.adoc ---------------------------------------------------------------------- diff --git a/camel-core/src/main/docs/eips/sample-eip.adoc b/camel-core/src/main/docs/eips/sample-eip.adoc index a621aa2..9982586 100644 --- a/camel-core/src/main/docs/eips/sample-eip.adoc +++ b/camel-core/src/main/docs/eips/sample-eip.adoc @@ -1,11 +1,11 @@ -## Sample EIP +== Sample EIP *Available as of Camel 2.1* A sampling throttler allows you to extract a sample of the exchanges from the traffic through a route. + It is configured with a sampling period during which only a single exchange is allowed to pass through. All other exchanges will be stopped. Will by default use a sample period of 1 seconds. -### Options +=== Options // eip options: START The Sample EIP supports 3 options which are listed below: @@ -20,10 +20,10 @@ The Sample EIP supports 3 options which are listed below: // eip options: END -### Samples +=== Samples You use this EIP with the `sample` DSL as show in these samples. -#### Using the Fluent Builders +#=== Using the Fluent Builders These samples also show how you can use the different syntax to configure the sampling period: [source,java] @@ -49,7 +49,7 @@ from("direct:sample-messageFrequency-via-dsl") .to("mock:result"); --------------------- -#### Using the Spring XML Extensions +#=== Using the Spring XML Extensions And the same example in Spring XML is: [source,xml] @@ -86,10 +86,10 @@ And since it uses a default of 1 second you can omit this configuration in case </route> --------------------- -### Using This Pattern +=== Using This Pattern If you would like to use this EIP Pattern then please read the Getting Started, you may also find the Architecture useful particularly the description of Endpoint and URIs. Then you could try out some of the Examples first before trying this pattern out. -### See Also +=== See Also * link:./throttle-eip.adoc[Throttler] * link:/aggregator-eip.adoc[Aggregator] http://git-wip-us.apache.org/repos/asf/camel/blob/9f22fab8/camel-core/src/main/docs/eips/script-eip.adoc ---------------------------------------------------------------------- diff --git a/camel-core/src/main/docs/eips/script-eip.adoc b/camel-core/src/main/docs/eips/script-eip.adoc index a577109..41466f4 100644 --- a/camel-core/src/main/docs/eips/script-eip.adoc +++ b/camel-core/src/main/docs/eips/script-eip.adoc @@ -1,4 +1,4 @@ -## Script EIP +== Script EIP *Available as of Camel 2.16* Is used to execute a script which does not change the message (by default). @@ -8,13 +8,13 @@ context has access to the current Exchange and can essentially change the messag But the return value from the script is discarded and not used. If the return value should be used as a changed message body then use link:./message-translator.adoc[Message Translator] EIP instead. -### Options +=== Options // eip options: START The Script EIP supports 0 options which are listed below: // eip options: END -### Using from Java DSL +=== Using from Java DSL The route below will read the file contents and validate them against a regular expression. [source,java] @@ -24,7 +24,7 @@ from("file://inbox") .to("bean:MyServiceBean.processLine"); --------------------- -### Using from Spring DSL +=== Using from Spring DSL And from XML its easy as well [source,xml] @@ -55,7 +55,7 @@ Mind that you can use CDATA in XML if the groovy scrip uses < > etc <bean id="myServiceBean" class="com.mycompany.MyServiceBean"/> --------------------- -### Using external script files +=== Using external script files You can refer to external script files instead of inlining the script. For example to load a groovy script from the classpath you need to prefix the value with *resource:* as shown: [source,xml] @@ -73,5 +73,5 @@ You can refer to external script files instead of inlining the script. For examp You can also refer to the script from the file system with file: instead of classpath: such as file:/var/myscript.groovy -### Using This Pattern +=== Using This Pattern If you would like to use this EIP Pattern then please read the Getting Started, you may also find the Architecture useful particularly the description of Endpoint and URIs. Then you could try out some of the Examples first before trying this pattern out. http://git-wip-us.apache.org/repos/asf/camel/blob/9f22fab8/camel-core/src/main/docs/eips/serviceCall-eip.adoc ---------------------------------------------------------------------- diff --git a/camel-core/src/main/docs/eips/serviceCall-eip.adoc b/camel-core/src/main/docs/eips/serviceCall-eip.adoc index 1584d64..0127563 100644 --- a/camel-core/src/main/docs/eips/serviceCall-eip.adoc +++ b/camel-core/src/main/docs/eips/serviceCall-eip.adoc @@ -1,4 +1,4 @@ -## Service Call EIP +== Service Call EIP The serviceCall EIP allows to call remote services in a distributed system. The service to call is looked up in a service registry of some sorts such as Kubernetes, Consul, Etcd, Zookeeper, DNS. The EIP separates the configuration of the service registry from the calling of the service. @@ -39,7 +39,7 @@ By default the Service Call EIP uses camel-http4 so assuming that the selected s http4:myhost.com:80 ---- -### Service Name to Camel URI Examples +=== Service Name to Camel URI Examples It is often needed to build more complex Camel URI which may include options or paths which is possible through different options:name: value @@ -89,7 +89,7 @@ from("direct:start") .simple("undertow:http://${header.CamelServiceCallServiceHost}:${header.CamelServiceCallServicePort}/hello"); ---- -### Options +=== Options // eip options: START The Service Call EIP supports 14 options which are listed below: @@ -439,7 +439,7 @@ from("direct:start") </camelContext> ---- -### Load Balancer +=== Load Balancer The Service Call EIP comes with its own Load Balancer which is istantiated by default if a custome one is not configured and glues Service Discovery, Service Filer, Service Chooser and Service Expression togheter to load balance requests among the available services. @@ -522,7 +522,7 @@ Or leveraging XML specific configuration: </camelContext> ---- -### Shared configurations +=== Shared configurations The Service CAll EIP can be configured straight on the route definition or through shared configurations, here an example with two configurations registered in the Camel Context: @@ -575,7 +575,7 @@ rom("direc_:start") .to("mock:result"); ---- -### Spring Boot support +=== Spring Boot support In a Spring-Boot application you can externalize most of the configuration options: @@ -607,7 +607,7 @@ public class MyRouteBuilder implements RouteBuilder { } ---- -### Spring Cloud support +=== Spring Cloud support If you are using Camel in an application based on Spring Cloud, you can leverage Spring Cloud service discovery and load balancing capabilities by adding the Spring Cloud related dependencies (i.e. spring-cloud-consul, spring-cloud-kubernetes) as any Spring Boot/Cloud application in addition to Camel's own camel-spring-cloud dependency. http://git-wip-us.apache.org/repos/asf/camel/blob/9f22fab8/camel-core/src/main/docs/eips/sort-eip.adoc ---------------------------------------------------------------------- diff --git a/camel-core/src/main/docs/eips/sort-eip.adoc b/camel-core/src/main/docs/eips/sort-eip.adoc index b602101..aa7f9a4 100644 --- a/camel-core/src/main/docs/eips/sort-eip.adoc +++ b/camel-core/src/main/docs/eips/sort-eip.adoc @@ -1,9 +1,9 @@ -## Sort EIP +== Sort EIP Sort can be used to sort a message. Imagine you consume text files and before processing each file you want to be sure the content is sorted. Sort will by default sort the body using a default comparator that handles numeric values or uses the string representation. You can provide your own comparator, and even an expression to return the value to be sorted. Sort requires the value returned from the expression evaluation is convertible to `java.util.List` as this is required by the JDK sort operation. -### Options +=== Options // eip options: START The Sort EIP supports 1 options which are listed below: @@ -17,7 +17,7 @@ The Sort EIP supports 1 options which are listed below: // eip options: END -### Using from Java DSL +=== Using from Java DSL In the route below it will read the file content and tokenize by line breaks so each line can be sorted. [source,java] --------------------- @@ -30,7 +30,7 @@ You can pass in your own comparator as a 2nd argument: from("file://inbox").sort(body().tokenize("\n"), new MyReverseComparator()).to("bean:MyServiceBean.processLine"); --------------------- -### Using from Spring DSL +=== Using from Spring DSL In the route below it will read the file content and tokenize by line breaks so each line can be sorted. *Camel 2.7 or better* @@ -93,5 +93,5 @@ And to use our own comparator we can refer to it as a spring bean: Besides `<simple>`, you can supply an expression using any language you like, so long as it returns a list. -### Using This Pattern +=== Using This Pattern If you would like to use this EIP Pattern then please read the Getting Started, you may also find the Architecture useful particularly the description of Endpoint and URIs. Then you could try out some of the Examples first before trying this pattern out. http://git-wip-us.apache.org/repos/asf/camel/blob/9f22fab8/camel-core/src/main/docs/eips/split-eip.adoc ---------------------------------------------------------------------- diff --git a/camel-core/src/main/docs/eips/split-eip.adoc b/camel-core/src/main/docs/eips/split-eip.adoc index ca23453..70ca5fd 100644 --- a/camel-core/src/main/docs/eips/split-eip.adoc +++ b/camel-core/src/main/docs/eips/split-eip.adoc @@ -1,4 +1,4 @@ -## Split EIP +== Split EIP The link:http://www.enterpriseintegrationpatterns.com/patterns/messaging/Sequencer.html[Splitter] from the link:enterprise-integration-patterns.html[EIP patterns] allows you split a message into a number of pieces and process them individually. image:http://www.enterpriseintegrationpatterns.com/img/Sequencer.gif[image] @@ -28,7 +28,7 @@ The Split EIP supports 12 options which are listed below: |======================================================================= // eip options: END -### Exchange properties +=== Exchange properties The following properties are set on each Exchange that are split: [width="100%",cols="3,1m,6",options="header"] @@ -40,10 +40,10 @@ The following properties are set on each Exchange that are split: |======================================================================= -### Examples +=== Examples The following example shows how to take a request from the *direct:a* endpoint the split it into pieces using an Expression, then forward each piece to *direct:b* -#### Using the Fluent Builders +#=== Using the Fluent Builders [source,java] --------------------- @@ -65,7 +65,7 @@ The splitter can use any Expression language so you could use any of the Languag from("activemq:my.queue").split(xpath("//foo/bar")).convertBodyTo(String.class).to("file://some/directory") --------------------- -#### Using the Spring XML Extensions +#=== Using the Spring XML Extensions [source,xml] --------------------- @@ -82,7 +82,7 @@ from("activemq:my.queue").split(xpath("//foo/bar")).convertBodyTo(String.class). For further examples of this pattern in use you could look at one of the junit test case. -### Splitting a Collection, Iterator or Array +=== Splitting a Collection, Iterator or Array A common use case is to split a Collection, Iterator or Array from the message. In the sample below we simply use an Expression to identify the value to split. [source,java] @@ -107,7 +107,7 @@ In Spring XML you can use the Simple language to identify the value to split. </split> --------------------- -### Using Tokenizer from Spring XML Extensions* +=== Using Tokenizer from Spring XML Extensions* You can use the tokenizer expression in the Spring DSL to split bodies or headers using a token. This is a common use-case, so we provided a special *tokenizer* tag for this. In the sample below we split the body using a @ as separator. You can of course use comma or space or even a regex pattern, also set regex=true. @@ -124,7 +124,7 @@ In the sample below we split the body using a @ as separator. You can of course </camelContext> --------------------- -### What the Splitter returns +=== What the Splitter returns *Camel 2.2 or older:* The Splitter will by default return the *last* splitted message. @@ -135,7 +135,7 @@ The Splitter will by default return the original input message. *For all versions* You can override this by suppling your own strategy as an AggregationStrategy. There is a sample on this page (Split aggregate request/reply sample). Notice its the same strategy as the Aggregator supports. This Splitter can be viewed as having a build in light weight Aggregator. -### Parallel execution of distinct 'parts' +=== Parallel execution of distinct 'parts' If you want to execute all parts in parallel you can use special notation of `split()` with two arguments, where the second one is a *boolean* flag if processing should be parallel. e.g. @@ -153,7 +153,7 @@ XPathBuilder xPathBuilder = new XPathBuilder("//foo/bar"); from("activemq:my.queue").split(xPathBuilder).parallelProcessing().to("activemq:my.parts"); --------------------- -### Stream based +=== Stream based [NOTE] .Splitting big XML payloads @@ -180,7 +180,7 @@ from("direct:streaming") .streaming().to("activemq:my.parts") --------------------- -### Streaming big XML payloads using Tokenizer language +=== Streaming big XML payloads using Tokenizer language There are two tokenizers that can be used to tokenize an XML payload. The first tokenizer uses the same principle as in the text tokenizer to scan the XML payload and extract a sequence of tokens. @@ -342,7 +342,7 @@ Note that this StAX based tokenizer's uses StAX Location API and requires a StAX <Start>...<</Start> .... <Start>...</</Start> -------------------------------------------------------- -### Splitting files by grouping N lines together +=== Splitting files by grouping N lines together *Available as of Camel 2.10* The Tokenizer language has a new option group that allows you to group N parts together, for example to split big files into chunks of 1000 lines. @@ -372,10 +372,10 @@ So in the example above the message being sent to the activemq order queue, will The output when using the group option is always a `java.lang.String` type. -### Specifying a custom aggregation strategy +=== Specifying a custom aggregation strategy This is specified similar to the Aggregator. -### Specifying a custom ThreadPoolExecutor +=== Specifying a custom ThreadPoolExecutor You can customize the underlying ThreadPoolExecutor used in the parallel splitter. In the Java DSL try something like this: [source,java] -------------------------------------------------------- @@ -388,7 +388,7 @@ from("activemq:my.queue") .to("activemq:my.parts"); -------------------------------------------------------- -### Using a Pojo to do the splitting +=== Using a Pojo to do the splitting As the Splitter can use any Expression to do the actual splitting we leverage this fact and use a *method* expression to invoke a Bean to get the splitted parts. @@ -472,7 +472,7 @@ public class MySplitterBean { -------------------------------------------------------- -### Split aggregate request/reply sample +=== Split aggregate request/reply sample This sample shows how you can split an Exchange, process each splitted message, aggregate and return a combined response to the original caller using request/reply. The route below illustrates this and how the split supports a *`aggregationStrategy`* to hold the in progress processed messages: @@ -577,7 +577,7 @@ BuildCombinedResponse: (id=1,item=A);(id=2,item=B);(id=3,item=C) Response to caller: Response[(id=1,item=A);(id=2,item=B);(id=3,item=C)] -------------------------------------------------------- -### Stop processing in case of exception +=== Stop processing in case of exception *Available as of Camel 2.1* The Splitter will by default continue to process the entire Exchange even in case of one of the splitted message will thrown an exception during routing. @@ -607,11 +607,11 @@ And using XML DSL you specify it as follows: </route> -------------------------------------------------------- -### Using onPrepare to execute custom logic when preparing messages +=== Using onPrepare to execute custom logic when preparing messages *Available as of Camel 2.8* See details at Multicast -### Sharing unit of work +=== Sharing unit of work *Available as of Camel 2.8* The Splitter will by default not share unit of work between the parent exchange and each splitted exchange. This means each sub exchange has its own individual unit of work. For example you may have an use case, where you want to split a big message. And you want to regard that process as an atomic isolated operation that either is a success or failure. In case of a failure you want that big message to be moved into a dead letter queue. To support this use case, you would have to share the unit of work on the Splitter. @@ -683,5 +683,5 @@ Using this from XML DSL is just as easy as you just have to set the shareUnitOfW So in reality the unit of work is not shared as a single object instance. Instead `SubUnitOfWork` is attached to their parent, and issues callback to the parent about their status (commit or rollback). This may be refactored in Camel 3.0 where larger API changes can be done. ==== -### Using This Pattern +=== Using This Pattern If you would like to use this EIP Pattern then please read the Getting Started, you may also find the Architecture useful particularly the description of Endpoint and URIs. Then you could try out some of the Examples first before trying this pattern out. http://git-wip-us.apache.org/repos/asf/camel/blob/9f22fab8/camel-core/src/main/docs/eips/throttle-eip.adoc ---------------------------------------------------------------------- diff --git a/camel-core/src/main/docs/eips/throttle-eip.adoc b/camel-core/src/main/docs/eips/throttle-eip.adoc index aa37602..0e0b8d5 100644 --- a/camel-core/src/main/docs/eips/throttle-eip.adoc +++ b/camel-core/src/main/docs/eips/throttle-eip.adoc @@ -1,7 +1,7 @@ -## Throttle EIP +== Throttle EIP The Throttler Pattern allows you to ensure that a specific endpoint does not get overloaded, or that we don't exceed an agreed SLA with some external service. -### Options +=== Options // eip options: START The Throttle EIP supports 5 options which are listed below: @@ -18,8 +18,8 @@ The Throttle EIP supports 5 options which are listed below: |======================================================================= // eip options: END -### Examples -#### Using the Fluent Builders +=== Examples +#=== Using the Fluent Builders [source,java] --------------------- @@ -36,8 +36,8 @@ from("seda:a").throttle(100).to("seda:b"); For further examples of this pattern in use you could look at the junit test case. -#### Using the Spring XML Extensions -##### Camel 2.7.x or older +#=== Using the Spring XML Extensions +##=== Camel 2.7.x or older [source,xml] --------------------- <route> @@ -48,7 +48,7 @@ For further examples of this pattern in use you could look at the junit test cas </route> --------------------- -##### Camel 2.8 onwards +##=== Camel 2.8 onwards In Camel 2.8 onwards you must set the maximum period as an Expression as shown below where we use a Constant expression: [source,xml] --------------------- @@ -63,7 +63,7 @@ In Camel 2.8 onwards you must set the maximum period as an Expression as shown b </route> --------------------- -### Dynamically changing maximum requests per period +=== Dynamically changing maximum requests per period *Available as of Camel 2.8* Since we use an Expression you can adjust this value at runtime, for example you can provide a header with the value. At runtime Camel evaluates the expression and converts the result to a `java.lang.Long` type. In the example below we use a header from the message to determine the maximum requests per period. If the header is absent, then the Throttler uses the old value. So that allows you to only provide a header if the value is to be changed: @@ -80,7 +80,7 @@ Since we use an Expression you can adjust this value at runtime, for example you </route> --------------------- -### Asynchronous delaying +=== Asynchronous delaying *Available as of Camel 2.4* You can let the Throttler use non blocking asynchronous delaying, which means Camel will use a scheduler to schedule a task to be executed in the future. The task will then continue routing. This allows the caller thread to not block and be able to service other messages, etc. @@ -90,5 +90,5 @@ You can let the Throttler use non blocking asynchronous delaying, which means Ca from("seda:a").throttle(100).asyncDelayed().to("seda:b"); --------------------- -### Using This Pattern +=== Using This Pattern If you would like to use this EIP Pattern then please read the Getting Started, you may also find the Architecture useful particularly the description of Endpoint and URIs. Then you could try out some of the Examples first before trying this pattern out. http://git-wip-us.apache.org/repos/asf/camel/blob/9f22fab8/camel-core/src/main/docs/eips/validate-eip.adoc ---------------------------------------------------------------------- diff --git a/camel-core/src/main/docs/eips/validate-eip.adoc b/camel-core/src/main/docs/eips/validate-eip.adoc index 7e0033c..e962c9d 100644 --- a/camel-core/src/main/docs/eips/validate-eip.adoc +++ b/camel-core/src/main/docs/eips/validate-eip.adoc @@ -1,15 +1,15 @@ -## Validate EIP +== Validate EIP *Available as of Camel 2.3* + Validate uses an expression or predicates to validate the contents of a message. It is useful for ensuring that messages are valid before attempting to process them. + You can use the validate DSL with all kind of Predicates and Expressions. Validate evaluates the Predicate/Expression and if it is false a `PredicateValidationException` is thrown. If it is true message processing continues. -### Options +=== Options // eip options: START The Validate EIP supports 0 options which are listed below: // eip options: END -### Using from Java DSL +=== Using from Java DSL The route below will read the file contents and validate them against a regular expression. [source,java] @@ -37,7 +37,7 @@ from("file://inbox") .to("bean:MyServiceBean.processLine"); --------------------- -### Using from Spring DSL +=== Using from Spring DSL To use validate in the Spring DSL, the easiest way is to use simple expressions. [source,xml] --------------------- @@ -66,5 +66,5 @@ The XML DSL to validate the message header would looks like this: <bean id="myServiceBean" class="com.mycompany.MyServiceBean"/> --------------------- -### Using This Pattern +=== Using This Pattern If you would like to use this EIP Pattern then please read the Getting Started, you may also find the Architecture useful particularly the description of Endpoint and URIs. Then you could try out some of the Examples first before trying this pattern out. http://git-wip-us.apache.org/repos/asf/camel/blob/9f22fab8/camel-core/src/main/docs/exchangeProperty-language.adoc ---------------------------------------------------------------------- diff --git a/camel-core/src/main/docs/exchangeProperty-language.adoc b/camel-core/src/main/docs/exchangeProperty-language.adoc index 86130f5..4437333 100644 --- a/camel-core/src/main/docs/exchangeProperty-language.adoc +++ b/camel-core/src/main/docs/exchangeProperty-language.adoc @@ -5,7 +5,7 @@ The ExchangeProperty Expression Language allows you to extract values of named exchange properties. -### Exchange Property Options +=== Exchange Property Options // language options: START The ExchangeProperty language supports 1 options which are listed below. @@ -19,7 +19,7 @@ The ExchangeProperty language supports 1 options which are listed below. |=== // language options: END -### Example usage +=== Example usage The recipientList element of the Spring DSL can utilize a exchangeProperty expression like: @@ -58,6 +58,6 @@ call) from("direct:a").recipientList().exchangeProperty("myProperty"); ------------------------------------------------------------------ -### Dependencies +=== Dependencies The ExchangeProperty language is part of *camel-core*.