Author: buildbot
Date: Tue Sep 22 19:20:06 2015
New Revision: 966394

Log:
Production update by buildbot for camel

Modified:
    websites/production/camel/content/book-in-one-page.html
    websites/production/camel/content/book-pattern-appendix.html
    websites/production/camel/content/cache/main.pageCache
    websites/production/camel/content/polling-consumer.html

Modified: websites/production/camel/content/book-in-one-page.html
==============================================================================
--- websites/production/camel/content/book-in-one-page.html (original)
+++ websites/production/camel/content/book-in-one-page.html Tue Sep 22 19:20:06 
2015
@@ -139,7 +139,7 @@ ConnectionFactory connectionFactory = ne
 // Note we can explicit name the component
 context.addComponent("test-jms", 
JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
 ]]></script>
-</div></div><p>The above works with any JMS provider. If we know we are using 
<a shape="rect" href="activemq.html">ActiveMQ</a> we can use an even simpler 
form using the <a shape="rect" class="external-link" 
href="http://activemq.apache.org/maven/5.5.0/activemq-camel/apidocs/org/apache/activemq/camel/component/ActiveMQComponent.html#activeMQComponent%28java.lang.String%29";><code>activeMQComponent()</code>
 method</a> while specifying the <a shape="rect" class="external-link" 
href="http://activemq.apache.org/configuring-transports.html";>brokerURL</a> 
used to connect to ActiveMQ</p><div class="error"><span class="error">Error 
formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, 
Size: 20</span> </div><p>In normal use, an external system would be firing 
messages or events directly into Camel through one if its <a shape="rect" 
href="components.html">Components</a> but we are going to use the <a 
shape="rect" class="external-link" href="http://camel.apache.org/maven/cu
 
rrent/camel-core/apidocs/org/apache/camel/ProducerTemplate.html">ProducerTemplate</a>
 which is a really easy way for testing your configuration:</p><div class="code 
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>The above works with any JMS provider. If we know we are using 
<a shape="rect" href="activemq.html">ActiveMQ</a> we can use an even simpler 
form using the <a shape="rect" class="external-link" 
href="http://activemq.apache.org/maven/5.5.0/activemq-camel/apidocs/org/apache/activemq/camel/component/ActiveMQComponent.html#activeMQComponent%28java.lang.String%29";><code>activeMQComponent()</code>
 method</a> while specifying the <a shape="rect" class="external-link" 
href="http://activemq.apache.org/configuring-transports.html";>brokerURL</a> 
used to connect to ActiveMQ</p>An error occurred: Unable to retrieve the URL: 
https://git-wip-us.apache.org/repos/asf?p=activemq.git;a=blob_plain;hb=HEAD;f=trunk/activemq-camel/src/test/java/org/apache/activemq/camel/component/ActiveMQRouteTest.java
 status code: 404. The error has been recorded.<p>In normal use, an external 
system would be firing messages or events directly into Camel through one if 
its <a shape="rect" href="components.ht
 ml">Components</a> but we are going to use the <a shape="rect" 
class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/ProducerTemplate.html";>ProducerTemplate</a>
 which is a really easy way for testing your configuration:</p><div class="code 
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 ProducerTemplate template = context.createProducerTemplate();
 ]]></script>
@@ -3694,11 +3694,11 @@ The tutorial has been designed in two pa
 While not actual tutorials you might find working through the source of the 
various <a shape="rect" href="examples.html">Examples</a> useful.</li></ul>
 
 <h2 id="BookInOnePage-TutorialonSpringRemotingwithJMS">Tutorial on Spring 
Remoting with JMS</h2><p>&#160;</p><div class="confluence-information-macro 
confluence-information-macro-information"><p class="title">Thanks</p><span 
class="aui-icon aui-icon-small aui-iconfont-info 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>This tutorial was kindly donated 
to Apache Camel by Martin Gilday.</p></div></div><h2 
id="BookInOnePage-Preface">Preface</h2><p>This tutorial aims to guide the 
reader through the stages of creating a project which uses Camel to facilitate 
the routing of messages from a JMS queue to a <a shape="rect" 
class="external-link" href="http://www.springramework.org"; 
rel="nofollow">Spring</a> service. The route works in a synchronous fashion 
returning a response to the client.</p><p><style type="text/css">/*<![CDATA[*/
-div.rbtoc1442935091286 {padding: 0px;}
-div.rbtoc1442935091286 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1442935091286 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1442949516751 {padding: 0px;}
+div.rbtoc1442949516751 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1442949516751 li {margin-left: 0px;padding-left: 0px;}
 
-/*]]>*/</style></p><div class="toc-macro rbtoc1442935091286">
+/*]]>*/</style></p><div class="toc-macro rbtoc1442949516751">
 <ul class="toc-indentation"><li><a shape="rect" 
href="#BookInOnePage-TutorialonSpringRemotingwithJMS">Tutorial on Spring 
Remoting with JMS</a></li><li><a shape="rect" 
href="#BookInOnePage-Preface">Preface</a></li><li><a shape="rect" 
href="#BookInOnePage-Prerequisites">Prerequisites</a></li><li><a shape="rect" 
href="#BookInOnePage-Distribution">Distribution</a></li><li><a shape="rect" 
href="#BookInOnePage-About">About</a></li><li><a shape="rect" 
href="#BookInOnePage-CreatetheCamelProject">Create the Camel Project</a>
 <ul class="toc-indentation"><li><a shape="rect" 
href="#BookInOnePage-UpdatethePOMwithDependencies">Update the POM with 
Dependencies</a></li></ul>
 </li><li><a shape="rect" href="#BookInOnePage-WritingtheServer">Writing the 
Server</a>
@@ -5803,11 +5803,11 @@ So we completed the last piece in the pi
 <p>This example has been removed from <strong>Camel 2.9</strong> onwards. 
Apache Axis 1.4 is a very old and unsupported framework. We encourage users to 
use <a shape="rect" href="cxf.html">CXF</a> instead of Axis.</p></div></div>
 
 <style type="text/css">/*<![CDATA[*/
-div.rbtoc1442935091583 {padding: 0px;}
-div.rbtoc1442935091583 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1442935091583 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1442949517018 {padding: 0px;}
+div.rbtoc1442949517018 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1442949517018 li {margin-left: 0px;padding-left: 0px;}
 
-/*]]>*/</style><div class="toc-macro rbtoc1442935091583">
+/*]]>*/</style><div class="toc-macro rbtoc1442949517018">
 <ul class="toc-indentation"><li><a shape="rect" 
