camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/2] camel git commit: CAMEL-11786: Migrate docs to more correct ascii doc format
Date Thu, 21 Sep 2017 09:26:21 GMT
Repository: camel
Updated Branches:
  refs/heads/master 76f6a3704 -> db22d8468


http://git-wip-us.apache.org/repos/asf/camel/blob/db22d846/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 7e026ca..b9d3d4c 100644
--- a/camel-core/src/main/docs/eips/throttle-eip.adoc
+++ b/camel-core/src/main/docs/eips/throttle-eip.adoc
@@ -1,4 +1,5 @@
 == 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
@@ -18,40 +19,30 @@ The Throttle EIP supports 5 options which are listed below:
 |===
 // eip options: END
 
-=== Examples
-#=== Using the Fluent Builders
+=== Samples
 
 [source,java]
----------------------
-from("seda:a").throttle(3).timePeriodMillis(10000).to("log:result", "mock:result");
----------------------
+----
+from("seda:a")
+  .throttle(3).timePeriodMillis(10000)
+  .to("log:result", "mock:result");
+----
 
 So the above example will throttle messages all messages received on *seda:a* before being
sent to *mock:result* ensuring that a maximum of 3 messages are sent in any 10 second window.
 Note that since `timePeriodMillis` defaults to 1000 milliseconds, just setting the `maximumRequestsPerPeriod`
has the effect of setting the maximum number of requests per second. So to throttle requests
at 100 requests per second between two endpoints, it would look more like this...
 
 [source,java]
----------------------
-from("seda:a").throttle(100).to("seda:b");
----------------------
+----
+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
+And an example in XML
 [source,xml]
----------------------
-<route>
-  <from uri="seda:a" />
-  <throttle maximumRequestsPerPeriod="3" timePeriodMillis="10000">
-    <to uri="mock:result" />
-  </throttle>
-</route>
----------------------
-
-##=== 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]
----------------------
+----
 <route>
   <from uri="seda:a"/>
   <!-- throttle 3 messages per 10 sec -->
@@ -61,14 +52,14 @@ In Camel 2.8 onwards you must set the maximum period as an Expression
as shown b
     <to uri="mock:result"/>
   </throttle>
 </route>
----------------------
+----
 
 === 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:
 [source,xml]
----------------------
+----
 <route>
   <from uri="direct:expressionHeader"/>
   <throttle timePeriodMillis="500">
@@ -78,17 +69,15 @@ Since we use an Expression you can adjust this value at runtime, for example
you
     <to uri="mock:result"/>
   </throttle>
 </route>
----------------------
+----
 
 === 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.
 
 [source,java]
 ---------------------
-from("seda:a").throttle(100).asyncDelayed().to("seda:b");
+from("seda:a")
+  .throttle(100).asyncDelayed()
+  .to("seda:b");
 ---------------------
-
-=== 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/db22d846/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 e962c9d..cd3cb2c 100644
--- a/camel-core/src/main/docs/eips/validate-eip.adoc
+++ b/camel-core/src/main/docs/eips/validate-eip.adoc
@@ -1,7 +1,11 @@
 == 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.
+
+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
 
@@ -9,38 +13,39 @@ You can use the validate DSL with all kind of Predicates and Expressions.
Valida
 The Validate EIP supports 0 options which are listed below:
 // eip options: END
 
-=== Using from Java DSL
+=== Samples
+
 The route below will read the file contents and validate them against a regular expression.
 
 [source,java]
----------------------
+----
 from("file://inbox")
   .validate(body(String.class).regex("^\\w{10}\\,\\d{2}\\,\\w{24}$"))
-.to("bean:MyServiceBean.processLine");
----------------------
+  .to("bean:MyServiceBean.processLine");
+----
 
-Validate is not limited to the message body. You can also validate the message header.
+Validate EIP is not limited to the message body. You can also validate the message header.
 
 [source,java]
----------------------
+----
 from("file://inbox")
   .validate(header("bar").isGreaterThan(100))
-.to("bean:MyServiceBean.processLine");
----------------------
+  .to("bean:MyServiceBean.processLine");
+----
 
 You can also use validate together with simple.
 
 [source,java]
----------------------
+----
 from("file://inbox")
   .validate(simple("${in.header.bar} == 100"))
-.to("bean:MyServiceBean.processLine");
----------------------
+  .to("bean:MyServiceBean.processLine");
+----
 
-=== Using from Spring DSL
 To use validate in the Spring DSL, the easiest way is to use simple expressions.
+
 [source,xml]
----------------------
+----
 <route>
   <from uri="file://inbox"/>
   <validate>
@@ -50,11 +55,12 @@ To use validate in the Spring DSL, the easiest way is to use simple expressions.
 </route>
 
 <bean id="myServiceBean" class="com.mycompany.MyServiceBean"/>
----------------------
+----
 
 The XML DSL to validate the message header would looks like this:
+
 [source,xml]
----------------------
+----
 <route>
   <from uri="file://inbox"/>
   <validate>
@@ -64,7 +70,4 @@ The XML DSL to validate the message header would looks like this:
 </route>
 
 <bean id="myServiceBean" class="com.mycompany.MyServiceBean"/>
----------------------
-
-=== 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.
+----


Mime
View raw message