You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bu...@apache.org on 2017/08/16 21:20:50 UTC
svn commit: r1016915 [1/2] - in /websites/production/camel/content:
activemq.html book-component-appendix.html book-in-one-page.html
cache/main.pageCache
Author: buildbot
Date: Wed Aug 16 21:20:50 2017
New Revision: 1016915
Log:
Production update by buildbot for camel
Modified:
websites/production/camel/content/activemq.html
websites/production/camel/content/book-component-appendix.html
websites/production/camel/content/book-in-one-page.html
websites/production/camel/content/cache/main.pageCache
Modified: websites/production/camel/content/activemq.html
==============================================================================
--- websites/production/camel/content/activemq.html (original)
+++ websites/production/camel/content/activemq.html Wed Aug 16 21:20:50 2017
@@ -85,77 +85,71 @@
<tbody>
<tr>
<td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 id="ActiveMQ-ActiveMQComponent">ActiveMQ Component</h2><p>The ActiveMQ component allows messages to be sent to a <a shape="rect" class="external-link" href="http://java.sun.com/products/jms/" rel="nofollow">JMS</a> Queue or Topic or messages to be consumed from a JMS Queue or Topic using <a shape="rect" class="external-link" href="http://activemq.apache.org/" title="The most popular and powerful open source message broker">Apache ActiveMQ</a>.</p><p>This component is based on <a shape="rect" href="jms.html">JMS Component</a> and uses Spring's JMS support for declarative transactions, using Spring's <code>JmsTemplate</code> for sending and a <code>MessageListenerContainer</code> for consuming. All the options from the <a shape="rect" href="jms.html">JMS</a> component also applies for this component.</p><p>To use this component make sure you have the <code>activemq.jar</code> or <code>activemq-core.jar</code> on your classpath along with any C
amel dependencies such as <code>camel-core.jar</code>, <code>camel-spring.jar</code> and <code>camel-jms.jar</code>.</p><div class="confluence-information-macro confluence-information-macro-tip"><p class="title">Transacted and caching</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>See section <em>Transactions and Cache Levels</em> below on <a shape="rect" href="jms.html">JMS</a> page if you are using transactions with <a shape="rect" href="jms.html">JMS</a> as it can impact performance.</p></div></div><h3 id="ActiveMQ-URIformat">URI format</h3><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<div class="wiki-content maincontent"><h2 id="ActiveMQ-ActiveMQComponent">ActiveMQ Component</h2><p>The ActiveMQ component allows messages to be sent to a <a shape="rect" class="external-link" href="http://java.sun.com/products/jms/" rel="nofollow">JMS</a> Queue or Topic or messages to be consumed from a JMS Queue or Topic using <a shape="rect" class="external-link" href="http://activemq.apache.org/" title="The most popular and powerful open source message broker">Apache ActiveMQ</a>. This component is based on <a shape="rect" href="jms.html">JMS Component</a> and uses Spring's JMS support for declarative transactions, using Spring's <strong><code>JmsTemplate</code></strong> for sending and a <strong><code>MessageListenerContainer</code></strong> for consuming. All the options from the <a shape="rect" href="jms.html">JMS</a> component also applies for this component.</p><p>To use this component make sure you have the <strong><code>activemq.jar</code></strong> or <strong><code>active
mq-core.jar</code></strong> on your classpath along with any Camel dependencies such as <strong><code>camel-core.jar</code></strong>, <strong><code>camel-spring.jar</code></strong> and <strong><code>camel-jms.jar</code></strong>.</p><div class="confluence-information-macro confluence-information-macro-tip"><p class="title">Transacted and caching</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>See section <em>Transactions and Cache Levels</em> below on <a shape="rect" href="jms.html">JMS</a> page if you are using transactions with <a shape="rect" href="jms.html">JMS</a> as it can impact performance.</p></div></div><h3 id="ActiveMQ-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[activemq:[queue:|topic:]destinationName
]]></script>
-</div></div><p>Where <strong>destinationName</strong> is an ActiveMQ queue or topic name. By default, the <strong>destinationName</strong> is interpreted as a queue name. For example, to connect to the queue, <code>FOO.BAR</code>, use:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>Where <strong><code>destinationName</code></strong> is an ActiveMQ queue or topic name. By default, the <strong><code>destinationName</code></strong> is interpreted as a queue name. For example, to connect to the queue, <strong><code>FOO.BAR</code></strong>, use:</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[activemq:FOO.BAR
]]></script>
-</div></div><p>You can include the optional <code>queue:</code> prefix, if you prefer:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>You can include the optional <strong><code>queue:</code></strong> prefix, if you prefer:</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[activemq:queue:FOO.BAR
]]></script>
-</div></div><p>To connect to a topic, you must include the <code>topic:</code> prefix. For example, to connect to the topic, <code>Stocks.Prices</code>, use:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>To connect to a topic, you must include the <strong><code>topic:</code></strong> prefix. For example, to connect to the topic, <strong><code>Stocks.Prices</code></strong>, use:</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[activemq:topic:Stocks.Prices
]]></script>
-</div></div><h3 id="ActiveMQ-Options">Options</h3><p>See Options on the <a shape="rect" href="jms.html">JMS</a> component as all these options also apply for this component.</p><h3 id="ActiveMQ-ConfiguringtheConnectionFactory">Configuring the Connection Factory</h3><p>This <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/activemq/trunk/activemq-camel/src/test/java/org/apache/activemq/camel/component/ActiveMQRouteTest.java">test case</a> shows how to add an ActiveMQComponent to the <a shape="rect" href="camelcontext.html">CamelContext</a> 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="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 id="ActiveMQ-Options">Options</h3><p>See Options on the <a shape="rect" href="jms.html">JMS</a> component as all these options also apply for this component.</p><h3 id="ActiveMQ-ConfiguringtheConnectionFactory">Configuring the Connection Factory</h3><p>This <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/activemq/trunk/activemq-camel/src/test/java/org/apache/activemq/camel/component/ActiveMQRouteTest.java">test case</a> shows how to add an <strong><code>ActiveMQComponent</code></strong> to the <a shape="rect" href="camelcontext.html">CamelContext</a> 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="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[camelContext.addComponent("activemq", activeMQComponent("vm://localhost?broker.persistent=false"));
]]></script>
-</div></div><h3 id="ActiveMQ-ConfiguringtheConnectionFactoryusingSpringXML">Configuring the Connection Factory using Spring XML</h3><p>You can configure the ActiveMQ broker URL on the ActiveMQComponent as follows</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 id="ActiveMQ-ConfiguringtheConnectionFactoryusingSpringXML">Configuring the Connection Factory using Spring XML</h3><p>You can configure the ActiveMQ broker URL on the <strong><code>ActiveMQComponent</code></strong> as follows</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[<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
- http://camel.apache.org/schema/spring
- http://camel.apache.org/schema/spring/camel-spring.xsd">
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://camel.apache.org/schema/spring
+ http://camel.apache.org/schema/spring/camel-spring.xsd">
<camelContext xmlns="http://camel.apache.org/schema/spring">
</camelContext>
- <bean id="activemq"
- class="org.apache.activemq.camel.component.ActiveMQComponent">
+ <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="brokerURL" value="tcp://somehost:61616"/>
</bean>
-
</beans>
]]></script>
-</div></div><h3 id="ActiveMQ-Usingconnectionpooling">Using connection pooling</h3><p>When sending to an ActiveMQ broker using Camel it's recommended to use a pooled connection factory to efficiently handle pooling of JMS connections, sessions and producers. This is documented on the <a shape="rect" class="external-link" href="http://activemq.apache.org/spring-support.html">ActiveMQ Spring Support </a> page.</p><p>You can grab ActiveMQ's <code>org.apache.activemq.pool.PooledConnectionFactory</code> with Maven:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 id="ActiveMQ-UsingConnectionPooling">Using Connection Pooling</h3><p>When sending to an ActiveMQ broker using Camel it's recommended to use a pooled connection factory to efficiently handle pooling of JMS connections, sessions and producers. This is documented on the <a shape="rect" class="external-link" href="http://activemq.apache.org/spring-support.html">ActiveMQ Spring Support </a> page.</p><p>You can grab ActiveMQ's <strong><code>org.apache.activemq.pool.PooledConnectionFactory</code></strong> with Maven:</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>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-pool</artifactId>
<version>5.6.0</version>
</dependency>
]]></script>
-</div></div><p>And then setup the <strong>activemq</strong> Camel component as follows:</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.activemq.ActiveMQConnectionFactory">
- <property name="brokerURL" value="tcp://localhost:61616" />
+</div></div><p>And then setup the <strong><code>activemq</code></strong> Camel component as follows:</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.activemq.ActiveMQConnectionFactory">
+ <property name="brokerURL" value="tcp://localhost:61616"/>
</bean>
-<bean id="pooledConnectionFactory"
- class="org.apache.activemq.pool.PooledConnectionFactory" init-method="start" destroy-method="stop">
- <property name="maxConnections" value="8" />
- <property name="connectionFactory" ref="jmsConnectionFactory" />
+<bean id="pooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" init-method="start" destroy-method="stop">
+ <property name="maxConnections" value="8"/>
+ <property name="connectionFactory" ref="jmsConnectionFactory"/>
</bean>
-<bean id="jmsConfig"
- class="org.apache.camel.component.jms.JmsConfiguration">
+<bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="pooledConnectionFactory"/>
<property name="concurrentConsumers" value="10"/>
</bean>
-<bean id="activemq"
- class="org.apache.activemq.camel.component.ActiveMQComponent">
+<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="configuration" ref="jmsConfig"/>
- <!-- if we are using transacted then enable CACHE_CONSUMER (if not using XA) to run faster
- see more details at: http://camel.apache.org/jms
- <property name="transacted" value="true"/>
- <property name="cacheLevelName" value="CACHE_CONSUMER" />
+ <!-- If transacted=true then enable CACHE_CONSUMER (if not using XA) to run faster.
+ See more details at: http://camel.apache.org/jms -->
+ <!--
+ Â <property name="transacted" value="true"/>
+ <property name="cacheLevelName" value="CACHE_CONSUMER"/>
-->
</bean>
]]></script>
-</div></div><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>Notice the <strong>init</strong> and <strong>destroy</strong> methods on the pooled connection factory. This is important to ensure the connection pool is properly started and shutdown.</p></div></div><div class="confluence-information-macro confluence-information-macro-information"><p class="title">Important information about when using transactions</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>If you are using transactions then see more details at <a shape="rect" href="jms.html">JMS</a>. And remember to set <code>cacheLevelName</code> to <code>CACHE_CONSUMER</code> if you are not using XA transactions. This can dramatically improve performance.<
/p></div></div><p>The <code>PooledConnectionFactory</code> will then create a connection pool with up to 8 connections in use at the same time. Each connection can be shared by many sessions. There is an option named <code>maximumActive</code> you can use to configure the maximum number of sessions per connection; the default value is <code>500</code>. From <strong>ActiveMQ 5.7</strong> onwards the option has been renamed to better reflect its purpose, being named as <code>maximumActiveSessionPerConnection</code>. Notice the <code>concurrentConsumers</code> is set to a higher value than <code>maxConnections</code> is. This is okay, as each consumer is using a session, and as a session can share the same connection, we are in the safe. In this example we can have 8 * 500 = 4000 active sessions at the same time.</p><h3 id="ActiveMQ-InvokingMessageListenerPOJOsinaCamelroute">Invoking MessageListener POJOs in a Camel route</h3><p>The ActiveMQ component also provides a helper <a shape="r
ect" href="type-converter.html">Type Converter</a> from a JMS MessageListener to a <a shape="rect" href="processor.html">Processor</a>. This means that the <a shape="rect" href="bean.html">Bean</a> component is capable of invoking any JMS MessageListener bean directly inside any route.</p><p>So for example you can create a MessageListener in JMS like this:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><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>Notice the <strong><code>init</code></strong> and <strong><code>destroy</code></strong> methods on the pooled connection factory. This is important to ensure the connection pool is properly started and shutdown.</p></div></div><div class="confluence-information-macro confluence-information-macro-information"><p class="title">Important information about when using transactions</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>If you are using transactions then see more details at <a shape="rect" href="jms.html">JMS</a>. And remember to set <strong><code>cacheLevelName</code></strong> to <strong><code>CACHE_CONSUMER</code></strong> if you are
not using XA transactions. This can dramatically improve performance.</p></div></div><p>The <strong><code>PooledConnectionFactory</code></strong> will then create a connection pool with up to 8 connections in use at the same time. Each connection can be shared by many sessions. There is an option named <strong><code>maximumActive</code></strong> you can use to configure the maximum number of sessions per connection; the default value is <strong><code>500</code></strong>. From <strong>ActiveMQ 5.7</strong>: the option has been renamed to better reflect its purpose, being named as <strong><code>maximumActiveSessionPerConnection</code></strong>. Notice the <strong><code>concurrentConsumers</code></strong> is set to a higher value than <strong><code>maxConnections</code></strong> is. This is okay, as each consumer is using a session, and as a session can share the same connection, we are in the safe. In this example we can have <strong><code>8 * 500 = 4000</code></strong> active se
ssions at the same time.</p><h3 id="ActiveMQ-InvokingMessageListenerPOJOsinaCamelroute">Invoking MessageListener POJOs in a Camel route</h3><p>The ActiveMQ component also provides a helper <a shape="rect" href="type-converter.html">Type Converter</a> from a JMS <strong><code>MessageListener</code></strong> to a <a shape="rect" href="processor.html">Processor</a>. This means that the <a shape="rect" href="bean.html">Bean</a> component is capable of invoking any JMS <strong><code>MessageListener</code></strong> bean directly inside any route.</p><p>So for example you can create a <strong><code>MessageListener</code></strong> in JMS 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[public class MyListener implements MessageListener {
public void onMessage(Message jmsMessage) {
// ...
@@ -163,42 +157,69 @@
}
]]></script>
</div></div><p>Then use it in your Camel route 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("file://foo/bar").
- bean(MyListener.class);
+<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[from("file://foo/bar")
+ .bean(MyListener.class);
]]></script>
-</div></div><p>That is, you can reuse any of the Camel <a shape="rect" href="components.html">Components</a> and easily integrate them into your JMS <code>MessageListener</code> POJO!</p><h3 id="ActiveMQ-UsingActiveMQDestinationOptions">Using ActiveMQ Destination Options</h3><p><strong>Available as of ActiveMQ 5.6</strong></p><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><p> </p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>That is, you can reuse any of the Camel <a shape="rect" href="components.html">Components</a> and easily integrate them into your JMS <strong><code>MessageListener</code></strong> POJO!</p><h3 id="ActiveMQ-UsingActiveMQDestinationOptions">Using ActiveMQ Destination Options</h3><p><strong>Available as of ActiveMQ 5.6</strong></p><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 <strong><code>destination.</code></strong> prefix. For example to mark a consumer as exclusive, and set its prefetch size to <strong><code>50</code></strong>, you can do as follows:</p><p> </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 uri="activemq:foo?destination.consumer.exclusive=true&amp;destination.consumer.prefetchSize=50"/>]]></script>
-</div></div><h3 id="ActiveMQ-ConsumingAdvisoryMessages">Consuming Advisory Messages</h3><p>ActiveMQ can generate <a shape="rect" class="external-link" href="http://activemq.apache.org/advisory-message.html">Advisory messages </a> which are put in topics that you can consume. Such messages can help you send alerts in case you detect slow consumers or to build statistics (number of messages/produced per day, etc.) The following Spring DSL example shows you how to read messages from a topic.</p><p>The below route starts by reading the topic <em>ActiveMQ.Advisory.Connection</em>. To watch another topic, simply change the name according to the name provided in ActiveMQ Advisory Messages documentation. The parameter mapJmsMessage=false allows for converting the org.apache.activemq.command.ActiveMqMessage object from the jms queue. Next, the body received is converted into a String for the purposes of this example and a carriage return is added. Finally, the string is added to a file</p><d
iv class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 id="ActiveMQ-ConsumingAdvisoryMessages">Consuming Advisory Messages</h3><p>ActiveMQ can generate <a shape="rect" class="external-link" href="http://activemq.apache.org/advisory-message.html">Advisory messages </a> which are put in topics that you can consume. Such messages can help you send alerts in case you detect slow consumers or to build statistics (number of messages/produced per day, etc.) The following Spring DSL example shows you how to read messages from a topic.</p><p>The below route starts by reading the topic <em>ActiveMQ.Advisory.Connection</em>. To watch another topic, simply change the name according to the name provided in ActiveMQ Advisory Messages documentation. The parameter <strong><code>mapJmsMessage=false</code></strong> allows for converting the <strong><code>org.apache.activemq.command.ActiveMqMessage</code></strong> object from the JMS queue. Next, the body received is converted into a String for the purposes of this example and a
carriage return is added. Finally, the string is added to a file</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[<route>
- <from uri="activemq:topic:ActiveMQ.Advisory.Connection?mapJmsMessage=false" />
+ <from uri="activemq:topic:ActiveMQ.Advisory.Connection?mapJmsMessage=false"/>
<convertBodyTo type="java.lang.String"/>
<transform>
<simple>${in.body}&#13;</simple>
</transform>
- <to uri="file://data/activemq/?fileExist=Append&amp;fileName=advisoryConnection-${date:now:yyyyMMdd}.txt" />
+ <to uri="file://data/activemq/?fileExist=Append&amp;fileName=advisoryConnection-${date:now:yyyyMMdd}.txt"/>
</route>
]]></script>
-</div></div><p>If you consume a message on a queue, you should see the following files under the data/activemq folder :</p><p>advisoryConnection-20100312.txt<br clear="none"> advisoryProducer-20100312.txt</p><p>and containing string:</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[ActiveMQMessage {commandId = 0, responseRequired = false,
-messageId = ID:dell-charles-3258-1268399815140
--1:0:0:0:221, originalDestination = null, originalTransactionId = null,
+</div></div><p>If you consume a message on a queue, you should see the following files under the <strong><code>data/activemq</code></strong> folder :</p><p><strong><code>advisoryConnection-20100312.txt</code></strong><br clear="none"><strong><code>advisoryProducer-20100312.txt</code></strong></p><p>containing the following string:</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[ActiveMQMessage {
+commandId = 0,
+responseRequired = false,
+messageId = ID:dell-charles-3258-1268399815140-1:0:0:0:221,
+originalDestination = null,
+originalTransactionId = null,
producerId = ID:dell-charles-3258-1268399815140-1:0:0:0,
-destination = topic://ActiveMQ.Advisory.Connection, transactionId = null,
-expiration = 0, timestamp = 0, arrival = 0, brokerInTime = 1268403383468,
-brokerOutTime = 1268403383468, correlationId = null, replyTo = null,
-persistent = false, type = Advisory, priority = 0, groupID = null, groupSequence = 0,
-targetConsumerId = null, compressed = false, userID = null, content = null,
+destination = topic://ActiveMQ.Advisory.Connection,
+transactionId = null,
+expiration = 0,
+timestamp = 0,
+arrival = 0,
+brokerInTime = 1268403383468,
+brokerOutTime = 1268403383468,
+correlationId = null,
+replyTo = null,
+persistent = false,
+type = Advisory,
+priority = 0,
+groupID = null,
+groupSequence = 0,
+targetConsumerId = null,
+compressed = false,
+userID = null,
+content = null,
marshalledProperties = org.apache.activemq.util.ByteSequence@17e2705,
-dataStructure = ConnectionInfo {commandId = 1, responseRequired = true,
-connectionId = ID:dell-charles-3258-1268399815140-2:50,
-clientId = ID:dell-charles-3258-1268399815140-14:0, userName = , password = *****,
-brokerPath = null, brokerMasterConnector = false, manageable = true,
-clientMaster = true}, redeliveryCounter = 0, size = 0, properties =
-{originBrokerName=master, originBrokerId=ID:dell-charles-3258-1268399815140-0:0,
-originBrokerURL=vm://master}, readOnlyProperties = true, readOnlyBody = true,
-droppable = false}
+dataStructure = ConnectionInfo {
+ commandId = 1,
+ responseRequired = true,
+ connectionId = ID:dell-charles-3258-1268399815140-2:50,
+ clientId = ID:dell-charles-3258-1268399815140-14:0,
+ userName = ,
+ password = *****,
+ brokerPath = null,
+ brokerMasterConnector = false,
+ manageable = true,
+ clientMaster = true
+},
+redeliveryCounter = 0,
+size = 0,
+properties = { originBrokerName=master, originBrokerId=ID:dell-charles-3258-1268399815140-0:0, originBrokerURL=vm://master },
+readOnlyProperties = true,
+readOnlyBody = true,
+droppable = false
+}
]]></script>
-</div></div><h3 id="ActiveMQ-GettingComponentJAR">Getting Component JAR</h3><p>You will need this dependency</p><ul class="alternate"><li><code>activemq-camel</code></li></ul><p><a shape="rect" href="activemq.html">ActiveMQ</a> is an extension of the <a shape="rect" href="jms.html">JMS</a> component released with the <a shape="rect" class="external-link" href="http://activemq.apache.org">ActiveMQ project</a>.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 id="ActiveMQ-GettingComponentJAR">Getting Component JAR</h3><p>You will need this dependency</p><ul class="alternate"><li><strong><code>activemq-camel</code></strong></li></ul><p><a shape="rect" href="activemq.html">ActiveMQ</a> is an extension of the <a shape="rect" href="jms.html">JMS</a> component released with the <a shape="rect" class="external-link" href="http://activemq.apache.org">ActiveMQ project</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[<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-camel</artifactId>
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 Aug 16 21:20:50 2017
@@ -87,77 +87,71 @@
<tbody>
<tr>
<td valign="top" width="100%">
-<div class="wiki-content maincontent"><div class="chapter" id="chapter-component-appendix"><h1 id="BookComponentAppendix-ComponentAppendix">Component Appendix</h1><p>There now follows the documentation on each Camel component.</p><h2 id="BookComponentAppendix-ActiveMQComponent">ActiveMQ Component</h2><p>The ActiveMQ component allows messages to be sent to a <a shape="rect" class="external-link" href="http://java.sun.com/products/jms/" rel="nofollow">JMS</a> Queue or Topic or messages to be consumed from a JMS Queue or Topic using <a shape="rect" class="external-link" href="http://activemq.apache.org/" title="The most popular and powerful open source message broker">Apache ActiveMQ</a>.</p><p>This component is based on <a shape="rect" href="jms.html">JMS Component</a> and uses Spring's JMS support for declarative transactions, using Spring's <code>JmsTemplate</code> for sending and a <code>MessageListenerContainer</code> for consuming. All the options from the <a shape="rect" href="j
ms.html">JMS</a> component also applies for this component.</p><p>To use this component make sure you have the <code>activemq.jar</code> or <code>activemq-core.jar</code> on your classpath along with any Camel dependencies such as <code>camel-core.jar</code>, <code>camel-spring.jar</code> and <code>camel-jms.jar</code>.</p><div class="confluence-information-macro confluence-information-macro-tip"><p class="title">Transacted and caching</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>See section <em>Transactions and Cache Levels</em> below on <a shape="rect" href="jms.html">JMS</a> page if you are using transactions with <a shape="rect" href="jms.html">JMS</a> as it can impact performance.</p></div></div><h3 id="BookComponentAppendix-URIformat">URI format</h3><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<div class="wiki-content maincontent"><div class="chapter" id="chapter-component-appendix"><h1 id="BookComponentAppendix-ComponentAppendix">Component Appendix</h1><p>There now follows the documentation on each Camel component.</p><h2 id="BookComponentAppendix-ActiveMQComponent">ActiveMQ Component</h2><p>The ActiveMQ component allows messages to be sent to a <a shape="rect" class="external-link" href="http://java.sun.com/products/jms/" rel="nofollow">JMS</a> Queue or Topic or messages to be consumed from a JMS Queue or Topic using <a shape="rect" class="external-link" href="http://activemq.apache.org/" title="The most popular and powerful open source message broker">Apache ActiveMQ</a>. This component is based on <a shape="rect" href="jms.html">JMS Component</a> and uses Spring's JMS support for declarative transactions, using Spring's <strong><code>JmsTemplate</code></strong> for sending and a <strong><code>MessageListenerContainer</code></strong> for consuming. All the options from
the <a shape="rect" href="jms.html">JMS</a> component also applies for this component.</p><p>To use this component make sure you have the <strong><code>activemq.jar</code></strong> or <strong><code>activemq-core.jar</code></strong> on your classpath along with any Camel dependencies such as <strong><code>camel-core.jar</code></strong>, <strong><code>camel-spring.jar</code></strong> and <strong><code>camel-jms.jar</code></strong>.</p><div class="confluence-information-macro confluence-information-macro-tip"><p class="title">Transacted and caching</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>See section <em>Transactions and Cache Levels</em> below on <a shape="rect" href="jms.html">JMS</a> page if you are using transactions with <a shape="rect" href="jms.html">JMS</a> as it can impact performance.</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[activemq:[queue:|topic:]destinationName
]]></script>
-</div></div><p>Where <strong>destinationName</strong> is an ActiveMQ queue or topic name. By default, the <strong>destinationName</strong> is interpreted as a queue name. For example, to connect to the queue, <code>FOO.BAR</code>, use:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>Where <strong><code>destinationName</code></strong> is an ActiveMQ queue or topic name. By default, the <strong><code>destinationName</code></strong> is interpreted as a queue name. For example, to connect to the queue, <strong><code>FOO.BAR</code></strong>, use:</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[activemq:FOO.BAR
]]></script>
-</div></div><p>You can include the optional <code>queue:</code> prefix, if you prefer:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>You can include the optional <strong><code>queue:</code></strong> prefix, if you prefer:</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[activemq:queue:FOO.BAR
]]></script>
-</div></div><p>To connect to a topic, you must include the <code>topic:</code> prefix. For example, to connect to the topic, <code>Stocks.Prices</code>, use:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>To connect to a topic, you must include the <strong><code>topic:</code></strong> prefix. For example, to connect to the topic, <strong><code>Stocks.Prices</code></strong>, use:</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[activemq:topic:Stocks.Prices
]]></script>
-</div></div><h3 id="BookComponentAppendix-Options">Options</h3><p>See Options on the <a shape="rect" href="jms.html">JMS</a> component as all these options also apply for this component.</p><h3 id="BookComponentAppendix-ConfiguringtheConnectionFactory">Configuring the Connection Factory</h3><p>This <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/activemq/trunk/activemq-camel/src/test/java/org/apache/activemq/camel/component/ActiveMQRouteTest.java">test case</a> shows how to add an ActiveMQComponent to the <a shape="rect" href="camelcontext.html">CamelContext</a> 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="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 id="BookComponentAppendix-Options">Options</h3><p>See Options on the <a shape="rect" href="jms.html">JMS</a> component as all these options also apply for this component.</p><h3 id="BookComponentAppendix-ConfiguringtheConnectionFactory">Configuring the Connection Factory</h3><p>This <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/activemq/trunk/activemq-camel/src/test/java/org/apache/activemq/camel/component/ActiveMQRouteTest.java">test case</a> shows how to add an <strong><code>ActiveMQComponent</code></strong> to the <a shape="rect" href="camelcontext.html">CamelContext</a> 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-t
ransports.html">brokerURL</a> used to connect to ActiveMQ.</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[camelContext.addComponent("activemq", activeMQComponent("vm://localhost?broker.persistent=false"));
]]></script>
-</div></div><h3 id="BookComponentAppendix-ConfiguringtheConnectionFactoryusingSpringXML">Configuring the Connection Factory using Spring XML</h3><p>You can configure the ActiveMQ broker URL on the ActiveMQComponent as follows</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 id="BookComponentAppendix-ConfiguringtheConnectionFactoryusingSpringXML">Configuring the Connection Factory using Spring XML</h3><p>You can configure the ActiveMQ broker URL on the <strong><code>ActiveMQComponent</code></strong> as follows</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[<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
- http://camel.apache.org/schema/spring
- http://camel.apache.org/schema/spring/camel-spring.xsd">
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://camel.apache.org/schema/spring
+ http://camel.apache.org/schema/spring/camel-spring.xsd">
<camelContext xmlns="http://camel.apache.org/schema/spring">
</camelContext>
- <bean id="activemq"
- class="org.apache.activemq.camel.component.ActiveMQComponent">
+ <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="brokerURL" value="tcp://somehost:61616"/>
</bean>
-
</beans>
]]></script>
-</div></div><h3 id="BookComponentAppendix-Usingconnectionpooling">Using connection pooling</h3><p>When sending to an ActiveMQ broker using Camel it's recommended to use a pooled connection factory to efficiently handle pooling of JMS connections, sessions and producers. This is documented on the <a shape="rect" class="external-link" href="http://activemq.apache.org/spring-support.html">ActiveMQ Spring Support </a> page.</p><p>You can grab ActiveMQ's <code>org.apache.activemq.pool.PooledConnectionFactory</code> with Maven:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 id="BookComponentAppendix-UsingConnectionPooling">Using Connection Pooling</h3><p>When sending to an ActiveMQ broker using Camel it's recommended to use a pooled connection factory to efficiently handle pooling of JMS connections, sessions and producers. This is documented on the <a shape="rect" class="external-link" href="http://activemq.apache.org/spring-support.html">ActiveMQ Spring Support </a> page.</p><p>You can grab ActiveMQ's <strong><code>org.apache.activemq.pool.PooledConnectionFactory</code></strong> with Maven:</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>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-pool</artifactId>
<version>5.6.0</version>
</dependency>
]]></script>
-</div></div><p>And then setup the <strong>activemq</strong> Camel component as follows:</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.activemq.ActiveMQConnectionFactory">
- <property name="brokerURL" value="tcp://localhost:61616" />
+</div></div><p>And then setup the <strong><code>activemq</code></strong> Camel component as follows:</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.activemq.ActiveMQConnectionFactory">
+ <property name="brokerURL" value="tcp://localhost:61616"/>
</bean>
-<bean id="pooledConnectionFactory"
- class="org.apache.activemq.pool.PooledConnectionFactory" init-method="start" destroy-method="stop">
- <property name="maxConnections" value="8" />
- <property name="connectionFactory" ref="jmsConnectionFactory" />
+<bean id="pooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" init-method="start" destroy-method="stop">
+ <property name="maxConnections" value="8"/>
+ <property name="connectionFactory" ref="jmsConnectionFactory"/>
</bean>
-<bean id="jmsConfig"
- class="org.apache.camel.component.jms.JmsConfiguration">
+<bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="pooledConnectionFactory"/>
<property name="concurrentConsumers" value="10"/>
</bean>
-<bean id="activemq"
- class="org.apache.activemq.camel.component.ActiveMQComponent">
+<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="configuration" ref="jmsConfig"/>
- <!-- if we are using transacted then enable CACHE_CONSUMER (if not using XA) to run faster
- see more details at: http://camel.apache.org/jms
- <property name="transacted" value="true"/>
- <property name="cacheLevelName" value="CACHE_CONSUMER" />
+ <!-- If transacted=true then enable CACHE_CONSUMER (if not using XA) to run faster.
+ See more details at: http://camel.apache.org/jms -->
+ <!--
+ Â <property name="transacted" value="true"/>
+ <property name="cacheLevelName" value="CACHE_CONSUMER"/>
-->
</bean>
]]></script>
-</div></div><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>Notice the <strong>init</strong> and <strong>destroy</strong> methods on the pooled connection factory. This is important to ensure the connection pool is properly started and shutdown.</p></div></div><div class="confluence-information-macro confluence-information-macro-information"><p class="title">Important information about when using transactions</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>If you are using transactions then see more details at <a shape="rect" href="jms.html">JMS</a>. And remember to set <code>cacheLevelName</code> to <code>CACHE_CONSUMER</code> if you are not using XA transactions. This can dramatically improve performance.<
/p></div></div><p>The <code>PooledConnectionFactory</code> will then create a connection pool with up to 8 connections in use at the same time. Each connection can be shared by many sessions. There is an option named <code>maximumActive</code> you can use to configure the maximum number of sessions per connection; the default value is <code>500</code>. From <strong>ActiveMQ 5.7</strong> onwards the option has been renamed to better reflect its purpose, being named as <code>maximumActiveSessionPerConnection</code>. Notice the <code>concurrentConsumers</code> is set to a higher value than <code>maxConnections</code> is. This is okay, as each consumer is using a session, and as a session can share the same connection, we are in the safe. In this example we can have 8 * 500 = 4000 active sessions at the same time.</p><h3 id="BookComponentAppendix-InvokingMessageListenerPOJOsinaCamelroute">Invoking MessageListener POJOs in a Camel route</h3><p>The ActiveMQ component also provides a helpe
r <a shape="rect" href="type-converter.html">Type Converter</a> from a JMS MessageListener to a <a shape="rect" href="processor.html">Processor</a>. This means that the <a shape="rect" href="bean.html">Bean</a> component is capable of invoking any JMS MessageListener bean directly inside any route.</p><p>So for example you can create a MessageListener in JMS like this:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><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>Notice the <strong><code>init</code></strong> and <strong><code>destroy</code></strong> methods on the pooled connection factory. This is important to ensure the connection pool is properly started and shutdown.</p></div></div><div class="confluence-information-macro confluence-information-macro-information"><p class="title">Important information about when using transactions</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>If you are using transactions then see more details at <a shape="rect" href="jms.html">JMS</a>. And remember to set <strong><code>cacheLevelName</code></strong> to <strong><code>CACHE_CONSUMER</code></strong> if you are
not using XA transactions. This can dramatically improve performance.</p></div></div><p>The <strong><code>PooledConnectionFactory</code></strong> will then create a connection pool with up to 8 connections in use at the same time. Each connection can be shared by many sessions. There is an option named <strong><code>maximumActive</code></strong> you can use to configure the maximum number of sessions per connection; the default value is <strong><code>500</code></strong>. From <strong>ActiveMQ 5.7</strong>: the option has been renamed to better reflect its purpose, being named as <strong><code>maximumActiveSessionPerConnection</code></strong>. Notice the <strong><code>concurrentConsumers</code></strong> is set to a higher value than <strong><code>maxConnections</code></strong> is. This is okay, as each consumer is using a session, and as a session can share the same connection, we are in the safe. In this example we can have <strong><code>8 * 500 = 4000</code></strong> active se
ssions at the same time.</p><h3 id="BookComponentAppendix-InvokingMessageListenerPOJOsinaCamelroute">Invoking MessageListener POJOs in a Camel route</h3><p>The ActiveMQ component also provides a helper <a shape="rect" href="type-converter.html">Type Converter</a> from a JMS <strong><code>MessageListener</code></strong> to a <a shape="rect" href="processor.html">Processor</a>. This means that the <a shape="rect" href="bean.html">Bean</a> component is capable of invoking any JMS <strong><code>MessageListener</code></strong> bean directly inside any route.</p><p>So for example you can create a <strong><code>MessageListener</code></strong> in JMS 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[public class MyListener implements MessageListener {
public void onMessage(Message jmsMessage) {
// ...
@@ -165,42 +159,69 @@
}
]]></script>
</div></div><p>Then use it in your Camel route 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("file://foo/bar").
- bean(MyListener.class);
+<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[from("file://foo/bar")
+ .bean(MyListener.class);
]]></script>
-</div></div><p>That is, you can reuse any of the Camel <a shape="rect" href="components.html">Components</a> and easily integrate them into your JMS <code>MessageListener</code> POJO!</p><h3 id="BookComponentAppendix-UsingActiveMQDestinationOptions">Using ActiveMQ Destination Options</h3><p><strong>Available as of ActiveMQ 5.6</strong></p><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><p> </p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>That is, you can reuse any of the Camel <a shape="rect" href="components.html">Components</a> and easily integrate them into your JMS <strong><code>MessageListener</code></strong> POJO!</p><h3 id="BookComponentAppendix-UsingActiveMQDestinationOptions">Using ActiveMQ Destination Options</h3><p><strong>Available as of ActiveMQ 5.6</strong></p><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 <strong><code>destination.</code></strong> prefix. For example to mark a consumer as exclusive, and set its prefetch size to <strong><code>50</code></strong>, you can do as follows:</p><p> </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 uri="activemq:foo?destination.consumer.exclusive=true&amp;destination.consumer.prefetchSize=50"/>]]></script>
-</div></div><h3 id="BookComponentAppendix-ConsumingAdvisoryMessages">Consuming Advisory Messages</h3><p>ActiveMQ can generate <a shape="rect" class="external-link" href="http://activemq.apache.org/advisory-message.html">Advisory messages </a> which are put in topics that you can consume. Such messages can help you send alerts in case you detect slow consumers or to build statistics (number of messages/produced per day, etc.) The following Spring DSL example shows you how to read messages from a topic.</p><p>The below route starts by reading the topic <em>ActiveMQ.Advisory.Connection</em>. To watch another topic, simply change the name according to the name provided in ActiveMQ Advisory Messages documentation. The parameter mapJmsMessage=false allows for converting the org.apache.activemq.command.ActiveMqMessage object from the jms queue. Next, the body received is converted into a String for the purposes of this example and a carriage return is added. Finally, the string is added to
a file</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 id="BookComponentAppendix-ConsumingAdvisoryMessages">Consuming Advisory Messages</h3><p>ActiveMQ can generate <a shape="rect" class="external-link" href="http://activemq.apache.org/advisory-message.html">Advisory messages </a> which are put in topics that you can consume. Such messages can help you send alerts in case you detect slow consumers or to build statistics (number of messages/produced per day, etc.) The following Spring DSL example shows you how to read messages from a topic.</p><p>The below route starts by reading the topic <em>ActiveMQ.Advisory.Connection</em>. To watch another topic, simply change the name according to the name provided in ActiveMQ Advisory Messages documentation. The parameter <strong><code>mapJmsMessage=false</code></strong> allows for converting the <strong><code>org.apache.activemq.command.ActiveMqMessage</code></strong> object from the JMS queue. Next, the body received is converted into a String for the purposes of this e
xample and a carriage return is added. Finally, the string is added to a file</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[<route>
- <from uri="activemq:topic:ActiveMQ.Advisory.Connection?mapJmsMessage=false" />
+ <from uri="activemq:topic:ActiveMQ.Advisory.Connection?mapJmsMessage=false"/>
<convertBodyTo type="java.lang.String"/>
<transform>
<simple>${in.body}&#13;</simple>
</transform>
- <to uri="file://data/activemq/?fileExist=Append&amp;fileName=advisoryConnection-${date:now:yyyyMMdd}.txt" />
+ <to uri="file://data/activemq/?fileExist=Append&amp;fileName=advisoryConnection-${date:now:yyyyMMdd}.txt"/>
</route>
]]></script>
-</div></div><p>If you consume a message on a queue, you should see the following files under the data/activemq folder :</p><p>advisoryConnection-20100312.txt<br clear="none"> advisoryProducer-20100312.txt</p><p>and containing string:</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[ActiveMQMessage {commandId = 0, responseRequired = false,
-messageId = ID:dell-charles-3258-1268399815140
--1:0:0:0:221, originalDestination = null, originalTransactionId = null,
+</div></div><p>If you consume a message on a queue, you should see the following files under the <strong><code>data/activemq</code></strong> folder :</p><p><strong><code>advisoryConnection-20100312.txt</code></strong><br clear="none"><strong><code>advisoryProducer-20100312.txt</code></strong></p><p>containing the following string:</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[ActiveMQMessage {
+commandId = 0,
+responseRequired = false,
+messageId = ID:dell-charles-3258-1268399815140-1:0:0:0:221,
+originalDestination = null,
+originalTransactionId = null,
producerId = ID:dell-charles-3258-1268399815140-1:0:0:0,
-destination = topic://ActiveMQ.Advisory.Connection, transactionId = null,
-expiration = 0, timestamp = 0, arrival = 0, brokerInTime = 1268403383468,
-brokerOutTime = 1268403383468, correlationId = null, replyTo = null,
-persistent = false, type = Advisory, priority = 0, groupID = null, groupSequence = 0,
-targetConsumerId = null, compressed = false, userID = null, content = null,
+destination = topic://ActiveMQ.Advisory.Connection,
+transactionId = null,
+expiration = 0,
+timestamp = 0,
+arrival = 0,
+brokerInTime = 1268403383468,
+brokerOutTime = 1268403383468,
+correlationId = null,
+replyTo = null,
+persistent = false,
+type = Advisory,
+priority = 0,
+groupID = null,
+groupSequence = 0,
+targetConsumerId = null,
+compressed = false,
+userID = null,
+content = null,
marshalledProperties = org.apache.activemq.util.ByteSequence@17e2705,
-dataStructure = ConnectionInfo {commandId = 1, responseRequired = true,
-connectionId = ID:dell-charles-3258-1268399815140-2:50,
-clientId = ID:dell-charles-3258-1268399815140-14:0, userName = , password = *****,
-brokerPath = null, brokerMasterConnector = false, manageable = true,
-clientMaster = true}, redeliveryCounter = 0, size = 0, properties =
-{originBrokerName=master, originBrokerId=ID:dell-charles-3258-1268399815140-0:0,
-originBrokerURL=vm://master}, readOnlyProperties = true, readOnlyBody = true,
-droppable = false}
+dataStructure = ConnectionInfo {
+ commandId = 1,
+ responseRequired = true,
+ connectionId = ID:dell-charles-3258-1268399815140-2:50,
+ clientId = ID:dell-charles-3258-1268399815140-14:0,
+ userName = ,
+ password = *****,
+ brokerPath = null,
+ brokerMasterConnector = false,
+ manageable = true,
+ clientMaster = true
+},
+redeliveryCounter = 0,
+size = 0,
+properties = { originBrokerName=master, originBrokerId=ID:dell-charles-3258-1268399815140-0:0, originBrokerURL=vm://master },
+readOnlyProperties = true,
+readOnlyBody = true,
+droppable = false
+}
]]></script>
-</div></div><h3 id="BookComponentAppendix-GettingComponentJAR">Getting Component JAR</h3><p>You will need this dependency</p><ul class="alternate"><li><code>activemq-camel</code></li></ul><p><a shape="rect" href="activemq.html">ActiveMQ</a> is an extension of the <a shape="rect" href="jms.html">JMS</a> component released with the <a shape="rect" class="external-link" href="http://activemq.apache.org">ActiveMQ project</a>.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 id="BookComponentAppendix-GettingComponentJAR">Getting Component JAR</h3><p>You will need this dependency</p><ul class="alternate"><li><strong><code>activemq-camel</code></strong></li></ul><p><a shape="rect" href="activemq.html">ActiveMQ</a> is an extension of the <a shape="rect" href="jms.html">JMS</a> component released with the <a shape="rect" class="external-link" href="http://activemq.apache.org">ActiveMQ project</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[<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-camel</artifactId>
@@ -1011,11 +1032,11 @@ template.send("direct:alias-verify&
]]></script>
</div></div><p></p><h3 id="BookComponentAppendix-SeeAlso.8">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="BookComponentAppendix-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 cons
ume 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.rbtoc1502878713443 {padding: 0px;}
-div.rbtoc1502878713443 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1502878713443 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1502918323027 {padding: 0px;}
+div.rbtoc1502918323027 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1502918323027 li {margin-left: 0px;padding-left: 0px;}
-/*]]>*/</style></p><div class="toc-macro rbtoc1502878713443">
+/*]]>*/</style></p><div class="toc-macro rbtoc1502918323027">
<ul class="toc-indentation"><li><a shape="rect" href="#BookComponentAppendix-CXFComponent">CXF Component</a>
<ul class="toc-indentation"><li><a shape="rect" href="#BookComponentAppendix-URIformat">URI format</a></li><li><a shape="rect" href="#BookComponentAppendix-Options">Options</a>
<ul class="toc-indentation"><li><a shape="rect" href="#BookComponentAppendix-Thedescriptionsofthedataformats">The descriptions of the dataformats</a>