href="#BookInOnePage-TutorialusingAxis1.4withApacheCamel">Tutorial using Axis 
1.4 with Apache Camel</a>
 <ul class="toc-indentation"><li><a shape="rect" 
href="#BookInOnePage-Prerequisites">Prerequisites</a></li><li><a shape="rect" 
href="#BookInOnePage-Distribution">Distribution</a></li><li><a shape="rect" 
href="#BookInOnePage-Introduction">Introduction</a></li><li><a shape="rect" 
href="#BookInOnePage-SettinguptheprojecttorunAxis">Setting up the project to 
run Axis</a>
 <ul class="toc-indentation"><li><a shape="rect" 
href="#BookInOnePage-Maven2">Maven 2</a></li><li><a shape="rect" 
href="#BookInOnePage-wsdl">wsdl</a></li><li><a shape="rect" 
href="#BookInOnePage-ConfiguringAxis">Configuring Axis</a></li><li><a 
shape="rect" href="#BookInOnePage-RunningtheExample">Running the 
Example</a></li></ul>
@@ -14359,7 +14359,16 @@ from(&quot;seda:a&quot;).throttle(3).tim
 </div></div><p>So the above example will throttle messages all messages 
received on <strong>seda:a</strong> before being sent to 
<strong>mock:result</strong> ensuring that a maximum of 3 messages are sent in 
any 10 second window.</p><p>Note that since <code>timePeriodMillis</code> 
defaults to 1000 milliseconds, just setting the 
<code>maximumRequestsPerPeriod</code> 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...</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[from(&quot;seda:a&quot;).throttle(100).to(&quot;seda:b&quot;);
 ]]></script>
-</div></div><p>For further examples of this pattern in use you could look at 
the <a shape="rect" class="external-link" 
href="http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThrottlerTest.java?view=markup";>junit
 test case</a></p><p><strong>Using the <a shape="rect" 
href="spring-xml-extensions.html">Spring XML Extensions</a></strong></p><h4 
id="BookInOnePage-Camel2.7.xorolder">Camel 2.7.x or older</h4><div 
class="error"><span class="error">Error formatting macro: snippet: 
java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> </div><h4 
id="BookInOnePage-Camel2.8onwards">Camel 2.8 onwards</h4><p>In Camel 2.8 
onwards you must set the maximum period as an <a shape="rect" 
href="expression.html">Expression</a> as shown below where we use a <a 
shape="rect" href="constant.html">Constant</a> expression:</p><div class="code 
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>For further examples of this pattern in use you could look at 
the <a shape="rect" class="external-link" 
href="http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThrottlerTest.java?view=markup";>junit
 test case</a></p><p><strong>Using the <a shape="rect" 
href="spring-xml-extensions.html">Spring XML Extensions</a></strong></p><h4 
id="BookInOnePage-Camel2.7.xorolder">Camel 2.7.x or older</h4><div class="code 
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+&lt;route&gt;
+  &lt;from uri=&quot;seda:a&quot; /&gt;
+  &lt;throttle maximumRequestsPerPeriod=&quot;3&quot; 
timePeriodMillis=&quot;10000&quot;&gt;
+    &lt;to uri=&quot;mock:result&quot; /&gt;
+  &lt;/throttle&gt;
+&lt;/route&gt;
+]]></script>
+</div></div><h4 id="BookInOnePage-Camel2.8onwards">Camel 2.8 onwards</h4><p>In 
Camel 2.8 onwards you must set the maximum period as an <a shape="rect" 
href="expression.html">Expression</a> as shown below where we use a <a 
shape="rect" href="constant.html">Constant</a> expression:</p><div class="code 
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 &lt;route&gt;
     &lt;from uri=&quot;seda:a&quot;/&gt;
@@ -15642,7 +15651,52 @@ public class SpringConsumerTemplateTest
 
 }
 ]]></script>
-</div></div><h4 id="BookInOnePage-Timerbasedpollingconsumer">Timer based 
polling consumer</h4><p>In this sample we use a <a shape="rect" 
href="timer.html">Timer</a> to schedule a route to be started every 5th second 
and invoke our bean <strong>MyCoolBean</strong> where we implement the business 
logic for the <a shape="rect" href="polling-consumer.html">Polling 
Consumer</a>. Here we want to consume all messages from a JMS queue, process 
the message and send them to the next queue.</p><p>First we setup our route 
as:</p><div class="error"><span class="error">Error formatting macro: snippet: 
java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> </div>And then 
we have out logic in our bean:<div class="error"><span class="error">Error 
formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, 
Size: 20</span> </div><h3 id="BookInOnePage-ScheduledPollComponents">Scheduled 
Poll Components</h3><p>Quite a few inbound Camel endpoints use a scheduled poll 
pattern to rec
 eive messages and push them through the Camel processing routes. That is to 
say externally from the client the endpoint appears to use an <a shape="rect" 
href="event-driven-consumer.html">Event Driven Consumer</a> but internally a 
scheduled poll is used to monitor some kind of state or resource and then fire 
message exchanges.</p><p>Since this a such a common pattern, polling components 
can extend the <a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/impl/ScheduledPollConsumer.html";>ScheduledPollConsumer</a>
 base class which makes it simpler to implement this pattern.</p><p>There is 
also the <a shape="rect" href="quartz.html">Quartz Component</a> which provides 
scheduled delivery of messages using the Quartz enterprise scheduler.</p><p>For 
more details see:</p><ul><li><a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/PollingConsumer.html";>PollingCon
 sumer</a></li><li>Scheduled Polling Components<ul><li><a shape="rect" 
class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/impl/ScheduledPollConsumer.html";>ScheduledPollConsumer</a></li><li><a
 shape="rect" href="scheduler.html">Scheduler</a></li><li><a shape="rect" 
href="atom.html">Atom</a></li><li><a shape="rect" 
href="beanstalk.html">Beanstalk</a></li><li><a shape="rect" 
href="file2.html">File</a></li><li><a shape="rect" 
href="ftp2.html">FTP</a></li><li><a shape="rect" 
href="hbase.html">hbase</a></li><li><a shape="rect" 
href="ibatis.html">iBATIS</a></li><li><a shape="rect" 
href="jpa.html">JPA</a></li><li><a shape="rect" 
href="mail.html">Mail</a></li><li><a shape="rect" 
href="mybatis.html">MyBatis</a></li><li><a shape="rect" 
href="quartz.html">Quartz</a></li><li><a shape="rect" 
href="snmp.html">SNMP</a></li><li><a shape="rect" 
href="aws-s3.html">AWS-S3</a></li><li><a shape="rect" 
href="aws-sqs.html">AWS-SQS</a></li></ul></li></ul><h3
  id="BookInOnePage-ScheduledPollConsumerOptions">ScheduledPollConsumer 
