Author: buildbot
Date: Wed Sep 13 00:57:19 2017
New Revision: 1018085
Log:
Production update by buildbot for camel
Modified:
websites/production/camel/content/book-component-appendix.html
websites/production/camel/content/book-in-one-page.html
websites/production/camel/content/cache/main.pageCache
websites/production/camel/content/properties.html
Modified: websites/production/camel/content/book-component-appendix.html
==============================================================================
--- websites/production/camel/content/book-component-appendix.html (original)
+++ websites/production/camel/content/book-component-appendix.html Wed Sep 13
00:57:19 2017
@@ -200,17 +200,17 @@ droppable = false
<version>5.6.0</version>
</dependency>
</plain-text-body><p><parameter ac:name=""><a shape="rect"
href="endpoint-see-also.html">Endpoint See Also</a></parameter></p> <div
class="error"><span class="error">Unable to render {include}</span> The
included page could not be found.</div> <h2
id="BookComponentAppendix-AMQP">AMQP</h2><p>The <strong style="line-height:
1.42857;">amqp:</strong> component supports the <a shape="rect"
class="external-link" href="http://www.amqp.org/" rel="nofollow"
style="line-height: 1.42857;">AMQP 1.0 protocol</a> using the JMS Client API of
the <a shape="rect" class="external-link"
href="https://github.com/apache/qpid-jms/" rel="nofollow">Qpid</a> project. In
case you want to use <strong>AMQP 0.9</strong> (in particular RabbitMQ) you
might also be interested in the <a shape="rect" href="rabbitmq.html">Camel
RabbitMQ</a> component. Please keep in mind that prior to the <strong>Camel
2.17.0</strong> AMQP component supported <strong>AMQP 0.9</strong> and above,
however since <strong>Camel 2.17.0</st
rong> it supports only <strong>AMQP 1.0</strong>.</p><p>Maven users will need
to add the following dependency to their <strong><code>pom.xml</code></strong>
for this component:</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[<dependency>
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-amqp</artifactId>
<version>${camel.version}</version> <!-- use the same
version as your Camel core version -->
</dependency>
]]></script>
</div></div><h3 id="BookComponentAppendix-URIformat.1">URI format</h3><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[amqp:[queue:|topic:]destinationName[?options]
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[amqp:[queue:|topic:]destinationName[?options]
]]></script>
</div></div><h3 id="BookComponentAppendix-AMQPOptions">AMQP Options</h3><p>You
can specify all of the various configuration options of the <a shape="rect"
href="jms.html">JMS</a> component after the destination name.</p><h3
id="BookComponentAppendix-Usage">Usage</h3><p>As AMQP component inherits from
the JMS component. The usage of the former is almost identical to the
latter:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Using
AMQP component</b></div><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[// Consuming from AMQP queue
+<script class="brush: java; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[// Consuming from AMQP queue
from("amqp:queue:incoming")
.to(...);
Â
@@ -218,13 +218,13 @@ from("amqp:queue:incoming")
from(...)
.to("amqp:topic:notify");]]></script>
</div></div><h3 id="BookComponentAppendix-ConfiguringAMQPcomponent"><span
style="line-height: 1.5;">Configuring AMQP component</span></h3><p>Starting
from the <strong>Camel 2.16.1</strong> you can also use the
<strong><code>AMQPComponent#amqp10Component(String
connectionURI)</code></strong> factory method to return the <strong>AMQP
1.0</strong> component with the pre-configured topic prefix: </p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeHeader
panelHeader pdl" style="border-bottom-width: 1px;"><b>Creating AMQP 1.0
component</b></div><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[ AMQPComponent amqp =
AMQPComponent.amqp10Component("amqp://guest:guest@localhost:5672");]]></script>
+<script class="brush: java; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[ AMQPComponent amqp =
AMQPComponent.amqp10Component("amqp://guest:guest@localhost:5672");]]></script>
</div></div><p>Keep in mind that starting from the
<strong>Camel 2.17</strong> the <strong><code>AMQPComponent#amqp10Component(String
connectionURI)</code></strong> factory method has been deprecated on the
behalf of the <strong><code>AMQPComponent#amqpComponent(String
connectionURI)</code></strong>: </p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeHeader panelHeader pdl"
style="border-bottom-width: 1px;"><b>Creating AMQP 1.0 component</b></div><div
class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[AMQPComponent amqp =
AMQPComponent.amqpComponent("amqp://localhost:5672");
+<script class="brush: java; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[AMQPComponent amqp =
AMQPComponent.amqpComponent("amqp://localhost:5672");
Â
AMQPComponent authorizedAmqp =
AMQPComponent.amqpComponent("amqp://localhost:5672",
"user", "password");]]></script>
</div></div><p>Starting from <strong>Camel 2.17</strong>, in order to
automatically configure the AMQP component, you can also add an instance
of <strong><code>org.apache.camel.component.amqp.AMQPConnectionDetails</code></strong>
to the registry. For example for Spring Boot you just have to
define bean:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width:
1px;"><b>AMQP connection details auto-configuration</b></div><div
class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[@Bean
+<script class="brush: java; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[@Bean
AMQPConnectionDetails amqpConnection() {
return new AMQPConnectionDetails("amqp://lcoalhost:5672");
}
@@ -234,7 +234,7 @@ AMQPConnectionDetails securedAmqpConnect
return new AMQPConnectionDetails("amqp://lcoalhost:5672",
"username", "password");
}]]></script>
</div></div><p> </p><p>You can also rely on the <a shape="rect"
href="properties.html">Camel properties</a> to read the AMQP connection
details. The factory
method <strong><code>AMQPConnectionDetails.discoverAMQP()</code></strong> attempts
to read Camel properties in a Kubernetes-like convention, just as demonstrated
on the snippet below:</p><p> </p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeHeader panelHeader pdl"
style="border-bottom-width: 1px;"><b>AMQP connection details
auto-configuration</b></div><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[export AMQP_SERVICE_HOST =
"mybroker.com"
+<script class="brush: java; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[export AMQP_SERVICE_HOST =
"mybroker.com"
export AMQP_SERVICE_PORT = "6666"
export AMQP_SERVICE_USERNAME = "username"
export AMQP_SERVICE_PASSWORD = "password"
@@ -247,7 +247,7 @@ AMQPConnectionDetails amqpConnection() {
}
]]></script>
</div></div><h3
id="BookComponentAppendix-ConfiguringConnectionFactory">Configuring Connection
Factory</h3><p>Like with any other JMS-based component, usually it's important
to configure JMS connection factory. For example, you'd like to set your broker
URL or set proper connection credentials. Additionally, you would always want
to set some kind of pooling (or caching) on the connection factory. An example
of how to do both of these tasks is shown below.</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[<bean id="jmsConnectionFactory"
class="org.apache.qpid.jms.JmsConnectionFactory">
+<script class="brush: xml; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[<bean id="jmsConnectionFactory"
class="org.apache.qpid.jms.JmsConnectionFactory">
<property name="remoteURI"
value="amqp://localhost:5672" />
<property name="username" value="admin"/>
<property name="password" value="admin"/>
@@ -278,15 +278,15 @@ AMQPConnectionDetails amqpConnection() {
]]></script>
</div></div><h3 id="BookComponentAppendix-UsingamqpinsideKaraf">Using amqp
inside Karaf</h3><p>To use the <strong><code>amqp</code></strong> component
inside Karaf use the predefined feature called
<strong><code>camel-amqp</code></strong> to install the necessary
bundles.</p><p>Example:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
-<script class="brush: text; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[karaf@root()> repo-add camel
+<script class="brush: text; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[karaf@root()> repo-add camel
karaf@root()> feature:install camel-amqp]]></script>
</div></div><p>and the environment would be set.</p><p>Use the
<strong><code>camel-blueprint</code></strong>
or <strong><code>camel-spring</code></strong> features to define routes in
those contexts.</p><p> </p><p></p><h3
id="BookComponentAppendix-SeeAlso">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><p> </p> <h2
id="BookComponentAppendix-SQSComponent">SQS Component</h2><p><strong>Available
as of Camel 2.6</strong></p><p>The sqs component supports sending and receiving
messages to <a shape="rect" class="external-link"
href="http://aws.amazon.com/sqs" rel="nofollow">Amazon's SQS</a>
service.</p><div class="confluence-information-macro
confluence-information-macro-information"><p
class="title">Prerequisites</p><span class="aui-icon aui-icon-small
aui-iconfont-info confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>You must have a valid Amazon Web
Services developer account, and be signed up to use Amazon SQS. More
information are available at <a shape="rect" class="
external-link" href="http://aws.amazon.com/sqs" rel="nofollow">Amazon
SQS</a>.</p></div></div><h3 id="BookComponentAppendix-URIFormat">URI
Format</h3><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[aws-sqs://queueName[?options]
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[aws-sqs://queueName[?options]
aws-sqs://queueNameOrArn[?options] (from Camel 2.18)
]]></script>
</div></div><p>The queue will be created if they don't already exists. You can
append query options to the URI in the following format:
<strong><code>?options=value&option2=value&...</code></strong></p><h3
id="BookComponentAppendix-URIOptions">URI Options</h3><div
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1"
rowspan="1" class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>Default Value</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>Context</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>accessKey</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>Shared</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Amazon AWS Access
Key.</p></td></tr><tr><td colspan="1" rowspan="1" class="conflue
nceTd"><p><code>amazonSQSClient</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>Shared</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Reference to a
<strong><code>com.amazonaws.services.sqs.AmazonSQS</code></strong> in the <a
shape="rect" href="registry.html">Registry</a>.</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>amazonSQSEndpoint</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>Shared</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>The region with which
the <strong><code>aws-sqs</code></strong> client wants to work with. Only
works if Camel creates the <strong><code>aws-sqs</code></strong> client,
i.e., if you explicitly set <strong><code>amazonSQSClient</code></strong>, then
this setting will have
no effect. You would have to set it on the client you create
directly</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>attributeNames</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>Consumer</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>A list of attribute names to
receive when consuming. </p><p><strong>Camel 2.17:</strong> Multiple names can
be separated by comma. </p><p><strong>Camel 2.16</strong> or older: The type is
a Collection so its much harder to configure and use.</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>concurrentConsumers</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><code>1</code></td><td colspan="1"
rowspan="1" class="confluenceTd"><code>Consumer</code></td><td colspan="1"
rowspan="1" class="confluenceTd">(<strong>as of 2.15.0</strong>) Allows you to
use multiple threads
to poll the SQS queue to increase throughput. You must also set t<span>he
</span><strong><code>maxMessagesPerPoll</code></strong> option for this to work
properly.</td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>defaultVisibilityTimeout</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>Shared</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>The visibility timeout (in
seconds) to set in the
<strong><code>com.amazonaws.services.sqs.model.CreateQueueRequest</code></strong>.</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>delaySeconds</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>Producer</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9.3:</strong>
Delay sending messages for a numb
er of seconds.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>deleteAfterRead</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>Consumer</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Delete message from SQS after
it has been read (and processed by the route).</p><p>If this option is false,
then the same objects will be retrieve over and over again on the polls.
Therefore you need to use the <a shape="rect"
href="idempotent-consumer.html">Idempotent Consumer EIP</a> in the route to
filter out duplicates. You can filter using
the <strong><code>S3Constants#BUCKET_NAME</code></strong>
and <strong><code>S3Constants#KEY</code></strong> headers, or only
the <strong><code>S3Constants#KEY</code></strong>
header.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>deleteIfFiltered</code></p></td><td colspan=
"1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>Consumer</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><strong>Camel 2.12.2, 2.13.0</strong>:
Whether or not to send the <strong><code>DeleteMessage</code></strong> to
the SQS queue if an exchange fails to get through a
filter.</p><p>If <strong><code>false</code></strong> and exchange does not
make it through a Camel filter upstream in the route, then don't send
<strong><code>DeleteMessage</code></strong>.</p></td></tr><tr><td colspan="1"
rowspan="1"
class="confluenceTd"><p><code>extendMessageVisibility</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>Consumer</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><strong>Camel 2.10:</strong> If enabled a
scheduled background task will keep extending the message visib
ility on SQS. This is needed if it takes a long time to process the message.
If set to true<strong><code> visibilityTimeout</code></strong> must be
set.</p><p>See details at <a shape="rect" class="external-link"
href="http://docs.amazonwebservices.com/AWSSimpleQueueService/latest/APIReference/Query_QueryChangeMessageVisibility.html"
rel="nofollow">Amazon docs</a>.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>maximumMessageSize</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>Shared</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><strong>Camel 2.8:</strong>
The <strong><code>maximumMessageSize</code></strong> (in bytes) an SQS
message can contain for this queue, to set in the
<strong><code>com.amazonaws.services.sqs.model.SetQueueAttributesRequest</code></strong>.</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><
p><code>maxMessagesPerPoll</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>Consumer</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>The maximum number of messages which can be
received in one poll to set in the
<strong><code>com.amazonaws.services.sqs.model.ReceiveMessageRequest</code></strong>.</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><code>messageAttributeNames</code></td><td colspan="1"
rowspan="1" class="confluenceTd"><code>null</code></td><td colspan="1"
rowspan="1" class="confluenceTd"><code>Consumer</code></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>A list of message attribute names to
receive when consuming. </p><p><strong>Camel
2.17:</strong><span> </span>Multiple names can be separated by comma.
<span> </span></p><p><span><strong>Camel 2.16</strong> or older: The type
is a Collection so its much harder to c
onfigure and use.</span></p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>messageRetentionPeriod</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>Shared</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.8:</strong>
The <strong><code>messageRetentionPeriod</code></strong> (in seconds) a
message will be retained by SQS for this queue, to set in the
<strong><code>com.amazonaws.services.sqs.model.SetQueueAttributesRequest</code></strong>.</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>proxyHost</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><code>null</code></td><td colspan="1"
rowspan="1" class="confluenceTd"><code>Shared</code></td><td colspan="1"
rowspan="1" class="confluenceTd"><strong>Camel 2.16</strong>: Specify a proxy
host to be used inside the client definition.</td></tr
><tr><td colspan="1" rowspan="1"
>class="confluenceTd"><p><code>proxyPort</code></p></td><td colspan="1"
>rowspan="1" class="confluenceTd"><code>null</code></td><td colspan="1"
>rowspan="1" class="confluenceTd"><code>Shared</code></td><td colspan="1"
>rowspan="1" class="confluenceTd"><strong>Camel 2.16</strong>: Specify a proxy
>port to be used inside the client definition.</td></tr><tr><td colspan="1"
>rowspan="1"
>class="confluenceTd"><p><code>queueOwnerAWSAccountId</code></p></td><td
>colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td
>colspan="1" rowspan="1"
>class="confluenceTd"><p><code>Shared</code></p></td><td colspan="1"
>rowspan="1" class="confluenceTd"><p><strong>Camel 2.12:</strong> Specify the
>queue owner aws account id when you need to connect the queue with different
>account owner.</p></td></tr><tr><td colspan="1" rowspan="1"
>class="confluenceTd"><p><code>policy</code></p></td><td colspan="1"
>rowspan="1" class="confluenceTd"><p><code>null</code></p></t
d><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>Shared</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><strong>Camel 2.8:</strong> The policy for this queue
to set in the
<strong><code>com.amazonaws.services.sqs.model.SetQueueAttributesRequest</code></strong>.</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>receiveMessageWaitTimeSeconds</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>Shared</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.11:</strong> If
you do not specify <strong><code>WaitTimeSeconds</code></strong> in the
request, the queue
attribute <strong><code>ReceiveMessageWaitTimeSeconds</code></strong> is
used to determine how long to wait.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>redrivePolicy</code></p></td><td
colspan="1" rowspan="1" clas
s="confluenceTd"><code>null</code></td><td colspan="1" rowspan="1"
class="confluenceTd"><code>Shared</code></td><td colspan="1" rowspan="1"
class="confluenceTd"><strong>Camel 2.15</strong>: Specify the policy that send
message to <strong><code>DeadLetter</code></strong> queue. See detail at
<a shape="rect" class="external-link"
href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues-redrivepolicy.html"
rel="nofollow">Amazon docs</a>.</td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>region</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>Shared</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><strong>Camel 2.12.3:</strong> Specify the queue region
which could be used with <strong><code>queueOwnerAWSAccountId</code></strong>
to build the service URL.<br clear="none"><strong>Note</strong>: Region will st
ill default to <strong><code>us-east-1</code></strong> if
 <span><strong><code>queueOwnerAWSAccountId</code></strong> is not