Options</h3><p>The ScheduledPollConsumer supports the following 
options:</p><div class="confluenceTableSmall"><div class="table-wrap"><table 
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Option</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Default</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>pollStrategy</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>A pluggable 
<code>org.apache.camel.PollingConsumerPollingStrategy</code> allowing you to 
provide your custom implementation to control error handling usually occurred 
during the <code>poll</code> operation <strong>before</strong> an <a 
shape="rect" href="exchange.html">Exchange</a> have been created and being 
routed in Camel. In other
  words the error occurred while the polling was gathering information, for 
instance access to a file network failed so Camel cannot access it to scan for 
files. The default implementation will log the caused exception at 
<code>WARN</code> level and ignore it.</p></td></tr><tr><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>sendEmptyMessageWhenIdle</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> If 
the polling consumer did not poll any files, you can enable this option to send 
an empty message (no body) instead.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>startScheduler</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>Whether the scheduler should be 
auto started.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceT
 d"><p><code>initialDelay</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>1000</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Milliseconds before the first poll 
starts.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>delay</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>500</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Milliseconds before the next poll.</p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>useFixedDelay</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Controls if fixed delay or fixed rate is used. See <a 
shape="rect" class="external-link" 
href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ScheduledExecutorService.html";
 rel="nofollow">ScheduledExecutorService</a> in JDK for details. In 
<strong>Camel 2.7.x</strong> or older the defau
 lt value is <code>false</code>. From <strong>Camel 2.8</strong> onwards the 
default value is <code>true</code>.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>timeUnit</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>TimeUnit.MILLISECONDS</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>time unit for 
<code>initialDelay</code> and <code>delay</code> options.</p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>runLoggingLevel</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>TRACE</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>Camel 2.8:</strong> The consumer 
logs a start/complete log line when it polls. This option allows you to 
configure the logging level for that.</p></td></tr><tr><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>scheduledExecutorService</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>null</
 code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>Camel 2.10:</strong> Allows for configuring a 
custom/shared thread pool to use for the consumer. By default each consumer has 
its own single threaded thread pool. This option allows you to share a thread 
pool among multiple consumers.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>greedy</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>Camel 2.10.6/2.11.1:</strong> If greedy is 
enabled, then the ScheduledPollConsumer will run immediately again, if the 
previous run polled 1 or more messages.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>scheduler</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.12:</strong> 
Allow to plugin a custom <code>org.
 apache.camel.spi.ScheduledPollConsumerScheduler</code> to use as the scheduler 
for firing when the polling consumer runs. The default implementation uses the 
<code>ScheduledExecutorService</code> and there is a <a shape="rect" 
href="quartz2.html">Quartz2</a>, and <a shape="rect" 
href="spring.html">Spring</a> based which supports CRON expressions. 
<strong>Notice:</strong> If using a custom scheduler then the options for 
<code>initialDelay</code>, <code>useFixedDelay</code>, <code>timeUnit</code>, 
and <code>scheduledExecutorService</code> may not be in use. Use the text 
<code>quartz2</code> to refer to use the <a shape="rect" 
href="quartz2.html">Quartz2</a> scheduler; and use the text <code>spring</code> 
to use the <a shape="rect" href="spring.html">Spring</a> based; and use the 
text <code>#myScheduler</code> to refer to a custom scheduler by its id in the 
<a shape="rect" href="registry.html">Registry</a>. See <a shape="rect" 
href="quartz2.html">Quartz2</a> page for an example.</p></t
 d></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>scheduler.xxx</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>Camel 2.12:</strong> To configure 
additional properties when using a custom <code>scheduler</code> or any of the 
<a shape="rect" href="quartz2.html">Quartz2</a>, <a shape="rect" 
href="spring.html">Spring</a> based scheduler.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>backoffMultiplier</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.12:</strong> 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 <code>backoffId
 leThreshold</code> and/or <code>backoffErrorThreshold</code> must also be 
configured.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>backoffIdleThreshold</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.12:</strong> 
The number of subsequent idle polls that should happen before the 
<code>backoffMultipler</code> should kick-in.</p></td></tr><tr><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>backoffErrorThreshold</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.12:</strong> 
The number of subsequent error polls (failed due some error) that should happen 
before the <code>backoffMultipler</code> should 
kick-in.</p></td></tr></tbody></table></div></div><h3 
id="BookInOnePage-Usingbackofftolettheschedulerbelessaggressive">Using backoff 
to 
 let the scheduler be less aggressive</h3><p><strong>Available as of Camel 
2.12</strong></p><p>The scheduled <a shape="rect" 
href="polling-consumer.html">Polling Consumer</a> is by default static by using 
the same poll frequency whether or not there is messages to pickup or not. From 
Camel 2.12 onwards you can configure the scheduled <a shape="rect" 
href="polling-consumer.html">Polling Consumer</a> to be more dynamic by using 
backoff. This allows the scheduler to skip N number of polls when it becomes 
idle, or there has been X number of errors in a row. See more details in the 
table above for the <code>backoffXXX</code> options.</p><p>For example to let a 
FTP consumer backoff if its becoming idle for a while you can do:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
+</div></div><h4 id="BookInOnePage-Timerbasedpollingconsumer">Timer based 
polling consumer</h4><p>In this sample we use a <a shape="rect" 
href="timer.html">Timer</a> to schedule a route to be started every 5th second 
and invoke our bean <strong>MyCoolBean</strong> where we implement the business 
logic for the <a shape="rect" href="polling-consumer.html">Polling 
Consumer</a>. Here we want to consume all messages from a JMS queue, process 
the message and send them to the next queue.</p><p>First we setup our route 
as:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+MyCoolBean cool = new MyCoolBean();
+cool.setProducer(template);
+cool.setConsumer(consumer);
+
+from(&quot;timer://foo?period=5000&quot;).bean(cool, 
&quot;someBusinessLogic&quot;);
+
+from(&quot;activemq:queue.foo&quot;).to(&quot;mock:result&quot;);
+]]></script>
+</div></div>And then we have out logic in our bean:<div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+public static class MyCoolBean {
+
+    private int count;
+    private ConsumerTemplate consumer;
+    private ProducerTemplate producer;
+
+    public void setConsumer(ConsumerTemplate consumer) {
+        this.consumer = consumer;
+    }
+
+    public void setProducer(ProducerTemplate producer) {
+        this.producer = producer;
+    }
+
+    public void someBusinessLogic() {
+        // loop to empty queue
+        while (true) {
+            // receive the message from the queue, wait at most 3 sec
+            String msg = 
consumer.receiveBody(&quot;activemq:queue.inbox&quot;, 3000, String.class);
+            if (msg == null) {
+                // no more messages in queue
+                break;
+            }
+
+            // do something with body
+            msg = &quot;Hello &quot; + msg;
+
+            // send it to the next queue
+            producer.sendBodyAndHeader(&quot;activemq:queue.foo&quot;, msg, 
&quot;number&quot;, count++);
+        }
+    }
+}
+]]></script>
+</div></div><h3 id="BookInOnePage-ScheduledPollComponents">Scheduled Poll 
Components</h3><p>Quite a few inbound Camel endpoints use a scheduled poll 
pattern to receive messages and push them through the Camel processing routes. 
That is to say externally from the client the endpoint appears to use an <a 
shape="rect" href="event-driven-consumer.html">Event Driven Consumer</a> but 
internally a scheduled poll is used to monitor some kind of state or resource 
and then fire message exchanges.</p><p>Since this a such a common pattern, 
polling components can extend the <a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/impl/ScheduledPollConsumer.html";>ScheduledPollConsumer</a>
 base class which makes it simpler to implement this pattern.</p><p>There is 
also the <a shape="rect" href="quartz.html">Quartz Component</a> which provides 
scheduled delivery of messages using the Quartz enterprise scheduler.</p><p>For 
more details see
 :</p><ul><li><a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/PollingConsumer.html";>PollingConsumer</a></li><li>Scheduled
 Polling Components<ul><li><a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/impl/ScheduledPollConsumer.html";>ScheduledPollConsumer</a></li><li><a
 shape="rect" href="scheduler.html">Scheduler</a></li><li><a shape="rect" 
href="atom.html">Atom</a></li><li><a shape="rect" 
href="beanstalk.html">Beanstalk</a></li><li><a shape="rect" 
href="file2.html">File</a></li><li><a shape="rect" 
href="ftp2.html">FTP</a></li><li><a shape="rect" 
href="hbase.html">hbase</a></li><li><a shape="rect" 
href="ibatis.html">iBATIS</a></li><li><a shape="rect" 
href="jpa.html">JPA</a></li><li><a shape="rect" 
href="mail.html">Mail</a></li><li><a shape="rect" 
href="mybatis.html">MyBatis</a></li><li><a shape="rect" 
href="quartz.html">Quartz</a></li><li><a shape="r
 ect" href="snmp.html">SNMP</a></li><li><a shape="rect" 
href="aws-s3.html">AWS-S3</a></li><li><a shape="rect" 
href="aws-sqs.html">AWS-SQS</a></li></ul></li></ul><h3 
id="BookInOnePage-ScheduledPollConsumerOptions">ScheduledPollConsumer 
Options</h3><p>The ScheduledPollConsumer supports the following 
options:</p><div class="confluenceTableSmall"><div class="table-wrap"><table 
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Option</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Default</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>pollStrategy</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>A pluggable 
<code>org.apache.camel.PollingConsumerPollingStrategy</code> allowing you to 
provide your custom implementation to control error handling usually occurred 
during
  the <code>poll</code> operation <strong>before</strong> an <a shape="rect" 
href="exchange.html">Exchange</a> have been created and being routed in Camel. 
In other words the error occurred while the polling was gathering information, 
for instance access to a file network failed so Camel cannot access it to scan 
for files. The default implementation will log the caused exception at 
<code>WARN</code> level and ignore it.</p></td></tr><tr><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>sendEmptyMessageWhenIdle</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> If 
the polling consumer did not poll any files, you can enable this option to send 
an empty message (no body) instead.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>startScheduler</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></t
 d><td colspan="1" rowspan="1" class="confluenceTd"><p>Whether the scheduler 
should be auto started.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>initialDelay</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>1000</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Milliseconds before the first poll 
starts.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>delay</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>500</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Milliseconds before the next poll.</p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>useFixedDelay</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Controls if fixed delay or fixed rate is used. See <a 
shape="rect" class="external-link" 
href="http://java.sun.com/j2se/1.5.0/docs/api/jav
 a/util/concurrent/ScheduledExecutorService.html" 
rel="nofollow">ScheduledExecutorService</a> in JDK for details. In 
<strong>Camel 2.7.x</strong> or older the default value is <code>false</code>. 
From <strong>Camel 2.8</strong> onwards the default value is 
<code>true</code>.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>timeUnit</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>TimeUnit.MILLISECONDS</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>time unit for 
<code>initialDelay</code> and <code>delay</code> options.</p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>runLoggingLevel</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>TRACE</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>Camel 2.8:</strong> The consumer 
logs a start/complete log line when it polls. This option allows you to 
configure the logging level for that.</p></td></tr><tr
 ><td colspan="1" rowspan="1" 
 >class="confluenceTd"><p><code>scheduledExecutorService</code></p></td><td 
 >colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td 
 >colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.10:</strong> 
 >Allows for configuring a custom/shared thread pool to use for the consumer. 
 >By default each consumer has its own single threaded thread pool. This option 
 >allows you to share a thread pool among multiple 
 >consumers.</p></td></tr><tr><td colspan="1" rowspan="1" 
 >class="confluenceTd"><p><code>greedy</code></p></td><td colspan="1" 
 >rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td 
 >colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 
 >2.10.6/2.11.1:</strong> If greedy is enabled, then the ScheduledPollConsumer 
 >will run immediately again, if the previous run polled 1 or more 
 >messages.</p></td></tr><tr><td colspan="1" rowspan="1" 
 >class="confluenceTd"><p><code>scheduler</code></p></td><td colspan="1" 
 >rowspan="1" cla
 ss="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>Camel 2.12:</strong> Allow to plugin a custom 