specified</span></p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>secretKey</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>Shared</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Amazon AWS Secret Key.</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>waitTimeSeconds</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>Producer</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.11:</strong>
Duration in seconds (0 to 20) that
the <strong><code>ReceiveMessage</code></strong> action call will wait
until a message is in the queue to include in the respons
e.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>visibilityTimeout</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>Shared</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>The duration (in seconds) that the received
messages are hidden from subsequent retrieve requests after being retrieved by
a <strong><code>ReceiveMessage</code></strong> request. This only make
sense if its different from
<strong><code>defaultVisibilityTimeout</code></strong>.</p></td></tr></tbody></table></div><div
class="confluence-information-macro
confluence-information-macro-information"><p class="title">Required SQS
component options</p><span class="aui-icon aui-icon-small aui-iconfont-info
confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>You have to provide
the <strong><code>amazonSQSClient</code></strong> in
the <a shape="rect" href="registry.html">Registry</a> or
your <strong><code>accessKey</code></strong>
and <strong><code>secretKey</code></strong> to access the <a shape="rect"
class="external-link" href="http://aws.amazon.com/sqs" rel="nofollow">Amazon's
SQS</a>.</p></div></div><h3 id="BookComponentAppendix-BatchConsumer">Batch
Consumer</h3><p>This component implements the <a shape="rect"
href="batch-consumer.html">Batch Consumer</a>.</p><p>This allows you for
instance to know how many messages exists in this batch and for instance let
the <a shape="rect" href="aggregator.html">Aggregator</a> aggregate this number
of messages.</p><h3 id="BookComponentAppendix-Usage.1">Usage</h3><h4
id="BookComponentAppendix-MessageheaderssetbytheSQSproducer">Message headers
set by the SQS producer</h4><div class="table-wrap"><table
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1"
class="confluenceTh"><p>Header</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>Type<
/p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1"
rowspan="1"
class="confluenceTd"><p><code>CamelAwsSqsMD5OfBody</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>The MD5 checksum of the Amazon
SQS message.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>CamelAwsSqsMessageId</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>The Amazon SQS message
ID.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>CamelAwsSqsDelaySeconds</code></p></td><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>Integer</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Since <strong>Camel 2.11</strong>, the
delay seconds that the Amazon SQS message can be see by
others.</p></td></tr></tbo
dy></table></div><h4
id="BookComponentAppendix-MessageheaderssetbytheSQSconsumer">Message headers
set by the SQS consumer</h4><div class="table-wrap"><table
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1"
class="confluenceTh"><p>Header</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1"
rowspan="1"
class="confluenceTd"><p><code>CamelAwsSqsMD5OfBody</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>The MD5 checksum of the Amazon
SQS message.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>CamelAwsSqsMessageId</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>The Amazon SQS message
ID.</p></td></tr><tr><td colspan="1" rowspan="1" class="
confluenceTd"><p><code>CamelAwsSqsReceiptHandle</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>The Amazon SQS message receipt
handle.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>CamelAwsSqsAttributes</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>Map<String,
String></code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>The Amazon SQS message
attributes.</p></td></tr></tbody></table></div><h4
id="BookComponentAppendix-AdvancedAmazonSQSconfiguration">Advanced AmazonSQS
configuration</h4><p>If your Camel Application is running behind a firewall or
if you need to have more control over the AmazonSQS instance configuration, you
can create your own instance:</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[AWSCredentials awsCredentials = new
BasicAWSCredentials("myAccessKey", "mySecretKey");
+<script class="brush: java; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[AWSCredentials awsCredentials = new
BasicAWSCredentials("myAccessKey", "mySecretKey");
ClientConfiguration clientConfiguration = new ClientConfiguration();
clientConfiguration.setProxyHost("http://myProxyHost");
@@ -297,18 +297,18 @@ AmazonSQS client = new AmazonSQSClient(a
registry.bind("client", client);
]]></script>
</div></div><p>and refer to it in your Camel aws-sqs component
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[from("aws-sqs://MyQueue?amazonSQSClient=#client&delay=5000&maxMessagesPerPoll=5")
+<script class="brush: java; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[from("aws-sqs://MyQueue?amazonSQSClient=#client&delay=5000&maxMessagesPerPoll=5")
.to("mock:result");
]]></script>
</div></div><h3
id="BookComponentAppendix-Dependencies">Dependencies</h3><p>Maven users will
need to add the following dependency to their
<strong><code>pom.xml</code></strong>.</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeHeader panelHeader pdl"
style="border-bottom-width: 1px;"><b>pom.xml</b></div><div class="codeContent
panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[<dependency>
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-aws</artifactId>
<version>${camel-version}</version>
</dependency>
]]></script>
</div></div><p>where <strong><code>${camel-version</code>}</strong> must be
replaced by the actual version of Camel (2.6 or higher).</p><h3
id="BookComponentAppendix-JMS-styleSelectors">JMS-style Selectors</h3><p>SQS
does not allow selectors, but you can effectively achieve this by using the <a
shape="rect" href="message-filter.html">Camel Filter EIP</a> and setting an
appropriate <strong><code>visibilityTimeout</code></strong>. When SQS
dispatches a message, it will wait up to the visibility timeout before it will
try to dispatch the message to a different consumer unless
a <strong><code>DeleteMessage</code></strong> is received. By default,
Camel will always send the <strong><code>DeleteMessage</code></strong> at
the end of the route, unless the route ended in failure. To achieve appropriate
filtering and not send the <strong><code>DeleteMessage</code></strong>
even on successful completion of the route, use a Filter:</p><div class="code
panel pdl" style="border-wid
th: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[from("aws-sqs://MyQueue?amazonSQSClient=#client&defaultVisibilityTimeout=5000&deleteIfFiltered=false")
+<script class="brush: java; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[from("aws-sqs://MyQueue?amazonSQSClient=#client&defaultVisibilityTimeout=5000&deleteIfFiltered=false")
.filter("${header.login} == true")
.to("mock:result");
]]></script>
@@ -349,7 +349,7 @@ from("direct:start").bean(ExampleBean.cl
<h3 id="BookComponentAppendix-URIformat.4">URI format</h3>
<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 class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[
browse:someName[?options]
]]></script>
</div></div>
@@ -359,7 +359,7 @@ browse:someName[?options]
<h3 id="BookComponentAppendix-Sample">Sample</h3>
<p>In the route below, we insert a <code>browse:</code> component to be able
to browse the Exchanges that are passing through:</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[
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[
from("activemq:order.in").to("browse:orderReceived").to("bean:processOrder");
]]></script>
</div></div>
@@ -367,7 +367,7 @@ browse:someName[?options]
<p>We can now inspect the received exchanges from within the Java code:</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[
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[
private CamelContext context;
public void inspectRecievedOrders() {
@@ -386,7 +386,7 @@ browse:someName[?options]
<h3 id="BookComponentAppendix-SeeAlso.2">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> <h2
id="BookComponentAppendix-CacheComponent">Cache Component</h2><div
class="confluence-information-macro confluence-information-macro-warning"><span
class="aui-icon aui-icon-small aui-iconfont-error
confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>This component is deprecated. As
of Camel 2.18.0 You should use <a shape="rect"
href="ehcache.html">Ehcache</a>.</p></div></div><p><strong>Available as of
Camel 2.1</strong></p><p>The <strong>cache</strong> component enables you to
perform caching operations using EHCache as the Cache Implementation. The cache
itself is created on demand or if a cache of that name already exists then it
is simply utilized with its original s
ettings.</p><p>This component supports producer and event based consumer
endpoints.</p><p>The Cache consumer is an event based consumer and can be used
to listen and respond to specific cache activities. If you need to perform
selections from a pre-existing cache, use the processors defined for the cache
component.</p><p>Maven users will need to add the following dependency to their
<code>pom.xml</code> for this component:</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[<dependency>
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cache</artifactId>
<version>x.x.x</version>
@@ -394,7 +394,7 @@ browse:someName[?options]
</dependency>
]]></script>
</div></div><h3 id="BookComponentAppendix-URIformat.5">URI format</h3><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[cache://cacheName[?options]
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[cache://cacheName[?options]
]]></script>
</div></div><p>You can append query options to the URI in the following
format, <code>?option=value&option=#beanRef&...</code></p><h3
id="BookComponentAppendix-Options.3">Options</h3><div class="table-wrap"><table
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1"
class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>Default Value</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1"
rowspan="1"
class="confluenceTd"><p><code>maxElementsInMemory</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>1000</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>The number of elements that may
be stored in the defined cache</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>memoryStoreEvictionPolicy</code></p></td><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>MemoryStoreEvictionPolicy.LFU</code></p></td><td
colspan="1"
rowspan="1" class="confluenceTd"><p>The number of elements that may be stored
in the defined cache. Options include</p><ul
class="alternate"><li>MemoryStoreEvictionPolicy.LFU - Least frequently
used</li><li>MemoryStoreEvictionPolicy.LRU - Least recently
used</li><li>MemoryStoreEvictionPolicy.FIFO - first in first out, the oldest
element by creation time</li></ul></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>overflowToDisk</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies whether cache may overflow to
disk</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>eternal</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Sets whether elements are eternal. If
eternal, timeouts are ignored and the<br clear="none"
class="atl-forced-newline"> eleme
nt never expires.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>timeToLiveSeconds</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>300</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>The maximum time between creation time and
when an element expires.<br clear="none" class="atl-forced-newline"> Is used
only if the element is not eternal</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>timeToIdleSeconds</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>300</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>The maximum amount of time between accesses
before an element expires</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>diskPersistent</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Whether the disk store persists between rest
arts of the Virtual Machine.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>diskExpiryThreadIntervalSeconds</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>120</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>The number of seconds between
runs of the disk expiry thread.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>cacheManagerFactory</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.8:</strong> If
you want to use a custom factory which instantiates and creates the EHCache
<code>net.sf.ehcache.CacheManager</code>. <br clear="none"
class="atl-forced-newline"> <br clear="none" class="atl-forced-newline">
<em>Type:</em> abstract
org.apache.camel.component.cache.CacheManagerFactory</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>eventListenerRegistry</c
ode></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.8:</strong> Sets a list of EHCache
<code>net.sf.ehcache.event.CacheEventListener</code> for all new caches- no
need to define it per cache in EHCache xml config anymore. <br clear="none"
class="atl-forced-newline"> <br clear="none" class="atl-forced-newline">
<em>Type:</em>
org.apache.camel.component.cache.CacheEventListenerRegistry</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>cacheLoaderRegistry</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.8:</strong>
Sets a list of <code>org.apache.camel.component.cache.CacheLoaderWrapper</code>
that extends EHCache <code>net.sf.ehcache.loader.CacheLoader</code> for all new
caches- no need to define it per cache in EHCache xml config anymore. <br c
lear="none" class="atl-forced-newline"> <br clear="none"
class="atl-forced-newline"> <em>Type:</em>
org.apache.camel.component.cache.CacheLoaderRegistry</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>key</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> To
configure using a cache key by default. If a key is provided in the message
header, then the key from the header takes precedence.</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>operation</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> To configure
using an cache operation by default. If an operation in the message header,
then the operation from the header takes precedence.</p></td></tr><tr><td
colspan="1" rowspan="1" class="conf
luenceTd"><p>objectCache</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>false</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><strong style="line-height: 1.42857;">Camel
2.15:</strong> Whether to turn on allowing to store non serializable objects in
the cache. If this option is enabled then overflow to disk cannot be enabled as
well.</p></td></tr></tbody></table></div><h3
id="BookComponentAppendix-CacheComponentoptions">Cache Component
options</h3><div class="table-wrap"><table
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1"
class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>Default Value</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>configuration</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>To use a custom <code>org.ap
ache.camel.component.cache.CacheConfiguration</code>
configuration.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>cacheManagerFactory</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>To use a custom
<code>org.apache.camel.component.cache.CacheManagerFactory</code>.</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>configurationFile</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><strong>Camel 2.13/2.12.3:</strong> To configure the
location of the <code>ehcache.xml</code> file to use, such as
<code>classpath:com/foo/mycache.xml</code> to load from classpath. If no
configuration is given, then the default settings from EHCache is
used.</p></td></tr></tbody></table></div><h3
id="BookComponentAppendix-Sending/ReceivingMessagesto/fromthecache"><span
style="line-heigh
t: 1.5625;">Sending/Receiving Messages to/from the cache</span></h3><h4
id="BookComponentAppendix-MessageHeadersuptoCamel2.7">Message Headers up to
Camel 2.7</h4><div class="confluenceTableSmall"><div class="table-wrap"><table
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1"
class="confluenceTh"><p>Header</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>CACHE_OPERATION</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>The operation to be performed
on the cache. Valid options are</p><ul
class="alternate"><li>GET</li><li>CHECK</li><li>ADD</li><li>UPDATE</li><li>DELETE</li><li>DELETEALL<br
clear="none" class="atl-forced-newline"> <code>GET</code> and
<code>CHECK</code> requires <strong>Camel 2.3</strong>
onwards.</li></ul></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>CACHE_KEY</code></p></td><td colspan="1"
rowspan="1" class="conflue
nceTd"><p>The cache key used to store the Message in the cache. The cache key
is optional if the CACHE_OPERATION is
DELETEALL</p></td></tr></tbody></table></div></div>
@@ -406,7 +406,7 @@ browse:someName[?options]
<h4 id="BookComponentAppendix-CacheProducer">Cache Producer</h4><p>Sending
data to the cache involves the ability to direct payloads in exchanges to be
stored in a pre-existing or created-on-demand cache. The mechanics of doing
this involve</p><ul class="alternate"><li>setting the Message Exchange Headers
shown above.</li><li>ensuring that the Message Exchange Body contains the
message directed to the cache</li></ul><h4
id="BookComponentAppendix-CacheConsumer">Cache Consumer</h4><p>Receiving data
from the cache involves the ability of the CacheConsumer to listen on a
pre-existing or created-on-demand Cache using an event Listener and receive
automatic notifications when any cache activity take place (i.e
CamelCacheGet/CamelCacheUpdate/CamelCacheDelete/CamelCacheDeleteAll). Upon such
an activity taking place</p><ul class="alternate"><li>an exchange containing
Message Exchange Headers and a Message Exchange Body containing the just
added/updated payload is placed and sent.</li><li>in
case of a CamelCacheDeleteAll operation, the Message Exchange Header
CamelCacheKey and the Message Exchange Body are not populated.</li></ul><h4
id="BookComponentAppendix-CacheProcessors">Cache Processors</h4><p>There are a
set of nice processors with the ability to perform cache lookups and
selectively replace payload content at the</p><ul
class="alternate"><li>body</li><li>token</li><li>xpath level</li></ul><h3
id="BookComponentAppendix-CacheUsageSamples">Cache Usage Samples</h3><h4
id="BookComponentAppendix-Example1:Configuringthecache">Example 1: Configuring
the cache</h4><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("cache://MyApplicationCache" +
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[from("cache://MyApplicationCache" +
"?maxElementsInMemory=1000" +
"&memoryStoreEvictionPolicy=" +
"MemoryStoreEvictionPolicy.LFU" +
@@ -418,7 +418,7 @@ browse:someName[?options]
"&diskExpiryThreadIntervalSeconds=300")
]]></script>
</div></div><h4
id="BookComponentAppendix-Example2:Addingkeystothecache">Example 2: Adding keys
to the cache</h4><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[RouteBuilder builder = new RouteBuilder() {
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[RouteBuilder builder = new RouteBuilder() {
public void configure() {
from("direct:start")
.setHeader(CacheConstants.CACHE_OPERATION,
constant(CacheConstants.CACHE_OPERATION_ADD))
@@ -428,7 +428,7 @@ browse:someName[?options]
};
]]></script>
</div></div><h4
id="BookComponentAppendix-Example2:Updatingexistingkeysinacache">Example 2:
Updating existing keys in a cache</h4><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[RouteBuilder builder = new RouteBuilder() {
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[RouteBuilder builder = new RouteBuilder() {
public void configure() {
from("direct:start")
.setHeader(CacheConstants.CACHE_OPERATION,
constant(CacheConstants.CACHE_OPERATION_UPDATE))
@@ -438,7 +438,7 @@ browse:someName[?options]
};
]]></script>
</div></div><h4
id="BookComponentAppendix-Example3:Deletingexistingkeysinacache">Example 3:
Deleting existing keys in a cache</h4><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[RouteBuilder builder = new RouteBuilder() {
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[RouteBuilder builder = new RouteBuilder() {
public void configure() {
from("direct:start")
.setHeader(CacheConstants.CACHE_OPERATION,
constant(CacheConstants.CACHE_DELETE))
@@ -448,7 +448,7 @@ browse:someName[?options]
};
]]></script>
</div></div><h4
id="BookComponentAppendix-Example4:Deletingallexistingkeysinacache">Example 4:
Deleting all existing keys in a cache</h4><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[RouteBuilder builder = new RouteBuilder() {
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[RouteBuilder builder = new RouteBuilder() {
public void configure() {
from("direct:start")
.setHeader(CacheConstants.CACHE_OPERATION,
constant(CacheConstants.CACHE_DELETEALL))
@@ -457,7 +457,7 @@ browse:someName[?options]
};
]]></script>
</div></div><h4
id="BookComponentAppendix-Example5:NotifyinganychangesregisteringinaCachetoProcessorsandotherProducers">Example
5: Notifying any changes registering in a Cache to Processors and other
Producers</h4><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[RouteBuilder builder = new RouteBuilder() {
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[RouteBuilder builder = new RouteBuilder() {
public void configure() {
from("cache://TestCache1")
.process(new Processor() {
@@ -473,7 +473,7 @@ browse:someName[?options]
};
]]></script>
</div></div><h4
id="BookComponentAppendix-Example6:UsingProcessorstoselectivelyreplacepayloadwithcachevalues">Example
6: Using Processors to selectively replace payload with cache values</h4><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[RouteBuilder builder = new RouteBuilder() {
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[RouteBuilder builder = new RouteBuilder() {
public void configure() {
//Message Body Replacer
from("cache://TestCache1")
@@ -499,7 +499,7 @@ browse:someName[?options]
};
]]></script>
</div></div><h4
id="BookComponentAppendix-Example7:GettinganentryfromtheCache">Example 7:
Getting an entry from the Cache</h4><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("direct:start")
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[from("direct:start")
// Prepare headers
.setHeader(CacheConstants.CACHE_OPERATION,
constant(CacheConstants.CACHE_OPERATION_GET))
.setHeader(CacheConstants.CACHE_KEY,
constant("Ralph_Waldo_Emerson")).
@@ -515,7 +515,7 @@ browse:someName[?options]
.to("direct:nextPhase");
]]></script>
</div></div><h4
id="BookComponentAppendix-Example8:CheckingforanentryintheCache">Example 8:
Checking for an entry in the Cache</h4><p>Note: The CHECK command tests
existence of an entry in the cache but doesn't place a message in the
body.</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("direct:start")
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[from("direct:start")
// Prepare headers
.setHeader(CacheConstants.CACHE_OPERATION,
constant(CacheConstants.CACHE_OPERATION_CHECK))
.setHeader(CacheConstants.CACHE_KEY,
constant("Ralph_Waldo_Emerson")).
@@ -530,7 +530,7 @@ browse:someName[?options]
.end();
]]></script>
</div></div><h3 id="BookComponentAppendix-ManagementofEHCache">Management of
EHCache</h3><p><a shape="rect" class="external-link" href="http://ehcache.org/"
rel="nofollow">EHCache</a> has its own statistics and management from <a
shape="rect" href="camel-jmx.html">JMX</a>.</p><p>Here's a snippet on how to
expose them via JMX in a Spring application context:</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[<bean
id="ehCacheManagementService"
class="net.sf.ehcache.management.ManagementService"
init-method="init" lazy-init="false">
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[<bean
id="ehCacheManagementService"
class="net.sf.ehcache.management.ManagementService"
init-method="init" lazy-init="false">
<constructor-arg>
<bean class="net.sf.ehcache.CacheManager"
factory-method="getInstance"/>
</constructor-arg>
@@ -544,22 +544,22 @@ browse:someName[?options]
</bean>
]]></script>
</div></div><p>Of course you can do the same thing in straight Java:</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[ManagementService.registerMBeans(CacheManager.getInstance(),
mbeanServer, true, true, true, true);
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[ManagementService.registerMBeans(CacheManager.getInstance(),
mbeanServer, true, true, true, true);
]]></script>
</div></div><p>You can get cache hits, misses, in-memory hits, disk hits, size
stats this way. You can also change CacheConfiguration parameters on the
fly.</p><h3 id="BookComponentAppendix-CachereplicationCamel2.8+">Cache
replication Camel 2.8+</h3><p>The Camel Cache component is able to distribute a
cache across server nodes using several different replication mechanisms
including: RMI, JGroups, JMS and Cache Server.</p><p>There are two different
ways to make it work:</p><p><strong>1.</strong> You can configure
<code>ehcache.xml</code> manually</p><p>OR</p><p><strong>2.</strong> You can
configure these three options:</p><ul
class="alternate"><li>cacheManagerFactory</li><li>eventListenerRegistry</li><li>cacheLoaderRegistry</li></ul><p>Configuring
Camel Cache replication using the first option is a bit of hard work as you
have to configure all caches separately. So in a situation when the all names
of caches are not known, using <code>ehcache.xml</code> is not a good
idea.</p><p>The
second option is much better when you want to use many different caches as
you do not need to define options per cache. This is because replication
options are set per <code>CacheManager</code> and per
<code>CacheEndpoint</code>. Also it is the only way when cache names are not
know at the development phase.</p><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>It might be useful to read the <a
shape="rect" class="external-link" href="http://ehcache.org/documentation"
rel="nofollow">EHCache manual</a> to get a better understanding of the Camel
Cache replication mechanism.</p></div></div><h4
id="BookComponentAppendix-Example:JMScachereplication">Example: JMS cache
replication</h4><p>JMS replication is the most powerful and secured replication
method. Used together with Camel Cache replication makes it also rath
er simple.<br clear="none"> An example is available on <a shape="rect"
href="cachereplicationjmsexample.html">a separate page</a>.</p> <h2
id="BookComponentAppendix-ClassComponent">Class
Component</h2><p><strong>Available as of Camel 2.4</strong></p><p>The
<strong>class:</strong> component binds beans to Camel message exchanges. It
works in the same way as the <a shape="rect" href="bean.html">Bean</a>
component but instead of looking up beans from a <a shape="rect"
href="registry.html">Registry</a> it creates the bean based on the class
name.</p><h3 id="BookComponentAppendix-URIformat.6">URI format</h3><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[class:className[?options]
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[class:className[?options]
]]></script>
</div></div><p>Where <strong>className</strong> is the fully qualified class
name to create and use as bean.</p><h3
id="BookComponentAppendix-Options.4">Options</h3><div
class="confluenceTableSmall"><div class="table-wrap"><table
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1"
class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>Type</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>method</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>The method name that bean will be invoked.
If not provided, Camel will try to pick the method itself. In case of ambiguity
an exception is thrown. See <a shape="re
ct" href="bean-binding.html">Bean Binding</a> for more
details.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>multiParameterArray</code></p></td><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>boolean</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>How to treat the parameters which are
passed from the message body; if it is <code>true</code>, the In message body
should be an array of parameters.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>bean.xxx</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"> </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.17:</strong> To configure additional
options on the create bean instance from the class name. For example to
configure a foo option on the bean, use bean.fo
o=123.</p></td></tr></tbody></table></div></div>
<p>You can append query options to the URI in the following format,
<code>?option=value&option=value&...</code></p><h3
id="BookComponentAppendix-Using.1">Using</h3><p>You simply use the
<strong>class</strong> component just as the <a shape="rect"
href="bean.html">Bean</a> component but by specifying the fully qualified
classname instead.<br clear="none"> For example to use the
<code>MyFooBean</code> you have to do as follows:</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("direct:start").to("class:org.apache.camel.component.bean.MyFooBean").to("mock:result");
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[
from("direct:start").to("class:org.apache.camel.component.bean.MyFooBean").to("mock:result");
]]></script>
</div></div><p>You can also specify which method to invoke on the
<code>MyFooBean</code>, for example <code>hello</code>:</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("direct:start").to("class:org.apache.camel.component.bean.MyFooBean?method=hello").to("mock:result");
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[
from("direct:start").to("class:org.apache.camel.component.bean.MyFooBean?method=hello").to("mock:result");
]]></script>
</div></div><h2
id="BookComponentAppendix-Settingpropertiesonthecreatedinstance">Setting
properties on the created instance</h2><p>In the endpoint uri you can specify
properties to set on the created instance, for example if it has a
<code>setPrefix</code> method:</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[ // Camel 2.17 onwards
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[ // Camel 2.17 onwards
from("direct:start")
.to("class:org.apache.camel.component.bean.MyPrefixBean?bean.prefix=Bye")
.to("mock:result");
@@ -570,7 +570,7 @@ browse:someName[?options]
.to("mock:result");
]]></script>
</div></div><p>And you can also use the <code style="line-height:
1.42857;">#</code> syntax to refer to properties to be looked up in the <a
shape="rect" href="registry.html">Registry</a>.</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[ // Camel 2.17 onwards
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[ // Camel 2.17 onwards
from("direct:start")
.to("class:org.apache.camel.component.bean.MyPrefixBean?bean.cool=#foo")
.to("mock:result");
@@ -582,7 +582,7 @@ browse:someName[?options]
]]></script>
</div></div><p>Which will lookup a bean from the <a shape="rect"
href="registry.html">Registry</a> with the id <code>foo</code> and invoke the
<code>setCool</code> method on the created instance of the
<code>MyPrefixBean</code> class.</p><div class="confluence-information-macro
confluence-information-macro-tip"><p class="title">See more</p><span
class="aui-icon aui-icon-small aui-iconfont-approve
confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>See more details at the <a
shape="rect" href="bean.html">Bean</a> component as the <strong>class</strong>
component works in much the same way.</p></div></div><p></p><h3
id="BookComponentAppendix-SeeAlso.3">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="bean.html">Bean</a></li><li><a shape="rect"
href="bean-binding.html">Bean Binding</a></li><li><a shape="rect"
href="bean-integration.html">Bean Integration</a></li></ul> <h2
id="BookComponentAppendix-CometdComponent">Cometd Component</h2><p>The
<strong>cometd:</strong> component is a transport for working with the <a
shape="rect" class="external-link" href="http://www.mortbay.org/jetty"
rel="nofollow">jetty</a> implementation of the <a shape="rect"
class="external-link"
href="http://docs.codehaus.org/display/JETTY/Cometd+%28aka+Bayeux%29"
rel="nofollow">cometd/bayeux protocol</a>.<br clear="none"> Using this
component in combination with the dojo toolkit library it's possible to push
Camel messages directly into the browser using an AJAX based
mechanism.</p><p>Maven users will need to add the following dependency to their
<code>pom.xml</code> for this component:</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[<dependency>
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cometd</artifactId>
<version>x.x.x</version>
@@ -590,7 +590,7 @@ browse:someName[?options]
</dependency>
]]></script>
</div></div><h3 id="BookComponentAppendix-URIformat.7">URI format</h3><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[cometd://host:port/channelName[?options]
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[cometd://host:port/channelName[?options]
]]></script>
</div></div><p>The <strong>channelName</strong> represents a topic that can be
subscribed to by the Camel endpoints.</p><h3
id="BookComponentAppendix-Examples">Examples</h3><div class="preformatted
panel" style="border-width: 1px;"><div class="preformattedContent panelContent">
<pre>cometd://localhost:8080/service/mychannel
@@ -600,7 +600,7 @@ cometds://localhost:8443/service/mychann
<p>You can append query options to the URI in the following format,
<code>?option=value&option=value&...</code></p><p>Here is some examples
on How to pass the parameters</p><p>For file (for webapp resources located in
the Web Application directory -->
cometd://localhost:8080?resourceBase=file./webapp<br clear="none"> For
classpath (when by example the web resources are packaged inside the webapp
folder --> cometd://localhost:8080?resourceBase=classpath:webapp</p><h3
id="BookComponentAppendix-Authentication">Authentication</h3><p><strong>Available
as of Camel 2.8</strong></p><p>You can configure custom
<code>SecurityPolicy</code> and <code>Extension</code>'s to the
<code>CometdComponent</code> which allows you to use authentication as <a
shape="rect" class="external-link"
href="http://cometd.org/documentation/howtos/authentication"
rel="nofollow">documented here</a></p><h3
id="BookComponentAppendix-SettingupSSLforCometdComponent">Setting up SSL for
Cometd Component</h3>
<h4 id="BookComponentAppendix-UsingtheJSSEConfigurationUtility">Using the JSSE
Configuration Utility</h4><p>As of Camel 2.9, the Cometd component supports
SSL/TLS configuration through the <a shape="rect"
href="camel-configuration-utilities.html">Camel JSSE Configuration
Utility</a>.  This utility greatly decreases the amount of component
specific code you need to write and is configurable at the endpoint and
component levels.  The following examples demonstrate how to use the
utility with the Cometd component. You need to configure SSL on the
CometdComponent.</p><h5
id="BookComponentAppendix-Programmaticconfigurationofthecomponent">Programmatic
configuration of the component</h5><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[KeyStoreParameters ksp = new
KeyStoreParameters();
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[KeyStoreParameters ksp = new
KeyStoreParameters();
ksp.setResource("/users/home/server/keystore.jks");
ksp.setPassword("keystorePassword");
@@ -619,7 +619,7 @@ CometdComponent commetdComponent = getCo
commetdComponent.setSslContextParameters(scp);
]]></script>
</div></div><h5
id="BookComponentAppendix-SpringDSLbasedconfigurationofendpoint">Spring DSL
based configuration of endpoint</h5><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 class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[...
<camel:sslContextParameters
id="sslContextParameters">
<camel:keyManagers
@@ -643,7 +643,7 @@ commetdComponent.setSslContextParameters
]]></script>
</div></div><p></p><h3 id="BookComponentAppendix-SeeAlso.4">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> <h2
id="BookComponentAppendix-ContextComponent">Context
Component</h2><p><strong>Available as of Camel 2.7</strong></p><div
class="confluence-information-macro confluence-information-macro-warning"><span
class="aui-icon aui-icon-small aui-iconfont-error
confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>Deprecated do NOT
use</p></div></div><p> </p><p>The <strong>context</strong> component
allows you to create new Camel Components from a CamelContext with a number of
routes which is then treated as a black box, allowing you to refer to the local
endpoints within the component from other CamelContexts.</p><p>It is similar to
the <a shape="rect" href="routebox.html">Rou
tebox</a> component in idea, though the Context component tries to be really
simple for end users; just a simple convention over configuration approach to
refer to local endpoints inside the CamelContext Component.</p><p>Maven users
will need to add the following dependency to their <code>pom.xml</code> for
this component:</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[<dependency>
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-context</artifactId>
<version>x.x.x</version>
@@ -651,13 +651,13 @@ commetdComponent.setSslContextParameters
</dependency>
]]></script>
</div></div><h3 id="BookComponentAppendix-URIformat.8">URI format</h3><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[context:camelContextId:localEndpointName[?options]
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[context:camelContextId:localEndpointName[?options]
]]></script>
</div></div><p>Or you can omit the "context:" prefix.</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[camelContextId:localEndpointName[?options]
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[camelContextId:localEndpointName[?options]
]]></script>
</div></div><ul><li><strong>camelContextId</strong> is the ID you used to
register the CamelContext into the <a shape="rect"
href="registry.html">Registry</a>.</li><li><strong>localEndpointName</strong>
can be a valid Camel URI evaluated within the black box CamelContext. Or it can
be a logical name which is mapped to any local endpoints. For example if you
locally have endpoints like <strong>direct:invoices</strong> and
<strong>seda:purchaseOrders</strong> inside a CamelContext of id
<strong>supplyChain</strong>, then you can just use the URIs
<strong>supplyChain:invoices</strong> or
<strong>supplyChain:purchaseOrders</strong> to omit the physical endpoint kind
and use pure logical URIs.</li></ul><p>You can append query options to the URI
in the following format,
<code>?option=value&option=value&...</code></p><h3
id="BookComponentAppendix-Example">Example</h3><p>In this example we'll create
a black box context, then we'll use it from another CamelContext.</p><h4
id="BookCom
ponentAppendix-Definingthecontextcomponent">Defining the context
component</h4><p>First you need to create a CamelContext, add some routes in
it, start it and then register the CamelContext into the <a shape="rect"
href="registry.html">Registry</a> (JNDI, Spring, Guice or OSGi etc).</p><p>This
can be done in the usual Camel way from this <a shape="rect"
class="external-link"
href="http://svn.apache.org/viewvc/camel/trunk/components/camel-context/src/test/java/org/apache/camel/component/context/JavaDslBlackBoxTest.java?revision=1069442&view=markup">test
case</a> (see the createRegistry() method); this example shows Java and JNDI
being used...</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[// lets create our black box as a camel
context and a set of routes
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[// lets create our black box as a camel
context and a set of routes
DefaultCamelContext blackBox = new DefaultCamelContext(registry);
blackBox.setName("blackBox");
blackBox.addRoutes(new RouteBuilder() {
@@ -675,7 +675,7 @@ blackBox.start();
registry.bind("accounts", blackBox);
]]></script>
</div></div><p>Notice in the above route we are using pure local endpoints
(<strong>direct</strong> and <strong>seda</strong>). Also note we expose this
CamelContext using the <strong>accounts</strong> ID. We can do the same thing
in Spring via</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[<camelContext id="accounts"
xmlns="http://camel.apache.org/schema/spring">
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[<camelContext id="accounts"
xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="direct:purchaseOrder"/>
...
@@ -684,7 +684,7 @@ registry.bind("accounts", blac
</camelContext>
]]></script>
</div></div><h4 id="BookComponentAppendix-Usingthecontextcomponent">Using the
context component</h4><p>Then in another CamelContext we can then refer to this
"accounts black box" by just sending to <strong>accounts:purchaseOrder</strong>
and consuming from <strong>accounts:invoice</strong>.</p><p>If you prefer to be
more verbose and explicit you could use
<strong>context:accounts:purchaseOrder</strong> or even
<strong>context:accounts:direct://purchaseOrder</strong> if you prefer. But
using logical endpoint URIs is preferred as it hides the implementation detail
and provides a simple logical naming scheme.</p><p>For example if we wish to
then expose this accounts black box on some middleware (outside of the black
box) we can do things like...</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[<camelContext
xmlns="http://camel.apache.org/schema/spring">
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[<camelContext
xmlns="http://camel.apache.org/schema/spring">
<route>
<!-- consume from an ActiveMQ into the black box -->
<from uri="activemq:Accounts.PurchaseOrders"/>
@@ -895,18 +895,18 @@ Payload:
</Customer>
</plain-text-body><p>Will print the message:</p><parameter
ac:name="language">xml</parameter><plain-text-body>Request: type=gold,
active=true, customerData=<Customer.toString() representation>
</plain-text-body><p>For more examples on how to process requests and write
responses can be found <a shape="rect" class="external-link"
href="https://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/simplebinding/">here</a>.</p><h3
id="BookComponentAppendix-ConsumingaRESTRequest-DefaultBindingStyle">Consuming
a REST Request - Default Binding Style</h3><p>The <a shape="rect"
class="external-link" href="https://cwiki.apache.org/CXF20DOC/JAX-RS">CXF JAXRS
front end</a> implements the <a shape="rect" class="external-link"
href="https://jsr311.java.net/" rel="nofollow">JAX-RS (JSR-311) API</a>, so we
can export the resources classes as a REST service. And we leverage the <a
shape="rect" class="external-link"
href="http://cwiki.apache.org/confluence/display/CXF20DOC/Invokers">CXF Invoker
API</a> to turn a REST request into a normal Java object method invocation.<br
clear="none"> Unlike the <a shape="rect" href="restlet.html
">Camel Restlet</a> component, you don't need to specify the URI template
within your endpoint, CXF takes care of the REST request URI to resource class
method mapping according to the JSR-311 specification. All you need to do in
Camel is delegate this method request to a right processor or
endpoint.</p><p>Here is an example of a CXFRS
route...<plain-text-body>{snippet:id=example|lang=java|url=camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsConsumerTest.java}</plain-text-body>And
the corresponding resource class used to configure the
endpoint...</p><parameter ac:name="title">Note about resource
classes</parameter><rich-text-body><p>By default, JAX-RS resource classes are
<strong>only </strong>used to configure JAX-RS properties. Methods will
<strong>not</strong> be executed during routing of messages to the endpoint.
Instead, it is the responsibility of the route to do all processing.</p><p>Note
that starting from Camel 2.15 it is also s
ufficient to provide an interface only as opposed to a no-op service
implementation class for the default mode.</p><p>Starting from Camel 2.15, if a
<strong>performInvocation</strong> option is enabled, the service
implementation will be invoked first, the response will be set on the Camel
exchange and the route execution will continue as usual. This can be useful
for</p><p>integrating the existing JAX-RS implementations into Camel routes and
for post-processing JAX-RS Responses in custom
processors.</p><p> </p></rich-text-body><p><plain-text-body>{snippet:id=example|lang=java|url=camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/testbean/CustomerServiceResource.java}</plain-text-body></p><h3
id="BookComponentAppendix-HowtoinvoketheRESTservicethroughcamel-cxfrsproducer">How
to invoke the REST service through camel-cxfrs producer</h3><p>The <a
shape="rect" class="external-link"
href="https://cwiki.apache.org/CXF20DOC/JAX-RS">CXF JAXRS front
end</a> implements <a shape="rect" class="external-link"
href="https://cwiki.apache.org/CXF20DOC/JAX-RS+Client+API#JAX-RSClientAPI-Proxy-basedAPI">a
proxy-based client API</a>, with this API you can invoke the remote REST
service through a proxy. The <code>camel-cxfrs</code> producer is based on
this <a shape="rect" class="external-link"
href="https://cwiki.apache.org/CXF20DOC/JAX-RS+Client+API#JAX-RSClientAPI-Proxy-basedAPI">proxy
API</a>.<br clear="none"> You just need to specify the operation name in the
message header and prepare the parameter in the message body, the
<span>camel-cxfrs</span> producer will generate right REST request for
you.</p><p>Here is an
example:<plain-text-body>{snippet:id=ProxyExample|lang=java|url=camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerTest.java}</plain-text-body>The <a
shape="rect" class="external-link"
href="https://cwiki.apache.org/CXF20DOC/JAX-RS">CXF JAXRS front end</a> also p
rovides <a shape="rect"
href="https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+Client+API#JAX-RSClientAPI-CXFWebClientAPI">a
http centric client API</a>. You can also invoke this API from
<code>camel-cxfrs</code> producer. You need to specify the <a shape="rect"
class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Exchange.html#HTTP_PATH">HTTP_PATH</a>
and the <a shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Exchange.html#HTTP_METHOD">HTTP_METHOD</a> and
let the producer use the http centric client API by using the URI option
<strong>httpClientAPI</strong> or by setting the message header <a shape="rect"
class="external-link"
href="http://camel.apache.org/maven/current/camel-cxf/apidocs/org/apache/camel/component/cxf/CxfConstants.html#CAMEL_CXF_RS_USING_HTTP_API">CxfConstants.CAMEL_CXF_RS_USING_HTTP_API</a>.
You can turn the response ob
ject to the type class specified with the message header <a shape="rect"
class="external-link"
href="http://camel.apache.org/maven/current/camel-cxf/apidocs/org/apache/camel/component/cxf/CxfConstants.html#CAMEL_CXF_RS_RESPONSE_CLASS">CxfConstants.CAMEL_CXF_RS_RESPONSE_CLASS</a>.<plain-text-body>{snippet:id=HttpExample|lang=java|url=camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerTest.java}</plain-text-body>From
Camel 2.1, we also support to specify the query parameters from cxfrs URI for
the CXFRS http centric
client.<plain-text-body>{snippet:id=QueryExample|lang=java|url=camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerTest.java}</plain-text-body>To
support the Dynamical routing, you can override the URI's query parameters by
using the CxfConstants.CAMEL_CXF_RS_QUERY_MAP header to set the parameter map
for it.<plain-text-body>{snippet:id=QueryMapExample|lang=java|url=camel/trunk/c
omponents/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerTest.java}</plain-text-body></p>
<h2 id="BookComponentAppendix-DataSetComponent">DataSet Component</h2><p><a
shape="rect" href="testing.html">Testing</a> of distributed and asynchronous
processing is notoriously difficult. The <a shape="rect"
href="mock.html">Mock</a>, <a shape="rect" href="test.html">Test</a> and <a
shape="rect" href="dataset.html">DataSet</a> endpoints work great with the <a
shape="rect" href="testing.html">Camel Testing Framework</a> to simplify your
unit and integration testing using <a shape="rect"
href="enterprise-integration-patterns.html">Enterprise Integration Patterns</a>
and Camel's large range of <a shape="rect"
href="components.html">Components</a> together with the powerful <a
shape="rect" href="bean-integration.html">Bean Integration</a>.</p><p>The
DataSet component provides a mechanism to easily perform load & soak
testing of your system. It works by allowing you
to create <a shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/component/dataset/DataSet.html">DataSet
instances</a> both as a source of messages and as a way to assert that the
data set is received.</p><p>Camel will use the <a shape="rect"
href="log.html">throughput logger</a> when sending dataset's.</p><h3
id="BookComponentAppendix-URIformat.13">URI format</h3><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[dataset:name[?options]
+<script class="brush: bash; gutter: false; theme: Confluence"
type="syntaxhighlighter"><![CDATA[dataset:name[?options]
]]></script>
[... 2584 lines stripped ...]