<code>org.apache.camel.spi.ScheduledPollConsumerScheduler</code> to use as the 
scheduler for firing when the polling consumer runs. The default implementation 
uses the <code>ScheduledExecutorService</code> and there is a <a shape="rect" 
href="quartz2.html">Quartz2</a>, and <a shape="rect" 
href="spring.html">Spring</a> based which supports CRON expressions. 
<strong>Notice:</strong> If using a custom scheduler then the options for 
<code>initialDelay</code>, <code>useFixedDelay</code>, <code>timeUnit</code>, 
and <code>scheduledExecutorService</code> may not be in use. Use the text 
<code>quartz2</code> to refer to use the <a shape="rect" 
href="quartz2.html">Quartz2</a> scheduler; and use the text <code>spring</code> 
to use the <a shape="rect" href="spring.html">Spring</a> based; and use the 
text <code>#myScheduler</code> to refer to a c
 ustom scheduler by its id in the <a shape="rect" 
href="registry.html">Registry</a>. See <a shape="rect" 
href="quartz2.html">Quartz2</a> page for an example.</p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>scheduler.xxx</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>Camel 2.12:</strong> To configure 
additional properties when using a custom <code>scheduler</code> or any of the 
<a shape="rect" href="quartz2.html">Quartz2</a>, <a shape="rect" 
href="spring.html">Spring</a> based scheduler.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>backoffMultiplier</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.12:</strong> 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 
<code>backoffIdleThreshold</code> and/or <code>backoffErrorThreshold</code> 
must also be configured.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>backoffIdleThreshold</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.12:</strong> 
The number of subsequent idle polls that should happen before the 
<code>backoffMultipler</code> should kick-in.</p></td></tr><tr><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>backoffErrorThreshold</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.12:</strong> 
The number of subsequent error polls (failed due some error) that should happen 
before the <code>back
 offMultipler</code> should 
kick-in.</p></td></tr></tbody></table></div></div><h3 
id="BookInOnePage-Usingbackofftolettheschedulerbelessaggressive">Using backoff 
to let the scheduler be less aggressive</h3><p><strong>Available as of Camel 
2.12</strong></p><p>The scheduled <a shape="rect" 
href="polling-consumer.html">Polling Consumer</a> is by default static by using 
the same poll frequency whether or not there is messages to pickup or not. From 
Camel 2.12 onwards you can configure the scheduled <a shape="rect" 
href="polling-consumer.html">Polling Consumer</a> to be more dynamic by using 
backoff. This allows the scheduler to skip N number of polls when it becomes 
idle, or there has been X number of errors in a row. See more details in the 
table above for the <code>backoffXXX</code> options.</p><p>For example to let a 
FTP consumer backoff if its becoming idle for a while you can do:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[    
from(&quot;ftp://myserver?username=foo&amp;passowrd=secret?delete=true&amp;delay=5s&amp;backoffMultiplier=6&amp;backoffIdleThreshold=5&quot;)
       .to(&quot;bean:processFile&quot;);
 ]]></script>
@@ -16572,7 +16626,7 @@ from(&quot;file://foo/bar&quot;).
 
 <p>You can configure the <a shape="rect" class="external-link" 
href="http://activemq.apache.org/destination-options.html";>Destination 
Options</a> in the endpoint uri, using the "destination." prefix. For example 
to mark a consumer as exclusive, and set its prefetch size to 50, you can do as 
follows:</p>
 
-<div class="error"><span class="error">Error formatting macro: snippet: 
java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> </div>
+An error occurred: Unable to retrieve the URL: 
https://git-wip-us.apache.org/repos/asf?p=activemq.git;a=blob_plain;hb=HEAD;f=trunk/activemq-camel/src/test/resources/org/apache/activemq/camel/CamelDestinationExclusiveConsumerTest-context.xml
 status code: 404. The error has been recorded.
 
 
 <h3 id="BookInOnePage-ConsumingAdvisoryMessages">Consuming Advisory 
Messages</h3>
@@ -16827,7 +16881,10 @@ bean:beanID[?options]
 
 <p>The object instance that is used to consume messages must be explicitly 
registered with the <a shape="rect" href="registry.html">Registry</a>. For 
example, if you are using Spring you must define the bean in the Spring 
configuration, <code>spring.xml</code>; or if you don't use Spring, by 
registering the bean in JNDI.</p>
 
-<div class="error"><span class="error">Error formatting macro: snippet: 
java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> </div>
+<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+]]></script>
+</div></div>
 
 <p>Once an endpoint has been registered, you can build Camel routes that use 
it to process exchanges.</p>
 
@@ -17509,11 +17566,11 @@ template.send(&quot;direct:alias-verify&
 ]]></script>
 </div></div><p></p><h3 id="BookInOnePage-SeeAlso.28">See Also</h3>
 <ul><li><a shape="rect" href="configuring-camel.html">Configuring 
Camel</a></li><li><a shape="rect" 
href="component.html">Component</a></li><li><a shape="rect" 
href="endpoint.html">Endpoint</a></li><li><a shape="rect" 
href="getting-started.html">Getting Started</a></li></ul><ul><li><a 
shape="rect" href="crypto.html">Crypto</a> Crypto is also available as a <a 
shape="rect" href="data-format.html">Data Format</a></li></ul> <h2 
id="BookInOnePage-CXFComponent">CXF Component</h2><div 
class="confluence-information-macro confluence-information-macro-note"><span 
class="aui-icon aui-icon-small aui-iconfont-warning 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>When using CXF as a consumer, the 
<a shape="rect" href="cxf-bean-component.html">CXF Bean Component</a> allows 
you to factor out how message payloads are received from their processing as a 
RESTful or SOAP web service. This has the potential of using a multitude of 
transports to consume web 
 services. The bean component's configuration is also simpler and provides the 
fastest method to implement web services using Camel and 
CXF.</p></div></div><div class="confluence-information-macro 
confluence-information-macro-tip"><span class="aui-icon aui-icon-small 
aui-iconfont-approve confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>When using CXF in streaming modes 
(see DataFormat option), then also read about <a shape="rect" 
href="stream-caching.html">Stream caching</a>.</p></div></div><p>The 
<strong>cxf:</strong> component provides integration with <a shape="rect" 
href="http://cxf.apache.org";>Apache CXF</a> for connecting to JAX-WS services 
hosted in CXF.</p><p><style type="text/css">/*<![CDATA[*/
-div.rbtoc1442935094739 {padding: 0px;}
-div.rbtoc1442935094739 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1442935094739 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1442949521092 {padding: 0px;}
+div.rbtoc1442949521092 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1442949521092 li {margin-left: 0px;padding-left: 0px;}
 
-/*]]>*/</style></p><div class="toc-macro rbtoc1442935094739">
+/*]]>*/</style></p><div class="toc-macro rbtoc1442949521092">
 <ul class="toc-indentation"><li><a shape="rect" 
href="#BookInOnePage-CXFComponent">CXF Component</a>
 <ul class="toc-indentation"><li><a shape="rect" 
href="#BookInOnePage-URIformat">URI format</a></li><li><a shape="rect" 
href="#BookInOnePage-Options">Options</a>
 <ul class="toc-indentation"><li><a shape="rect" 
href="#BookInOnePage-Thedescriptionsofthedataformats">The descriptions of the 
dataformats</a>
@@ -18952,7 +19009,10 @@ Exchange.FILE_NAME = foo/bye.txt =&gt; /
   &lt;/properties&gt;
 &lt;/persistence-unit&gt;
 ]]></script>
-</div></div>Then we need to setup a Spring <code>jpaTemplate</code> in the 
spring XML file:<div class="error"><span class="error">Error formatting macro: 
snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> 
</div>And finally we can create our JPA idempotent repository in the spring XML 
file as well:<div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+</div></div>Then we need to setup a Spring <code>jpaTemplate</code> in the 
spring XML file:<div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+]]></script>
+</div></div>And finally we can create our JPA idempotent repository in the 
spring XML file as well:<div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 &lt;!-- we define our jpa based idempotent repository we want to use in the 
file consumer --&gt;
 &lt;bean id=&quot;jpaStore&quot; 
class=&quot;org.apache.camel.processor.idempotent.jpa.JpaMessageIdRepository&quot;&gt;
@@ -20798,7 +20858,33 @@ HttpServletRequest response = exchange.g
    Message out = exchange.getOut();
    int responseCode = out.getHeader(Exchange.HTTP_RESPONSE_CODE, 
Integer.class);
 ]]></script>
-</div></div><h3 
id="BookInOnePage-UsingthrowExceptionOnFailure=falsetogetanyresponseback">Using 
<code>throwExceptionOnFailure=false</code> to get any response back</h3><p>In 
the route below we want to route a message that we <a shape="rect" 
href="content-enricher.html">enrich</a> with data returned from a remote HTTP 
call. As we want any response from the remote server, we set the 
<code>throwExceptionOnFailure</code> option to <code>false</code> so we get any 
response in the <code>AggregationStrategy</code>. As the code is based on a 
unit test that simulates a HTTP status code 404, there is some assertion code 
etc.</p><div class="error"><span class="error">Error formatting macro: snippet: 
java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> </div><h3 
id="BookInOnePage-DisablingCookies">Disabling Cookies</h3><p>To disable cookies 
you can set the HTTP Client to ignore cookies by adding this URI option:<br 
clear="none"> <code>httpClient.cookiePolicy=ignoreCookies</code></p><
 h3 id="BookInOnePage-AdvancedUsage">Advanced Usage</h3><p>If you need more 
control over the HTTP producer you should use the <code>HttpComponent</code> 
where you can set various classes to give you custom behavior.</p><h4 
id="BookInOnePage-SettingMaxConnectionsPerHost">Setting 
MaxConnectionsPerHost</h4><p>The <a shape="rect" href="http.html">HTTP</a> 
Component has a 
<code>org.apache.commons.httpclient.HttpConnectionManager</code> where you can 
configure various global configuration for the given component.<br 
clear="none"> By global, we mean that any endpoint the component creates has 
the same shared <code>HttpConnectionManager</code>. So, if we want to set a 
different value for the max connection per host, we need to define it on the 
HTTP component and <strong>not</strong> on the endpoint URI that we usually 
use. So here comes:</p><p>First, we define the <code>http</code> component in 
Spring XML. Yes, we use the same scheme name, <code>http</code>, because 
otherwise Camel will auto
 -discover and create the component with default settings. What we need is to 
overrule this so we can set our options. In the sample below we set the max 
connection to 5 instead of the default of 2.</p><div class="error"><span 
class="error">Error formatting macro: snippet: 
java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> </div>And then 
we can just use it as we normally do in our routes:<div class="error"><span 
class="error">Error formatting macro: snippet: 
java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> </div><h4 
id="BookInOnePage-Usingpreemptiveauthentication">Using preemptive 
authentication</h4><p>An end user reported that he had problem with 
authenticating with HTTPS. The problem was eventually resolved when he 
discovered the HTTPS server did not return a HTTP code 401 Authorization 
Required. The solution was to set the following URI option: 
<code>httpClient.authenticationPreemptive=true</code></p><h4 
id="BookInOnePage-Acceptingselfsignedcertificates
 fromremoteserver">Accepting self signed certificates from remote 
server</h4><p>See this <a shape="rect" class="external-link" 
href="http://www.nabble.com/Using-HTTPS-in-camel-http-when-remote-side-has-self-signed-cert-td25916878.html";
 rel="nofollow">link</a> from a mailing list discussion with some code to 
outline how to do this with the Apache Commons HTTP API.</p><h4 
id="BookInOnePage-SettingupSSLforHTTPClient">Setting up SSL for HTTP 
Client</h4><h5 id="BookInOnePage-UsingtheJSSEConfigurationUtility.1">Using the 
JSSE Configuration Utility</h5><p>As of Camel 2.8, the HTTP4 component supports 
SSL/TLS configuration through the <a shape="rect" 
href="camel-configuration-utilities.html">Camel JSSE Configuration 
Utility</a>.&#160; This utility greatly decreases the amount of component 
specific code you need to write and is configurable at the endpoint and 
component levels.&#160; The following examples demonstrate how to use the 
utility with the HTTP4 component.</p><p>The version of the A
 pache HTTP client used in this component resolves SSL/TLS information from a 
global "protocol" registry.&#160; This component provides an implementation, 
<code>org.apache.camel.component.http.SSLContextParametersSecureProtocolSocketFactory</code>,
 of the HTTP client's protocol socket factory in order to support the use of 
the Camel JSSE Configuration utility.&#160; The following example demonstrates 
how to configure the protocol registry and use the registered protocol 
information in a route.</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 
id="BookInOnePage-UsingthrowExceptionOnFailure=falsetogetanyresponseback">Using 
<code>throwExceptionOnFailure=false</code> to get any response back</h3><p>In 
the route below we want to route a message that we <a shape="rect" 
href="content-enricher.html">enrich</a> with data returned from a remote HTTP 
call. As we want any response from the remote server, we set the 
<code>throwExceptionOnFailure</code> option to <code>false</code> so we get any 
response in the <code>AggregationStrategy</code>. As the code is based on a 
unit test that simulates a HTTP status code 404, there is some assertion code 
etc.An error occurred: Unable to retrieve the URL: 
https://git-wip-us.apache.org/repos/asf?p=camel.git;a=blob_plain;hb=HEAD;f=components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySimplifiedHandle404Test.java
 status code: 404. The error has been recorded.</p><h3 
id="BookInOnePage-DisablingCookies">Disabling Cookies</h3><p>To disable cookies 
you can set the
  HTTP Client to ignore cookies by adding this URI option:<br clear="none"> 
<code>httpClient.cookiePolicy=ignoreCookies</code></p><h3 
id="BookInOnePage-AdvancedUsage">Advanced Usage</h3><p>If you need more control 
over the HTTP producer you should use the <code>HttpComponent</code> where you 
can set various classes to give you custom behavior.</p><h4 
id="BookInOnePage-SettingMaxConnectionsPerHost">Setting 
MaxConnectionsPerHost</h4><p>The <a shape="rect" href="http.html">HTTP</a> 
Component has a 
<code>org.apache.commons.httpclient.HttpConnectionManager</code> where you can 
configure various global configuration for the given component.<br 
clear="none"> By global, we mean that any endpoint the component creates has 
the same shared <code>HttpConnectionManager</code>. So, if we want to set a 
different value for the max connection per host, we need to define it on the 
HTTP component and <strong>not</strong> on the endpoint URI that we usually 
use. So here comes:</p><p>First, we define the
  <code>http</code> component in Spring XML. Yes, we use the same scheme name, 
<code>http</code>, because otherwise Camel will auto-discover and create the 
component with default settings. What we need is to overrule this so we can set 
our options. In the sample below we set the max connection to 5 instead of the 
default of 2.</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+&lt;bean id=&quot;http&quot; 
class=&quot;org.apache.camel.component.http.HttpComponent&quot;&gt;
+    &lt;property name=&quot;camelContext&quot; ref=&quot;camel&quot;/&gt;
+    &lt;property name=&quot;httpConnectionManager&quot; 
ref=&quot;myHttpConnectionManager&quot;/&gt;
+&lt;/bean&gt;
+
+&lt;bean id=&quot;myHttpConnectionManager&quot; 
class=&quot;org.apache.commons.httpclient.MultiThreadedHttpConnectionManager&quot;&gt;
+    &lt;property name=&quot;params&quot; 
ref=&quot;myHttpConnectionManagerParams&quot;/&gt;
+&lt;/bean&gt;
+
+&lt;bean id=&quot;myHttpConnectionManagerParams&quot; 
class=&quot;org.apache.commons.httpclient.params.HttpConnectionManagerParams&quot;&gt;
+    &lt;property name=&quot;defaultMaxConnectionsPerHost&quot; 
value=&quot;5&quot;/&gt;
+&lt;/bean&gt;
+
+]]></script>
+</div></div>And then we can just use it as we normally do in our routes:<div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
+<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+&lt;camelContext id=&quot;camel&quot; 
xmlns=&quot;http://camel.apache.org/schema/spring&quot; 
trace=&quot;true&quot;&gt;
+    &lt;route&gt;
+        &lt;from uri=&quot;direct:start&quot;/&gt;
+        &lt;to uri=&quot;http://www.google.com&quot;/&gt;
+        &lt;to uri=&quot;mock:result&quot;/&gt;
+    &lt;/route&gt;
+&lt;/camelContext&gt;
+]]></script>
+</div></div><h4 id="BookInOnePage-Usingpreemptiveauthentication">Using 
preemptive authentication</h4><p>An end user reported that he had problem with 
authenticating with HTTPS. The problem was eventually resolved when he 
discovered the HTTPS server did not return a HTTP code 401 Authorization 
Required. The solution was to set the following URI option: 
<code>httpClient.authenticationPreemptive=true</code></p><h4 
id="BookInOnePage-Acceptingselfsignedcertificatesfromremoteserver">Accepting 
self signed certificates from remote server</h4><p>See this <a shape="rect" 
class="external-link" 
href="http://www.nabble.com/Using-HTTPS-in-camel-http-when-remote-side-has-self-signed-cert-td25916878.html";
 rel="nofollow">link</a> from a mailing list discussion with some code to 
outline how to do this with the Apache Commons HTTP API.</p><h4 
id="BookInOnePage-SettingupSSLforHTTPClient">Setting up SSL for HTTP 
Client</h4><h5 id="BookInOnePage-UsingtheJSSEConfigurationUtility.1">Using the 
JSSE Configur
 ation Utility</h5><p>As of Camel 2.8, the HTTP4 component supports SSL/TLS 
configuration through the <a shape="rect" 
href="camel-configuration-utilities.html">Camel JSSE Configuration 
Utility</a>.&#160; This utility greatly decreases the amount of component 
specific code you need to write and is configurable at the endpoint and 
component levels.&#160; The following examples demonstrate how to use the 
utility with the HTTP4 component.</p><p>The version of the Apache HTTP client 
used in this component resolves SSL/TLS information from a global "protocol" 
registry.&#160; This component provides an implementation, 
<code>org.apache.camel.component.http.SSLContextParametersSecureProtocolSocketFactory</code>,
 of the HTTP client's protocol socket factory in order to support the use of 
the Camel JSSE Configuration utility.&#160; The following example demonstrates 
how to configure the protocol registry and use the registered protocol 
information in a route.</p><div class="code panel pdl" styl
 e="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[KeyStoreParameters ksp = new 
KeyStoreParameters();
 ksp.setResource(&quot;/users/home/server/keystore.jks&quot;);
 ksp.setPassword(&quot;keystorePassword&quot;);
@@ -21582,7 +21668,7 @@ from(&quot;direct:hello&quot;)
     &lt;to uri=&quot;jetty://http://www.google.com&quot;/&gt;
 &lt;route&gt;
 ]]></script>
-</div></div><h3 id="BookInOnePage-ConsumerExample">Consumer Example</h3><p>In 
this sample we define a route that exposes a HTTP service at <code><a 
shape="rect" class="external-link" href="http://localhost:8080/myapp/myservice"; 
rel="nofollow">http://localhost:8080/myapp/myservice</a></code>:</p><div 
class="error"><span class="error">Error formatting macro: snippet: 
java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> </div><div 
class="confluence-information-macro confluence-information-macro-note"><p 
class="title">Usage of localhost</p><span class="aui-icon aui-icon-small 
aui-iconfont-warning confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>When you specify 
<code>localhost</code> in a URL, Camel exposes the endpoint only on the local 
TCP/IP network interface, so it cannot be accessed from outside the machine it 
operates on.</p><p>If you need to expose a Jetty endpoint on a specific network 
interface, the numerical IP address of t
 his interface should be used as the host. If you need to expose a Jetty 
endpoint on all network interfaces, the <code>0.0.0.0</code> address should be 
used.</p></div></div><div class="confluence-information-macro 
confluence-information-macro-tip"><span class="aui-icon aui-icon-small 
aui-iconfont-approve confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>To listen across an entire URI 
prefix, see <a shape="rect" href="how-do-i-let-jetty-match-wildcards.html">How 
do I let Jetty match wildcards</a>.</p></div></div><div 
class="confluence-information-macro confluence-information-macro-tip"><span 
class="aui-icon aui-icon-small aui-iconfont-approve 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>If you actually want to expose 
routes by HTTP and already have a Servlet, you should instead refer to the <a 
shape="rect" 
href="https://cwiki.apache.org/confluence/display/CXF20DOC/Servlet+Transport";>Servlet
 Transp
 ort</a>.</p></div></div><p>&#160;</p><p>Our business logic is implemented in 
the <code>MyBookService</code> class, which accesses the HTTP request contents 
and then returns a response.<br clear="none"> <strong>Note:</strong> The 
<code>assert</code> call appears in this example, because the code is part of 
an unit test.</p><div class="error"><span class="error">Error formatting macro: 
snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> 
</div>The following sample shows a content-based route that routes all requests 
containing the URI parameter, <code>one</code>, to the endpoint, 
<code>mock:one</code>, and all others to <code>mock:other</code>.<div 
class="error"><span class="error">Error formatting macro: snippet: 
java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> </div>So if a 
client sends the HTTP request, <code><a shape="rect" class="external-link" 
href="http://serverUri?one=hello"; 
rel="nofollow">http://serverUri?one=hello</a></code>, the Jetty comp
 onent will copy the HTTP request parameter, <code>one</code> to the exchange's 
<code>in.header</code>. We can then use the <code>simple</code> language to 
route exchanges that contain this header to a specific endpoint and all others 
to another. If we used a language more powerful than <a shape="rect" 
href="simple.html">Simple</a>&#160;(such as <a shape="rect" 
href="el.html">EL</a> or <a shape="rect" href="ognl.html">OGNL</a>)&#160;we 
could also test for the parameter value and do routing based on the header 
value as well.<h3 id="BookInOnePage-SessionSupport">Session Support</h3><p>The 
session support option, <code>sessionSupport</code>, can be used to enable a 
<code>HttpSession</code> object and access the session object while processing 
the exchange. For example, the following route enables sessions:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
+</div></div><h3 id="BookInOnePage-ConsumerExample">Consumer Example</h3><p>In 
this sample we define a route that exposes a HTTP service at <code><a 
shape="rect" class="external-link" href="http://localhost:8080/myapp/myservice"; 
rel="nofollow">http://localhost:8080/myapp/myservice</a></code>:An error 
occurred: Unable to retrieve the URL: 
https://git-wip-us.apache.org/repos/asf?p=camel.git;a=blob_plain;hb=HEAD;f=components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteTest.java
 status code: 404. The error has been recorded.</p><div 
class="confluence-information-macro confluence-information-macro-note"><p 
class="title">Usage of localhost</p><span class="aui-icon aui-icon-small 
aui-iconfont-warning confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>When you specify 
<code>localhost</code> in a URL, Camel exposes the endpoint only on the local 
TCP/IP network interface, so it cannot be accessed from outside the machine it 
oper
 ates on.</p><p>If you need to expose a Jetty endpoint on a specific network 
interface, the numerical IP address of this interface should be used as the 
host. If you need to expose a Jetty endpoint on all network interfaces, the 
<code>0.0.0.0</code> address should be used.</p></div></div><div 
class="confluence-information-macro confluence-information-macro-tip"><span 
class="aui-icon aui-icon-small aui-iconfont-approve 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>To listen across an entire URI 
prefix, see <a shape="rect" href="how-do-i-let-jetty-match-wildcards.html">How 
do I let Jetty match wildcards</a>.</p></div></div><div 
class="confluence-information-macro confluence-information-macro-tip"><span 
class="aui-icon aui-icon-small aui-iconfont-approve 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>If you actually want to expose 
routes by HTTP and already have a Servlet, you should instead refer
  to the <a shape="rect" 
href="https://cwiki.apache.org/confluence/display/CXF20DOC/Servlet+Transport";>Servlet
 Transport</a>.</p></div></div><p>&#160;</p><p>Our business logic is 
implemented in the <code>MyBookService</code> class, which accesses the HTTP 
request contents and then returns a response.<br clear="none"> 
<strong>Note:</strong> The <code>assert</code> call appears in this example, 
because the code is part of an unit test.An error occurred: Unable to retrieve 
the URL: 
https://git-wip-us.apache.org/repos/asf?p=camel.git;a=blob_plain;hb=HEAD;f=components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteTest.java
 status code: 404. The error has been recorded.The following sample shows a 
content-based route that routes all requests containing the URI parameter, 
<code>one</code>, to the endpoint, <code>mock:one</code>, and all others to 
<code>mock:other</code>.</p><div class="error"><span class="error">Error 
formatting macro: snippet: java.lang.IndexOutOfBou
 ndsException: Index: 20, Size: 20</span> </div>So if a client sends the HTTP 
request, <code><a shape="rect" class="external-link" 
href="http://serverUri?one=hello"; 
rel="nofollow">http://serverUri?one=hello</a></code>, the Jetty component will 
copy the HTTP request parameter, <code>one</code> to the exchange's 
<code>in.header</code>. We can then use the <code>simple</code> language to 
route exchanges that contain this header to a specific endpoint and all others 
to another. If we used a language more powerful than <a shape="rect" 
href="simple.html">Simple</a>&#160;(such as <a shape="rect" 
href="el.html">EL</a> or <a shape="rect" href="ognl.html">OGNL</a>)&#160;we 
could also test for the parameter value and do routing based on the header 
value as well.<h3 id="BookInOnePage-SessionSupport">Session Support</h3><p>The 
session support option, <code>sessionSupport</code>, can be used to enable a 
<code>HttpSession</code> object and access the session object while processing 
the exchange. Fo
 r example, the following route enables sessions:</p><div class="code panel 
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;route&gt;
     &lt;from 
uri=&quot;jetty:http://0.0.0.0/myapp/myservice/?sessionSupport=true&quot;/&gt;
     &lt;processRef ref=&quot;myCode&quot;/&gt;


Reply via email to