Modified: websites/production/activemq/content/outbound-communication.html
==============================================================================
--- websites/production/activemq/content/outbound-communication.html (original)
+++ websites/production/activemq/content/outbound-communication.html Sat Jun 27
21:23:55 2015
@@ -32,16 +32,6 @@
</style>
<![endif]-->
- <link
href='http://activemq.apache.org/styles/highlighter/styles/shCore.css'
rel='stylesheet' type='text/css' />
- <link
href='http://activemq.apache.org/styles/highlighter/styles/shThemeEclipse.css'
rel='stylesheet' type='text/css' />
- <script
src='http://activemq.apache.org/styles/highlighter/scripts/shCore.js'
type='text/javascript'></script>
- <script
src='http://activemq.apache.org/styles/highlighter/scripts/shBrushJava.js'
type='text/javascript'></script>
- <script
src='http://activemq.apache.org/styles/highlighter/scripts/shBrushXml.js'
type='text/javascript'></script>
-
- <script type="text/javascript">
- SyntaxHighlighter.defaults['toolbar'] = false;
- SyntaxHighlighter.all();
- </script>
<title>
Apache ActiveMQ ™ -- Outbound Communication
@@ -86,15 +76,15 @@
<h2
id="OutboundCommunication-INLINEConfiguringaSessionBeantosendmessagestoActiveMQ">Configuring
a Session Bean to send messages to ActiveMQ</h2>
-<p>In the attached <a shape="rect"
href="outbound-communication.data/activemq-jboss-test.zip?version=3&modificationDate=1117021355000&api=v2">example
application</a>, the three MDBs use the <code>SenderEJB</code> to send JMS
messages to an ActiveMQ queue. In this example, I will be explaining how
to:</p>
+<p>In the attached <a shape="rect"
href="outbound-communication.data/activemq-jboss-test.zip?version=3&modificationDate=1117021355000&api=v2"
data-linked-resource-id="3278" data-linked-resource-version="3"
data-linked-resource-type="attachment"
data-linked-resource-default-alias="activemq-jboss-test.zip"
data-nice-type="Zip Archive"
data-linked-resource-content-type="application/zip"
data-linked-resource-container-id="35943"
data-linked-resource-container-version="53">example application</a>, the three
MDBs use the <code>SenderEJB</code> to send JMS messages to an ActiveMQ queue.
In this example, I will be explaining how to:</p>
<ol><li>Configure and deploy an ActiveMQ <code>Queue</code> to
JBoss</li><li>Configure and deploy an ActiveMQ
<code>QueueConnectionFactory</code> to JBoss</li><li>Configure an EJB, deployed
to JBoss, to reference the above two.</li></ol>
<h3 id="OutboundCommunication-TheBean">The Bean</h3>
-<p>In the <a shape="rect"
href="outbound-communication.data/ejb-jar.xml?version=3&modificationDate=1117021488000&api=v2">ejb-jar.xml</a>
deployment descriptor, the <code>SenderEJB</code> is declared as follows:<br
clear="none">
+<p>In the <a shape="rect"
href="outbound-communication.data/ejb-jar.xml?version=3&modificationDate=1117021488000&api=v2"
data-linked-resource-id="3249" data-linked-resource-version="3"
data-linked-resource-type="attachment"
data-linked-resource-default-alias="ejb-jar.xml" data-nice-type="XML File"
data-linked-resource-content-type="text/xml"
data-linked-resource-container-id="35943"
data-linked-resource-container-version="53">ejb-jar.xml</a> deployment
descriptor, the <code>SenderEJB</code> is declared as follows:<br clear="none">
<span class="confluence-anchor-link"
id="OutboundCommunication-ejbSenderEJB"></span></p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader
panelHeader pdl" style="border-bottom-width: 1px;"><b>ejb-jar.xml –
session bean declaration</b></div><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
+<script class="brush: xml; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[
<session>
...
<ejb-name>SenderEJB</ejb-name>
@@ -118,10 +108,10 @@
<p>The <code>jms/MyQueueConnectionFactory</code> is the JNDI name the
<code>SenderEJB</code> will use to lookup a
<code>javax.jms.QueueConnectionFactory</code>. We will configure it to point
to an ActiveMQ <code>QueueConnectionFactory</code>.</p>
-<p>The <code>jms/LogQueue</code> is the JNDI name the <code>SenderEJB</code>
will use to lookup the <code>javax.jms.Queue</code> it will send messages to.
We use the <code>message-destination-link</code> element to refer to the
<code>LoggingQueue</code> which is declared in the
<code>assembly-descriptor</code> section of the <a shape="rect"
href="outbound-communication.data/ejb-jar.xml?version=3&modificationDate=1117021488000&api=v2">ejb-jar.xml</a>
deployment descriptor as: <br clear="none">
+<p>The <code>jms/LogQueue</code> is the JNDI name the <code>SenderEJB</code>
will use to lookup the <code>javax.jms.Queue</code> it will send messages to.
We use the <code>message-destination-link</code> element to refer to the
<code>LoggingQueue</code> which is declared in the
<code>assembly-descriptor</code> section of the <a shape="rect"
href="outbound-communication.data/ejb-jar.xml?version=3&modificationDate=1117021488000&api=v2"
data-linked-resource-id="3249" data-linked-resource-version="3"
data-linked-resource-type="attachment"
data-linked-resource-default-alias="ejb-jar.xml" data-nice-type="XML File"
data-linked-resource-content-type="text/xml"
data-linked-resource-container-id="35943"
data-linked-resource-container-version="53">ejb-jar.xml</a> deployment
descriptor as: <br clear="none">
<span class="confluence-anchor-link"
id="OutboundCommunication-ejbLoggingQueue"></span></p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader
panelHeader pdl" style="border-bottom-width: 1px;"><b>ejb-jar.xml –
assembly descriptor section</b></div><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
+<script class="brush: xml; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[
<assembly-descriptor>
...
<message-destination>
@@ -138,7 +128,7 @@
<p>The <code>resource-ref</code> element <a shape="rect"
href="#OutboundCommunication-ejbSenderEJB">shown above</a>, will be linked to
the following element in the <a shape="rect" class="external-link"
href="http://activemq.codehaus.org/checkout/activemq/modules/ra/src/rar/META-INF/ra.xml"
rel="nofollow">ra.xml</a> file, which is contained within the <a shape="rect"
href="jboss-integration.html#JBossIntegration-rarfile">activemq-ra-1.2.rar</a>
file:<br clear="none">
<span class="confluence-anchor-link"
id="OutboundCommunication-raQueueConnectionFactory"></span></p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader
panelHeader pdl" style="border-bottom-width: 1px;"><b>ra.xml – The
QueueConnectionFactory</b></div><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
+<script class="brush: xml; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[
<outbound-resourceadapter>
...
<connection-definition>
@@ -156,7 +146,7 @@
<p>The <code>message-destination</code> element <a shape="rect"
href="#OutboundCommunication-ejbLoggingQueue">shown above</a>, will be linked
to the following element in the <a shape="rect" class="external-link"
href="http://activemq.codehaus.org/checkout/activemq/modules/ra/src/rar/META-INF/ra.xml"
rel="nofollow">ra.xml</a> file:<br clear="none">
<span class="confluence-anchor-link"
id="OutboundCommunication-raQueue"></span></p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader
panelHeader pdl" style="border-bottom-width: 1px;"><b>ra.xml – The
Queue</b></div><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
+<script class="brush: xml; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[
<adminobject>
<adminobject-interface>javax.jms.Queue</adminobject-interface>
<adminobject-class>org.activemq.message.ActiveMQQueue</adminobject-class>
@@ -169,15 +159,15 @@
</div></div>
<h3 id="OutboundCommunication-TheGlue">The Glue</h3>
-<p>In JBoss, connecting the resources needed by the <a shape="rect"
href="outbound-communication.data/ejb-jar.xml?version=3&modificationDate=1117021488000&api=v2">ejb-jar.xml</a>
file to resources provided by the <a shape="rect" class="external-link"
href="http://activemq.codehaus.org/checkout/activemq/modules/ra/src/rar/META-INF/ra.xml"
rel="nofollow">ra.xml</a> file involves two additional files:</p>
-<ol><li><strong><a shape="rect"
href="outbound-communication.data/panacya-jms-ds.xml?version=5&modificationDate=1117021448000&api=v2">panacya-jms-ds.xml</a></strong>
- This is a JBoss data source file. It specifies which connector objects
JBoss should instantiate and where in JNDI JBoss should place those
objects.</li><li><strong><a shape="rect"
href="outbound-communication.data/jboss.xml?version=3&modificationDate=1117021488000&api=v2">jboss.xml</a></strong>
- This is a JBoss deployment descriptor which is contained within the <a
shape="rect"
href="jboss-integration.html#JBossIntegration-ejbjarfile">panacya-mdb-test-1.0.jar</a>
file. It links resources needed by the EJBs to the JNDI names of resources
available in JBoss.</li></ol>
+<p>In JBoss, connecting the resources needed by the <a shape="rect"
href="outbound-communication.data/ejb-jar.xml?version=3&modificationDate=1117021488000&api=v2"
data-linked-resource-id="3249" data-linked-resource-version="3"
data-linked-resource-type="attachment"
data-linked-resource-default-alias="ejb-jar.xml" data-nice-type="XML File"
data-linked-resource-content-type="text/xml"
data-linked-resource-container-id="35943"
data-linked-resource-container-version="53">ejb-jar.xml</a> file to resources
provided by the <a shape="rect" class="external-link"
href="http://activemq.codehaus.org/checkout/activemq/modules/ra/src/rar/META-INF/ra.xml"
rel="nofollow">ra.xml</a> file involves two additional files:</p>
+<ol><li><strong><a shape="rect"
href="outbound-communication.data/panacya-jms-ds.xml?version=5&modificationDate=1117021448000&api=v2"
data-linked-resource-id="3271" data-linked-resource-version="5"
data-linked-resource-type="attachment"
data-linked-resource-default-alias="panacya-jms-ds.xml" data-nice-type="XML
File" data-linked-resource-content-type="text/xml"
data-linked-resource-container-id="35943"
data-linked-resource-container-version="53">panacya-jms-ds.xml</a></strong> -
This is a JBoss data source file. It specifies which connector objects JBoss
should instantiate and where in JNDI JBoss should place those
objects.</li><li><strong><a shape="rect"
href="outbound-communication.data/jboss.xml?version=3&modificationDate=1117021488000&api=v2"
data-linked-resource-id="3251" data-linked-resource-version="3"
data-linked-resource-type="attachment"
data-linked-resource-default-alias="jboss.xml" data-nice-type="XML File"
data-linked-resource-content-type="text/xml" da
ta-linked-resource-container-id="35943"
data-linked-resource-container-version="53">jboss.xml</a></strong> - This is a
JBoss deployment descriptor which is contained within the <a shape="rect"
href="jboss-integration.html#JBossIntegration-ejbjarfile">panacya-mdb-test-1.0.jar</a>
file. It links resources needed by the EJBs to the JNDI names of resources
available in JBoss.</li></ol>
-<h5
id="OutboundCommunication-panacya-jms-ds.xml–TheJBossDataSourceFile"><a
shape="rect"
href="outbound-communication.data/panacya-jms-ds.xml?version=5&modificationDate=1117021448000&api=v2">panacya-jms-ds.xml</a>
– <em>The JBoss Data Source File</em></h5>
+<h5
id="OutboundCommunication-panacya-jms-ds.xml–TheJBossDataSourceFile"><a
shape="rect"
href="outbound-communication.data/panacya-jms-ds.xml?version=5&modificationDate=1117021448000&api=v2"
data-linked-resource-id="3271" data-linked-resource-version="5"
data-linked-resource-type="attachment"
data-linked-resource-default-alias="panacya-jms-ds.xml" data-nice-type="XML
File" data-linked-resource-content-type="text/xml"
data-linked-resource-container-id="35943"
data-linked-resource-container-version="53">panacya-jms-ds.xml</a> –
<em>The JBoss Data Source File</em></h5>
<p>This first snippet configures the <code>QueueConnectionFactory</code>, <a
shape="rect" href="#OutboundCommunication-raQueueConnectionFactory">declared
above</a>, and places it in JNDI at
<code>activemq/QueueConnectionFactory</code>:<br clear="none">
<span class="confluence-anchor-link"
id="OutboundCommunication-dsQueueConnectionFactory"></span></p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader
panelHeader pdl" style="border-bottom-width: 1px;"><b>panacya-jms-ds.xml
– The QueueConnectionFactory</b></div><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
+<script class="brush: xml; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[
<tx-connection-factory>
<jndi-name>activemq/QueueConnectionFactory</jndi-name>
<xa-transaction/>
@@ -191,7 +181,7 @@
<p>This second snippet configures the <code>Queue</code>, <a shape="rect"
href="#OutboundCommunication-raQueue">declared above</a>, and places it in JNDI
at <code>activemq/queue/outbound</code>:<br clear="none">
<span class="confluence-anchor-link"
id="OutboundCommunication-dsQueue"></span></p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader
panelHeader pdl" style="border-bottom-width: 1px;"><b>panacya-jms-ds.xml
– The Queue</b></div><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
+<script class="brush: xml; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[
<mbean code="org.jboss.resource.deployment.AdminObject"
name="activemq.queue:name=outboundQueue">
<attribute
name="JNDIName">activemq/queue/outbound</attribute>
<depends
optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='activemq-ra-1.2-SNAPSHOT.rar'</depends>
@@ -203,13 +193,13 @@
]]></script>
</div></div>
-<p>In the <a shape="rect"
href="outbound-communication.data/panacya-jms-ds.xml?version=5&modificationDate=1117021448000&api=v2">panacya-jms-ds.xml</a>
file section shown above, the value of the <code>Properties</code> element is
set to <code>PhysicalName=queue.outbound</code>. This value is the physical
name of the ActiveMQ destination the <code>SenderEJB</code> will be sending
messages to and not a JNDI name. In other words, the value of the
<code>PhysicalName</code> property has no meaning to JBoss. It is purely an
ActiveMQ setting. </p>
+<p>In the <a shape="rect"
href="outbound-communication.data/panacya-jms-ds.xml?version=5&modificationDate=1117021448000&api=v2"
data-linked-resource-id="3271" data-linked-resource-version="5"
data-linked-resource-type="attachment"
data-linked-resource-default-alias="panacya-jms-ds.xml" data-nice-type="XML
File" data-linked-resource-content-type="text/xml"
data-linked-resource-container-id="35943"
data-linked-resource-container-version="53">panacya-jms-ds.xml</a> file section
shown above, the value of the <code>Properties</code> element is set to
<code>PhysicalName=queue.outbound</code>. This value is the physical name of
the ActiveMQ destination the <code>SenderEJB</code> will be sending messages to
and not a JNDI name. In other words, the value of the
<code>PhysicalName</code> property has no meaning to JBoss. It is purely an
ActiveMQ setting. </p>
-<h5 id="OutboundCommunication-jboss.xml–TheJBossDeploymentDescriptor"><a
shape="rect"
href="outbound-communication.data/jboss.xml?version=3&modificationDate=1117021488000&api=v2">jboss.xml</a>
– <em>The JBoss Deployment Descriptor</em></h5>
-<p>This first snippet links the <code><a shape="rect"
href="#OutboundCommunication-ejbSenderEJB">jms/MyQueueConnectionFactory</a></code>
JNDI name used by the <code>SenderEJB</code> to the resource name
<code>queuefactoryref</code> which is local to the <a shape="rect"
href="outbound-communication.data/jboss.xml?version=3&modificationDate=1117021488000&api=v2">jboss.xml</a>
file: <br clear="none">
+<h5 id="OutboundCommunication-jboss.xml–TheJBossDeploymentDescriptor"><a
shape="rect"
href="outbound-communication.data/jboss.xml?version=3&modificationDate=1117021488000&api=v2"
data-linked-resource-id="3251" data-linked-resource-version="3"
data-linked-resource-type="attachment"
data-linked-resource-default-alias="jboss.xml" data-nice-type="XML File"
data-linked-resource-content-type="text/xml"
data-linked-resource-container-id="35943"
data-linked-resource-container-version="53">jboss.xml</a> – <em>The JBoss
Deployment Descriptor</em></h5>
+<p>This first snippet links the <code><a shape="rect"
href="#OutboundCommunication-ejbSenderEJB">jms/MyQueueConnectionFactory</a></code>
JNDI name used by the <code>SenderEJB</code> to the resource name
<code>queuefactoryref</code> which is local to the <a shape="rect"
href="outbound-communication.data/jboss.xml?version=3&modificationDate=1117021488000&api=v2"
data-linked-resource-id="3251" data-linked-resource-version="3"
data-linked-resource-type="attachment"
data-linked-resource-default-alias="jboss.xml" data-nice-type="XML File"
data-linked-resource-content-type="text/xml"
data-linked-resource-container-id="35943"
data-linked-resource-container-version="53">jboss.xml</a> file: <br
clear="none">
<span class="confluence-anchor-link"
id="OutboundCommunication-jbossQueuefactoryref"></span></p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader
panelHeader pdl" style="border-bottom-width: 1px;"><b>jboss.xml – The
QueueConnectionFactory for the SenderEJB</b></div><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
+<script class="brush: xml; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[
<enterprise-beans>
<session>
<ejb-name>SenderEJB</ejb-name>
@@ -226,7 +216,7 @@
<p>This second snippet links the local <code>queuefactoryref</code> name to
the global JNDI name <code>java:/activemq/QueueConnectionFactory</code> which
was <a shape="rect"
href="#OutboundCommunication-dsQueueConnectionFactory">declared above</a>: <br
clear="none">
<span class="confluence-anchor-link"
id="OutboundCommunication-jbossQueueConnectionFactory"></span></p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader
panelHeader pdl" style="border-bottom-width: 1px;"><b>jboss.xml – Linking
queuefactoryref to the global JNDI namespace</b></div><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
+<script class="brush: xml; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[
<resource-managers>
<resource-manager>
<res-name>queuefactoryref</res-name>
@@ -237,10 +227,10 @@
]]></script>
</div></div>
-<p>This third snippet links the <code>LoggingQueue</code>, which was <a
shape="rect" href="#OutboundCommunication-ejbLoggingQueue">declared</a> in the
<code>assembly-descriptor</code> section of the <a shape="rect"
href="outbound-communication.data/ejb-jar.xml?version=3&modificationDate=1117021488000&api=v2">ejb-jar.xml</a>,
to the global JNDI name <code>activemq/queue/outbound</code> which was <a
shape="rect" href="#OutboundCommunication-dsQueue">declared above</a>: <br
clear="none">
+<p>This third snippet links the <code>LoggingQueue</code>, which was <a
shape="rect" href="#OutboundCommunication-ejbLoggingQueue">declared</a> in the
<code>assembly-descriptor</code> section of the <a shape="rect"
href="outbound-communication.data/ejb-jar.xml?version=3&modificationDate=1117021488000&api=v2"
data-linked-resource-id="3249" data-linked-resource-version="3"
data-linked-resource-type="attachment"
data-linked-resource-default-alias="ejb-jar.xml" data-nice-type="XML File"
data-linked-resource-content-type="text/xml"
data-linked-resource-container-id="35943"
data-linked-resource-container-version="53">ejb-jar.xml</a>, to the global JNDI
name <code>activemq/queue/outbound</code> which was <a shape="rect"
href="#OutboundCommunication-dsQueue">declared above</a>: <br clear="none">
<span class="confluence-anchor-link"
id="OutboundCommunication-jbossQueue"></span></p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader
panelHeader pdl" style="border-bottom-width: 1px;"><b>jboss.xml – Linking
LoggingQueue to the global JNDI namespace</b></div><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
+<script class="brush: xml; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[
<assembly-descriptor>
<message-destination>
<message-destination-name>LoggingQueue</message-destination-name>
@@ -252,7 +242,7 @@
<p>The above example highlights the key configuration settings needed to
enable EJBs deployed in JBoss to send JMS messages to an ActiveMQ destination.
</p>
-<p>You can try the above example, plus a few more, by downloading the <a
shape="rect"
href="outbound-communication.data/activemq-jboss-test.zip?version=3&modificationDate=1117021355000&api=v2">activemq-jboss-test.zip</a>
file which contains the complete sample project.</p></div>
+<p>You can try the above example, plus a few more, by downloading the <a
shape="rect"
href="outbound-communication.data/activemq-jboss-test.zip?version=3&modificationDate=1117021355000&api=v2"
data-linked-resource-id="3278" data-linked-resource-version="3"
data-linked-resource-type="attachment"
data-linked-resource-default-alias="activemq-jboss-test.zip"
data-nice-type="Zip Archive"
data-linked-resource-content-type="application/zip"
data-linked-resource-container-id="35943"
data-linked-resource-container-version="53">activemq-jboss-test.zip</a> file
which contains the complete sample project.</p></div>
</td>
<td valign="top">
<div class="navigation">
Modified: websites/production/activemq/content/per-destination-policies.html
==============================================================================
--- websites/production/activemq/content/per-destination-policies.html
(original)
+++ websites/production/activemq/content/per-destination-policies.html Sat Jun
27 21:23:55 2015
@@ -32,17 +32,6 @@
</style>
<![endif]-->
- <link
href='http://activemq.apache.org/styles/highlighter/styles/shCore.css'
rel='stylesheet' type='text/css' />
- <link
href='http://activemq.apache.org/styles/highlighter/styles/shThemeEclipse.css'
rel='stylesheet' type='text/css' />
- <script
src='http://activemq.apache.org/styles/highlighter/scripts/shCore.js'
type='text/javascript'></script>
- <script
src='http://activemq.apache.org/styles/highlighter/scripts/shBrushJava.js'
type='text/javascript'></script>
- <script
src='http://activemq.apache.org/styles/highlighter/scripts/shBrushXml.js'
type='text/javascript'></script>
- <script
src='http://activemq.apache.org/styles/highlighter/scripts/shBrushPlain.js'
type='text/javascript'></script>
-
- <script type="text/javascript">
- SyntaxHighlighter.defaults['toolbar'] = false;
- SyntaxHighlighter.all();
- </script>
<title>
Apache ActiveMQ ™ -- Per Destination Policies
@@ -84,7 +73,7 @@
<tr>
<td valign="top" width="100%">
<div class="wiki-content maincontent"><p>We support a number of different
policies which can be attached to individual destinations (queues, topics) or
to wildcards of queue/topic hierarchies. This makes it easy to configure how
different regions of the JMS destination space are handled.</p><p>The
properties you can set on a Destination are as follows:</p><div
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1"
rowspan="1" class="confluenceTh"><p>Common property</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>producerFlowControl</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>true</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>the producer will slow down and eventually block if no
resources(e.g. memory) are available on the broker. If this is off messages get
off-lined to dis
k to prevent memory exhaustion</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>enableAudit</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>true</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>tracks duplicate messages (which can occur in failover
for non-persistent messages)</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>useCache</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>true</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>persistent messages are cached for fast retrieval from
store</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>maxPageSize</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>200</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>maximum number of persistent messages to page from
store at a time</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>maxBrowsePageSize</p></td><td colspan="1" rowspan="1"
class="confluence
Td"><p>400</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>maximum
number of persistent messages to page from store for a
browser</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>memoryLimit</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>n/a</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>The memory limit for a given destination. This acts as
a child to the overall broker memory specified by the <a shape="rect"
href="producer-flow-control.html#ProducerFlowControl-Systemusage"><code><systemUsage></code>'s
<code>memoryLimit</code> attribute</a>. There is no default for this value; it
simply acts as a child to the overall broker memory until the broker memory is
exhausted.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>minimumMessageSize</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>1024</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>for non-serialized messages (embedded brok
er) - the assumed size of the message used for memory usage calculation.
Serialized messages used the serialized size as the basis for the memory
calculation</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>cursorMemoryHighWaterMark</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>70</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>the percentage (%) tipping point at which a system
memory limit will cause a cursor to block or spool to disk</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p>storeUsageHighWaterMark</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>100</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>the percentage (%) tipping point at which a system
usage store limit will cause a sent to block</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p>prioritizedMessages</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>false</p></td><td colspan="1" rowspan="1"
class="
confluenceTd"><p>have the store respect message priority</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>advisoryForConsumed</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>false</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>send an advisory message when a message is
consumed by a client</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>advisoryForDelivery</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>false</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>send an advisory message when a message is sent to a
client</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>advisoryForSlowConsumers</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>false</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>send an advisory message if a consumer is deemed
slow</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>advsioryForFastProducers</p></td><td colspa
n="1" rowspan="1" class="confluenceTd"><p>false</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>send an advisory message if a producer is
deemed fast</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>advisoryWhenFull</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>false</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>send an advisory message when a limit
(memory,store,temp disk) is full</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>gcInactiveDestinations</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>false</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>delete inactive destination</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p>inactiveTimoutBeforeGC</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>5000</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>inactivity period (in ms) before destination is
considered inactive</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p><span>usePrefetchExtension</span></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>true</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>the prefetch extension is used when
a message is delivered but not acked, such that the broker can
dispatch another message (e.g., prefetch == 0), the idea being that there
will always be prefetch num messages pending. It also allows a transaction
batch to exceed the prefetch value.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p>slowConsumerStrategy</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>null</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>sets the strategy for handling slow
consumers. see <a shape="rect" class="external-link"
href="http://svn.apache.org/repos/asf/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/AbortSlowConsumerStrategy.java">abortSlowConsumerStrategy</a
></p></td></tr><tr><td colspan="1" rowspan="1"
>class="confluenceTd"><p>maxDestinations</p></td><td colspan="1" rowspan="1"
>class="confluenceTd"><p>-1</p></td><td colspan="1" rowspan="1"
>class="confluenceTd"><p>(v5.12) if 0 or greater, sets the maximum number of
>destinations that can be created. This is useful to limit the number of
>hierarchical destinations that can be created under a wildcard
>destination.</p></td></tr></tbody></table></div><p>Additional properties for
>a Queue</p><div class="table-wrap"><table
>class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1"
>class="confluenceTh"><p>Queue only property</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>useConsumerPriority</p></td><td colspan="1"
>rowspan="1" class="confluenceTd"><p>true</p></td><td colspan="1" rowspan="1"
>class="confluenceTd"><p>use the priority of
a consumer when dispatching messages from a Queue</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>strictOrderDispatch</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>false</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>if true queue will not round robin
consumers, but it'll use a single one until its prefetch buffer is
full</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>optimizedDispatch</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>false</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>don't use a separate thread for dispatching from a
Queue</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>lazyDispatch</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>false</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>only page in from store the number of messages that can
be dispatched at time</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>
consumersBeforeDispatchStarts</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>0</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>when the first consumer connects, wait for specified
number of consumers before message dispatching starts</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p>timeBeforeDispatchStarts</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>0</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>when the first consumer connects, wait for specified
time (in ms) before message dispatching starts</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p>queuePrefetch</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>n/a</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>sets the prefetch for consumers that are using the
default value</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>expireMessagesPeriod</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>
30000</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>the period
(in ms) of checks for message expiry on queued messages, value of 0
disables</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>persistJMSRedelivered</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>false</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>(v 5.10) if true, before a persistent message is
dispatched by the broker for the first time, the message is rewritten to
reflect the possible delivery.</p><p>This ensures the message JMSRedelivered
header is a reliable indication of possible duplicate
delivery.</p></td></tr></tbody></table></div><p>Additional properties for a
Topic</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th
colspan="1" rowspan="1" class="confluenceTh"><p>Topic only property</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>topicPrefetch</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>n/a</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>sets the prefetch for topic consumers that are using
the default value</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>durableTopicPrefetch</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>n/a</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>sets the prefetch for durable topic consumers that are
using the default value</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>advisoryForDiscardingMessages</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>false</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>send an advisory when a message is discarded from a non
durable subscription</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><span style="color:
rgb(0,0,0);">alwaysRetroactive</span></p></td
><td colspan="1" rowspan="1" class="confluenceTd"><p>false</p></td><td
>colspan="1" rowspan="1" class="confluenceTd"><p>(v5.6) makes all subscribers
>retroactive negating the need to modify the clients to enable this
>feature</p></td></tr><tr><td colspan="1" rowspan="1"
>class="confluenceTd"><p><span style="color:
>rgb(0,0,0);">expireMessagesPeriod</span></p></td><td colspan="1" rowspan="1"
>class="confluenceTd"><p>30000</p></td><td colspan="1" rowspan="1"
>class="confluenceTd"><p>(v5.6) the period (in ms) of checks for message
>expiry on inactive durable subscribers, value of 0
>disables</p></td></tr></tbody></table></div><p><span style="line-height:
>1.4285715;">The following are examples of different policies that can be
>customised on a per destination basis</span></p><ul><li><a shape="rect"
>href="dispatch-policies.html">Dispatch Policies</a></li></ul><p>Here is an <a
>shape="rect" class="external-link"
>href="http://svn.apache.org/repos/asf/activemq/trunk/activemq-unit-tests/src/test/resour
ces/org/apache/activemq/xbean/activemq-policy.xml">example</a> of this in
use.</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
+<script class="brush: xml; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.apache.org/schema/core"
Modified: websites/production/activemq/content/persistence.html
==============================================================================
--- websites/production/activemq/content/persistence.html (original)
+++ websites/production/activemq/content/persistence.html Sat Jun 27 21:23:55
2015
@@ -32,17 +32,6 @@
</style>
<![endif]-->
- <link
href='http://activemq.apache.org/styles/highlighter/styles/shCore.css'
rel='stylesheet' type='text/css' />
- <link
href='http://activemq.apache.org/styles/highlighter/styles/shThemeEclipse.css'
rel='stylesheet' type='text/css' />
- <script
src='http://activemq.apache.org/styles/highlighter/scripts/shCore.js'
type='text/javascript'></script>
- <script
src='http://activemq.apache.org/styles/highlighter/scripts/shBrushJava.js'
type='text/javascript'></script>
- <script
src='http://activemq.apache.org/styles/highlighter/scripts/shBrushXml.js'
type='text/javascript'></script>
- <script
src='http://activemq.apache.org/styles/highlighter/scripts/shBrushPlain.js'
type='text/javascript'></script>
-
- <script type="text/javascript">
- SyntaxHighlighter.defaults['toolbar'] = false;
- SyntaxHighlighter.all();
- </script>
<title>
Apache ActiveMQ ™ -- Persistence
@@ -84,36 +73,36 @@
<tr>
<td valign="top" width="100%">
<div class="wiki-content maincontent"><h2
id="Persistence-ActiveMQV5.9">ActiveMQ V5.9</h2><p>In ActiveMQ 5.9, the <a
shape="rect" href="replicated-leveldb-store.html">Replicated LevelDB Store</a>
is introduced. It handles using <a shape="rect" class="external-link"
href="http://zookeeper.apache.org/">Apache ZooKeeper</a> to pick a master from
a set of broker nodes configured to replicate single LevelDB Store. Then
synchronizes all slave LevelDB Stores with the master keeps them up to date by
replicating all updates to the master. This might become the preferred <a
shape="rect" href="masterslave.html">Master Slave</a> configuration going
forward.</p><h2 id="Persistence-ActiveMQV5.8">ActiveMQ V5.8</h2><p>In ActiveMQ
5.8, the <a shape="rect" href="leveldb-store.html">LevelDB Store</a> was
introduced. The LevelDB Store is a file based persistence database. It has been
optimized to provide even faster persistence than KahaDB. Although not yet the
default message store, we expect this sto
re implementation become the default in future releases.</p><h2
id="Persistence-ActiveMQV5.3">ActiveMQ V5.3</h2><p>From 5.3 onwards - we
recommend you use <a shape="rect" href="kahadb.html">KahaDB</a> - which offers
improved scalability and recoverability over the <a shape="rect"
href="amq-message-store.html">AMQ Message Store</a>.<br clear="none"> The <a
shape="rect" href="amq-message-store.html">AMQ Message Store</a> which although
faster than <a shape="rect" href="kahadb.html">KahaDB</a> - does not scales as
well as <a shape="rect" href="kahadb.html">KahaDB</a> and recovery times take
longer.</p><h2 id="Persistence-ActiveMQV4">ActiveMQ V4</h2><p>For long term
persistence we recommend using JDBC coupled with our high performance journal.
You can use just JDBC if you wish but its quite slow.</p><p>Our out of the box
default configuration uses <a shape="rect" class="external-link"
href="http://incubator.apache.org/derby/">Apache Derby</a> as the default
database, which is easy to em
bed - but we support all the <a shape="rect" href="jdbc-support.html">major
SQL databases</a> - just reconfigure your JDBC configuration in the <a
shape="rect" href="xml-configuration.html">Xml Configuration</a>.</p><h2
id="Persistence-Highperformancejournal-ActiveMQ4.x">High performance journal -
ActiveMQ 4.x</h2><p>To achieve high performance of durable messaging in
ACtiveMQ V4.x we strongly recommend you use our high performance journal -
which is enabled by default. This works rather like a database; messages (and
transcation commits/rollbacks and message acknowledgements) are written to the
journal as fast as is humanly possible - then at intervals we checkpoint the
journal to the long term persistence storage (in this case JDBC).</p><p>Its
common when using queues for example that messages are consumed fairly shortly
after being published; so you could publish 10,000 messages and only have a few
messages outstanding - so when we checkpoint to the JDBC database, we often
have o
nly a small amount of messages to actually write to JDBC. Even if we have to
write all the messages to the JDBC, we still get performance gains with the
journal, since we can use a large transaction batch to insert the messages into
the JDBC database to boost performance on the JDBC side.</p><p>Our journal is
based on lots of the great work in the <a shape="rect" class="external-link"
href="http://howl.objectweb.org/" rel="nofollow">Howl</a> project; we keep
close ties to the Howl community. However since ActiveMQ has to handle
arbitarily large message sizes, we've had to make our journal handle any size
of message and so we don't use the fixed size record model that Howl
uses.</p><h2 id="Persistence-Configuringpersistence">Configuring
persistence</h2><p>For full explict control over configuration check out the <a
shape="rect" href="xml-configuration.html">Xml Configuration</a>. However a
quick way to set which persistence adapter to use is to set the following
system property to be
the class name of the PersistenceAdapter implementation.</p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[activemq.persistenceAdapter
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[activemq.persistenceAdapter
]]></script>
</div></div><p>When running the broker from the command line, we look for the
activemq.xml on the classpath unless you specify one to use. e.g.<br
clear="none"> <strong>AMQ 4.x</strong></p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[activemq xbean:file:myconfig.xml
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[activemq xbean:file:myconfig.xml
]]></script>
</div></div><p><strong>AMQ 3.x</strong></p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[activemq myconfig.xml
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[activemq myconfig.xml
]]></script>
</div></div><p>or just<br clear="none"> <strong>AMQ3.x/AMQ4.x</strong></p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[activemq
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[activemq
]]></script>
-</div></div><p>Here is a sample XML configuration which shows how to configure
the journal and the JDBC persistence.</p><p>AMQ 4.x</p><div class="error"><span
class="error">Error formatting macro: snippet:
java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> </div><p>For
more details see the <a shape="rect" href="initial-configuration.html">Initial
Configuration</a> guide.</p><h2
id="Persistence-JDBCPersistencewithoutJournaling">JDBC Persistence without
Journaling</h2><p>To enable JDBC persistence of JMS messages without
journaling, we need to change the message broker's default persistence
configuration from<br clear="none"> <strong>AMQ 4.x</strong></p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[<persistenceAdapter>
+</div></div><p>Here is a sample XML configuration which shows how to configure
the journal and the JDBC persistence.</p><p>AMQ 4.x</p>An error occurred:
Unable to retrieve the URL:
http://svn.apache.org/repos/asf/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/xbean/activemq.xml
status code: 404. The error has been recorded.<p>For more details see the <a
shape="rect" href="initial-configuration.html">Initial Configuration</a>
guide.</p><h2 id="Persistence-JDBCPersistencewithoutJournaling">JDBC
Persistence without Journaling</h2><p>To enable JDBC persistence of JMS
messages without journaling, we need to change the message broker's default
persistence configuration from<br clear="none"> <strong>AMQ
4.x</strong></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[<persistenceAdapter>
<journaledJDBC journalLogFiles="5"
dataDirectory="../activemq-data"/>
</persistenceAdapter>
]]></script>
</div></div><p>to</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[<persistenceAdapter>
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[<persistenceAdapter>
<jdbcPersistenceAdapter dataSource="#my-ds"/>
</persistenceAdapter>
]]></script>
</div></div><p><strong>For AMQ 3.x</strong></p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[<persistence>
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[<persistence>
<journalPersistence directory="../var/journal">
<jdbcPersistence dataSourceRef="derby-ds"/>
</journalPersistence>
</persistence>
]]></script>
</div></div><p>to</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[<persistence>
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[<persistence>
<jdbcPersistence dataSourceRef="derby-ds"/>
</persistence>
]]></script>
@@ -130,7 +119,7 @@
<p>ActiveMQ 5.0 and above:</p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[
<broker brokerName="broker" persistent="true"
useShutdownHook="false">
<transportConnectors>
<transportConnector uri="tcp://localhost:61616"/>
@@ -146,7 +135,7 @@
<p>ActiveMQ 4.1 and earlier:</p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[
<broker brokerName="broker" persistent="true"
useShutdownHook="false">
<transportConnectors>
<transportConnector uri="tcp://localhost:61616"/>
@@ -157,7 +146,7 @@
</broker>
]]></script>
</div></div><h2 id="Persistence-DisasterRecoveryoptions">Disaster Recovery
options</h2><p>For people with high <a shape="rect" href="dr.html">DR</a>
requirements we have various options for providing a <a shape="rect"
href="replicated-message-store.html">Replicated Message Store</a> to allow full
failover in times of major data centre failure.</p><h2
id="Persistence-DisablingPersistence">Disabling Persistence</h2><p>If you don't
want persistence at all you can disable it easily via the <a shape="rect"
href="xml-configuration.html">Xml Configuration</a>. e.g.</p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[<broker persistent="false">
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[<broker persistent="false">
</broker>
]]></script>
</div></div><p>This will make the broker use the <a shape="rect"
class="external-link"
href="http://activemq.apache.org/maven/apidocs/org/apache/activemq/store/memory/MemoryPersistenceAdapter.html"><memoryPersistenceAdapter></a><br
clear="none"> For an example of using a configuration URI see <a shape="rect"
href="how-to-unit-test-jms-code.html">How to unit test JMS code</a></p></div>
Modified: websites/production/activemq/content/pluggable-storage-lockers.html
==============================================================================
--- websites/production/activemq/content/pluggable-storage-lockers.html
(original)
+++ websites/production/activemq/content/pluggable-storage-lockers.html Sat Jun
27 21:23:55 2015
@@ -32,16 +32,6 @@
</style>
<![endif]-->
- <link
href='http://activemq.apache.org/styles/highlighter/styles/shCore.css'
rel='stylesheet' type='text/css' />
- <link
href='http://activemq.apache.org/styles/highlighter/styles/shThemeEclipse.css'
rel='stylesheet' type='text/css' />
- <script
src='http://activemq.apache.org/styles/highlighter/scripts/shCore.js'
type='text/javascript'></script>
- <script
src='http://activemq.apache.org/styles/highlighter/scripts/shBrushJava.js'
type='text/javascript'></script>
- <script
src='http://activemq.apache.org/styles/highlighter/scripts/shBrushXml.js'
type='text/javascript'></script>
-
- <script type="text/javascript">
- SyntaxHighlighter.defaults['toolbar'] = false;
- SyntaxHighlighter.all();
- </script>
<title>
Apache ActiveMQ ™ -- Pluggable storage lockers
@@ -83,7 +73,7 @@
<tr>
<td valign="top" width="100%">
<div class="wiki-content maincontent"><p>With the 5.7.0 release of ActiveMQ
the storage locking mechanism used by a persistence adapter is pluggable. This
feature only applies to brokers configured in a shared storage master/slave
topology. Prior to release 5.7.0 the storage locking mechanism (and thus master
election) was dictated by the choice of persistence adapter. With the KahaDB
persistence adapter, for example, the storage locking mechanism was based on a
shared file lock. Similarly, the JDBC persistence adapter used a database
backed storage lock.</p><p>Now that the choice of storage lock is divorced from
that of the persistence adapter one can mix and match. Storage locker
pluggability is made possible because all lockers must implement the <a
shape="rect" class="external-link"
href="https://fisheye6.atlassian.com/browse/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/Locker.java?hb=true"
rel="nofollow">Locker</a> interface. This interface makes it e
asy to implement your own storage locker when you have special requirements.
Of course, every persistence adapter still has its own default locker which
works as before.</p><h2
id="Pluggablestoragelockers-Lockers">Lockers</h2><p>Every locker must implement
the <a shape="rect" class="external-link"
href="https://fisheye6.atlassian.com/browse/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/Locker.java?hb=true"
rel="nofollow">Locker</a> interface. The locker has the following
properties:</p><div class="table-wrap"><table
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1"
class="confluenceTh"><p>Property 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>lockAcquireSleepInterval</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>10000</p></td><td colspan="1"
rowsp
an="1" class="confluenceTd"><p>Delay interval in milliseconds between lock
acquire attempts</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>failIfLocked</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>false</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Should the start fail immediately if lock cannot be
obtained</p></td></tr></tbody></table></div><h2
id="Pluggablestoragelockers-PersistenceAdapters">Persistence
Adapters</h2><p>Every persistence adapter (or other broker service that wants
to use locks) needs to implement the <a shape="rect" class="external-link"
href="https://fisheye6.atlassian.com/browse/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/Lockable.java?r=1383400"
rel="nofollow">Lockable</a> interface. This adds the following
properties:</p><div class="table-wrap"><table
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1"
class="confluenceTh"><p>Property 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>useLock</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>true</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>can be used to turn off locking if
necessary</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>lockKeepAlivePeriod</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>0</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>If bigger than 0, time period (in
milliseconds) to keep lock alive</p></td></tr></tbody></table></div><h2
id="Pluggablestoragelockers-ExistingLockers">Existing Lockers</h2><h3
id="Pluggablestoragelockers-SharedFileLocker">Shared File Locker</h3><p>The
Shared File Locker is the default locker for the KahaDB persistence adapter. It
locks a file to ensure that only the broker holding th
e lock (the master) is granted access to the message
store.</p><p>Example:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<persistenceAdapter>
+<script class="brush: xml; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[<persistenceAdapter>
<kahaDB directory = "target/activemq-data">
<locker>
<shared-file-locker
lockAcquireSleepInterval="5000"/>
@@ -91,7 +81,7 @@
</kahaDB>
</persistenceAdapter>]]></script>
</div></div><p>This locker implements the <code>keepAlive</code> method from
5.9.0 onwards so there's no point in using <code>lockKeepAlivePeriod</code>
settings on older versions than ActiveMQ 5.9.0. Note that as of ActiveMQ 5.9.0
the KahaDB persistence adapter can also use the Lease Database Locker (see
below).</p><h3 id="Pluggablestoragelockers-DatabaseLocker">Database
Locker</h3><p>The Database Locker is the default locker for the JDBC
persistence adapter. It locks a database table in a transaction to ensure that
only single resource is used.</p><p>Example:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<persistenceAdapter>
+<script class="brush: xml; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[<persistenceAdapter>
<jdbcPersistenceAdapter dataDirectory="${activemq.data}"
dataSource="#mysql-ds" lockKeepAlivePeriod="10000">
<locker>
<database-locker lockAcquireSleepInterval="5000"/>
@@ -99,21 +89,15 @@
</jdbcPersistenceAdapter>
</persistenceAdapter>]]></script>
</div></div><p>The Database Locker uses its <code>keepAlive</code> method
to ensure the broker still holds the lock. You can set the keep alive period
using the <code>lockKeepAlivePeriod</code> property. The default period is
30000 ms. If a broker fails to acquire the lock on the database, it will retry
every <code>lockAcquireSleepInterval</code> milliseconds.</p><p>This locker
opens a JDBC transaction against a database table (<code>activemq_lock</code>)
that lasts as long as the broker remains alive. This locks the entire table and
prevents another broker from accessing the store. In most cases this will be a
fairly long running JDBC transaction which occupies resources on the database
over time.</p><p>A problem with this locker can arise when the master broker
crashes or loses its connection to the database causing the lock to remain in
the database until the database responds to the half closed socket connection
via a TCP timeout. The database lock expiry requirement can pr
event the slave from starting some time. In addition, if the database supports
failover, and the connection is dropped in the event of a replica failover,
that JDBC transaction will be rolled back. The broker sees this as a failure.
Both master and slave brokes will again compete for a lock.</p><h3
id="Pluggablestoragelockers-LeaseDatabaseLocker">Lease Database
Locker</h3><p>The Lease Database Locker was created to solve the shortcomings
of the Database Locker. The Lease Database Locker does not open a long running
JDBC transaction. Instead it lets the master broker acquire a lock that's valid
for a fixed (usually short) duration after which it expires. To retain the lock
the master broker must periodically extend the lock's lease before it expires.
Simultaneously the slave broker also checks periodically to see if the lease
has expired. If, for whatever reason, the master broker fails to update its
lease on the lock the slave will take ownership of the lock becoming the new
master
in the process. The leased lock can survive a DB replica
failover.</p><p>Example:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<persistenceAdapter>
+<script class="brush: xml; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[<persistenceAdapter>
<jdbcPersistenceAdapter dataDirectory="${activemq.data}"
dataSource="#mysql-ds" lockKeepAlivePeriod="5000">
<locker>
<lease-database-locker
lockAcquireSleepInterval="10000"/>
</locker>
</jdbcPersistenceAdapter>
</persistenceAdapter>]]></script>
-</div></div><p>In order for this mechanism to work correctly, each broker in
the master/slave pair must have a different <code>brokerName</code> attribute
defined on the <code>broker</code> tag or use the
<span><code>leaseHolderId</code> attribute</span> on the <code><span
style="line-height: 1.4285715;">lease-database-locker</span></code><span>, as
it is this value that is used to reserve a lease.</span></p><p>The lease based
lock is acquired by blocking at startup. It is then retained for a period whose
duration (in ms) is given by the <code>lockKeepAlivePeriod</code> attribute. To
retain the lock the master broker periodically extends its lease by
<code>lockAcquireSleepInterval</code> milliseconds each time. In theory,
therefore, the master broker is always
(<code>lockAcquireSleepInterval</code> <code>-</code>
<code>lockKeepAlivePeriod</code>) ahead of the slave broker with regard to the
lease. It is imperative that <code>lockAcquireSleepInterval >
lockKeepAlivePerio
d</code>, to ensure the lease is always current. As of ActiveMQ 5.9.0 a
warning message is logged if this condition is not met.</p><p>In the simplest
case, the clocks between master and slave must be in sync for this solution to
work properly. If the clocks cannot be in sync, the locker can use the system
time from the database CURRENT TIME and adjust the timeouts in accordance with
their local variance from the DB system time.
If <code>maxAllowableDiffFromDBTime</code> is greater than zero the local
periods will be adjusted by any delta that exceeds
<code>maxAllowableDiffFromDBTime</code>.</p> <div class="aui-message hint
shadowed information-macro">
- <span class="aui-icon icon-hint">Icon</span>
- <div class="message-content">
- <p>It is important to know if the default rules
your JDBC driver uses for converting <code>TIME</code> values are JDBC
compliant. If you're using MySQL, for example, the driver's JDBC URL should
contain <code>useJDBCCompliantTimezoneShift=true</code> to ensure that
<code>TIME</code> value conversion is JDBC compliant. If not the locker could
report a large time difference when it compares the retrieved lease expiration
time against the current system time. Consult your JDBC driver's documentation
for more details.</p>
- </div>
- </div>
-<p>As of ActiveMQ 5.9.0 the lease database locker can be used in conjunction
with the KahaDB persistence adapter. However, this particular combination
requires that the lease database locker element contains a
<code><statements/></code> child element. In the example below
the <code>lockTableName</code> is also configured, although doing so is
not mandatory.</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[Â <persistenceAdapter>
+</div></div><p>In order for this mechanism to work correctly, each broker in
the master/slave pair must have a different <code>brokerName</code> attribute
defined on the <code>broker</code> tag or use the
<span><code>leaseHolderId</code> attribute</span> on the <code><span
style="line-height: 1.4285715;">lease-database-locker</span></code><span>, as
it is this value that is used to reserve a lease.</span></p><p>The lease based
lock is acquired by blocking at startup. It is then retained for a period whose
duration (in ms) is given by the <code>lockKeepAlivePeriod</code> attribute. To
retain the lock the master broker periodically extends its lease by
<code>lockAcquireSleepInterval</code> milliseconds each time. In theory,
therefore, the master broker is always
(<code>lockAcquireSleepInterval</code> <code>-</code>
<code>lockKeepAlivePeriod</code>) ahead of the slave broker with regard to the
lease. It is imperative that <code>lockAcquireSleepInterval >
lockKeepAlivePerio
d</code>, to ensure the lease is always current. As of ActiveMQ 5.9.0 a
warning message is logged if this condition is not met.</p><p>In the simplest
case, the clocks between master and slave must be in sync for this solution to
work properly. If the clocks cannot be in sync, the locker can use the system
time from the database CURRENT TIME and adjust the timeouts in accordance with
their local variance from the DB system time.
If <code>maxAllowableDiffFromDBTime</code> is greater than zero the local
periods will be adjusted by any delta that exceeds
<code>maxAllowableDiffFromDBTime</code>.</p><div
class="confluence-information-macro
confluence-information-macro-information"><span class="aui-icon aui-icon-small
aui-iconfont-info confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>It is important to know if the
default rules your JDBC driver uses for converting <code>TIME</code> values are
JDBC compliant. If you're using MySQL, for example
, the driver's JDBC URL should
contain <code>useJDBCCompliantTimezoneShift=true</code> to ensure that
<code>TIME</code> value conversion is JDBC compliant. If not the locker could
report a large time difference when it compares the retrieved lease expiration
time against the current system time. Consult your JDBC driver's documentation
for more details.</p></div></div><p>As of ActiveMQ 5.9.0 the lease database
locker can be used in conjunction with the KahaDB persistence adapter. However,
this particular combination requires that the lease database locker element
contains a <code><statements/></code> child element. In the example below
the <code>lockTableName</code> is also configured, although doing so is
not mandatory.</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[Â <persistenceAdapter>
<kahaDB directory="target/activemq-data"
lockKeepAlivePeriod="5000">
<locker>
<!-- When used with the KahaDB persistence adapter the
'dataSource' attribute must be defined on the locker itself: -->
Modified: websites/production/activemq/content/producer-flow-control.html
==============================================================================
--- websites/production/activemq/content/producer-flow-control.html (original)
+++ websites/production/activemq/content/producer-flow-control.html Sat Jun 27
21:23:55 2015
@@ -32,16 +32,6 @@
</style>
<![endif]-->
- <link
href='http://activemq.apache.org/styles/highlighter/styles/shCore.css'
rel='stylesheet' type='text/css' />
- <link
href='http://activemq.apache.org/styles/highlighter/styles/shThemeEclipse.css'
rel='stylesheet' type='text/css' />
- <script
src='http://activemq.apache.org/styles/highlighter/scripts/shCore.js'
type='text/javascript'></script>
- <script
src='http://activemq.apache.org/styles/highlighter/scripts/shBrushJava.js'
type='text/javascript'></script>
- <script
src='http://activemq.apache.org/styles/highlighter/scripts/shBrushXml.js'
type='text/javascript'></script>
-
- <script type="text/javascript">
- SyntaxHighlighter.defaults['toolbar'] = false;
- SyntaxHighlighter.all();
- </script>
<title>
Apache ActiveMQ ™ -- Producer Flow Control
@@ -83,11 +73,11 @@
<tr>
<td valign="top" width="100%">
<div class="wiki-content maincontent"><h2
id="ProducerFlowControl-ProducerFlowControl">Producer Flow Control</h2><p>In
ActiveMQ 4.x flow control was implemented using TCP flow control. The
underlying network connection of throttled consumers was suspended to enforce
flow control limits. This strategy is very efficient but can lead to deadlocks
if there are multiple producers and consumers sharing the same
connection.</p><p>As of ActiveMQ 5.0, we can now individually flow control each
producer on a shared connection without having to suspend the entire
connection. By 'flow control' we mean that if the broker detects that the
memory limit for the destination, or the temp- or file-store limits for the
broker, have been exceeded, then the flow of messages can be slowed down. The
producer will be either blocked until resources are available <em>or</em> will
receive a JMSException: this behaviour is configurable and described in the
section below on <code><systemUsage></code>.</p><p
>It's worth noting that the default <code><systemUsage></code> settings
>will cause the producer to <em>block</em> when the <code>memoryLimit</code>
>or <code><systemUsage></code> limits are reached: this blocking
>behaviour is sometimes misinterpreted as a 'hung producer', when in fact the
>producer is simply diligently waiting until space is
>available.</p><ul><li>Messages that are sent synchronously will automatically
>use per producer flow control; this applies generally to persistent messages
>which are sent synchronously <em>unless</em> you enable the
><code>useAsyncSend</code> flag.</li></ul><ul><li>Producers that use <a
>shape="rect" href="async-sends.html">Async Sends</a> - generally speaking,
>producers of non-persistent messages - don't bother waiting for any
>acknowledgement from the broker; so, if a memory limit has been exceeded, you
>will <em>not</em> get notfied. If you do want to be aware of broker limits
>being exceeded, you will need to configure the ProducerWindow
Size connection option so that even async messages are flow controlled per
producer.</li></ul><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[ActiveMQConnectionFactory connctionFactory =
...
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[ActiveMQConnectionFactory connctionFactory =
...
connctionFactory.setProducerWindowSize(1024000);
]]></script>
</div></div><p>The ProducerWindowSize is the maximum number of bytes of data
that a producer will transmit to a broker before waiting for acknowledgment
messages from the broker that it has accepted the previously sent
messages.</p><p>Alternatively, if you're sending non-persisted messages (which
are by default sent async), and want to be informed if the queue or topic's
memory limit has been breached, then you can simply configure the connection
factory to 'alwaysSyncSend'. While this is going to be slower, it will ensure
that your message producer is informed immediately of memory issues.</p><p>If
you like, you can disable flow control for specific JMS queues and topics on
the broker by setting the <code>producerFlowControl</code> flag to false on the
appropriate destination policy in the Broker configuration - e.g.</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<destinationPolicy>
+<script class="brush: xml; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[<destinationPolicy>
<policyMap>
<policyEntries>
<policyEntry topic="FOO.>"
producerFlowControl="false"/>
@@ -96,14 +86,14 @@ connctionFactory.setProducerWindowSize(1
</destinationPolicy>
]]></script>
</div></div><p>see <a shape="rect" href="xml-configuration.html">Broker
Configuration</a>.</p><p>Note that, since the introduction of the new file
cursor in ActiveMQ 5.x, non-persisted messages are shunted into the temporary
file store to reduce the amount of memory used for non-persistent messaging. As
a result, you may find that a queue's memoryLimit is never reached, as the
cursor doesn't use very much memory. If you really do want to keep all your
non-persistent messages in memory, and stop producers when the limit is
reached, you should configure the <code><vmQueueCursor></code>.</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<policyEntry queue=">"
producerFlowControl="true" memoryLimit="1mb">
+<script class="brush: xml; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[<policyEntry queue=">"
producerFlowControl="true" memoryLimit="1mb">
<pendingQueuePolicy>
<vmQueueCursor/>
</pendingQueuePolicy>
</policyEntry>
]]></script>
</div></div><p>The fragment above will ensure that all non-persistent queue
messages are kept in memory, with each queue having a limit of 1Mb.</p><h3
id="ProducerFlowControl-HowProducerFlowControlworks">How Producer Flow Control
works</h3><p>If you are sending a persistent message (so that a response of the
<a shape="rect" href="openwire.html">OpenWire</a> Message is expected then the
broker will send the producer a <a shape="rect" class="external-link"
href="http://activemq.apache.org/maven/5.9.0/apidocs/index.html">ProducerAck</a>
message. This informs the producer that the previous sending window has been
processed, so that it can now send another window. Its kinda like consumer acks
but in reverse.</p><h4 id="ProducerFlowControl-Advantage">Advantage</h4><p>So a
nice producer might wait for a producer ack before sending more data, to avoid
flooding the broker (and forcing the broker to block the entire connection if a
slow consumer occurs). To see how this works in source code,
check out the <a shape="rect" class="external-link"
href="http://activemq.apache.org/maven/5.9.0/apidocs/index.html">ActiveMQMessageProducer</a>
code.</p><p>Though a client can ignore the producer ACKs altogether and the
broker should just stall the transport if it has to for slow consumer handling;
though this does mean it'll stall the entire connection.</p><h3
id="ProducerFlowControl-ConfigureClient-SideExceptions">Configure Client-Side
Exceptions</h3><p>An alternative to the indefinite blocking of the
<code>send()</code> operation when no space is free on the broker is to instead
configure that an exception to be thrown on the client-side. By configuring the
<code>sendFailIfNoSpace</code> property to <code>true</code>, the broker will
cause the <code>send()</code> operation to fail with a
<code>javax.jms.ResourceAllocationException</code>, which will propagate to the
client. Below is an example of this configuration:</p><div class="code panel
pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[<systemUsage>
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[<systemUsage>
<systemUsage sendFailIfNoSpace="true">
<memoryUsage>
<memoryUsage limit="20 mb"/>
@@ -111,7 +101,7 @@ connctionFactory.setProducerWindowSize(1
</systemUsage>
</systemUsage>]]></script>
</div></div><p>The advantage of this property is that the client can catch the
<code>javax.jms.ResourceAllocationException</code>, wait a bit and retry the
<code>send()</code> operation instead of just hanging
indefinitely.</p><p>Starting in version 5.3.1 the
<code>sendFailIfNoSpaceAfterTimeout</code> property has been added. This
property causes the <code>send()</code> operation to fail with an exception on
the client-side, but only after waiting the given amount of time. If space on
the broker is still not freed after the configured amount of time, only then
does the <code>send()</code> operation fail with an exception to the
client-side. Below is an example:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[<systemUsage>
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[<systemUsage>
<systemUsage sendFailIfNoSpaceAfterTimeout="3000">
<memoryUsage>
<memoryUsage limit="20 mb"/>
@@ -119,7 +109,7 @@ connctionFactory.setProducerWindowSize(1
</systemUsage>
</systemUsage>]]></script>
</div></div><p>The timeout is defined in milliseconds so the example above
waits for three seconds before failing the <code>send()</code> operation with
an exception to the client-side. The advantage of this property is that it will
block for the configured amount of time instead of failing immediately or
blocking indefinitely. This property offers not only an improvement on the
broker-side, but also an improvement for the client so it can catch the
exception, wait a bit and retry the <code>send()</code> operation.</p><h2
id="ProducerFlowControl-DisablingFlowControl">Disabling Flow Control</h2><p>A
common requirement is to disable flow control so that message dispatching
continues until all available disk is used up by pending messages (whether
persistent or non persistent messaging is configured). To do this enable <a
shape="rect" href="message-cursors.html">Message Cursors</a>.</p><h2
id="ProducerFlowControl-Systemusage">System usage</h2><p>You can also slow down
producers via som
e attributes on the <code><systemUsage></code> element. Take a look at
the following example:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[<systemUsage>
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[<systemUsage>
<systemUsage>
<memoryUsage>
<memoryUsage limit="64 mb" />
Modified: websites/production/activemq/content/pure-master-slave.html
==============================================================================
--- websites/production/activemq/content/pure-master-slave.html (original)
+++ websites/production/activemq/content/pure-master-slave.html Sat Jun 27
21:23:55 2015
@@ -32,16 +32,6 @@
</style>
<![endif]-->
- <link
href='http://activemq.apache.org/styles/highlighter/styles/shCore.css'
rel='stylesheet' type='text/css' />
- <link
href='http://activemq.apache.org/styles/highlighter/styles/shThemeEclipse.css'
rel='stylesheet' type='text/css' />
- <script
src='http://activemq.apache.org/styles/highlighter/scripts/shCore.js'
type='text/javascript'></script>
- <script
src='http://activemq.apache.org/styles/highlighter/scripts/shBrushJava.js'
type='text/javascript'></script>
- <script
src='http://activemq.apache.org/styles/highlighter/scripts/shBrushXml.js'
type='text/javascript'></script>
-
- <script type="text/javascript">
- SyntaxHighlighter.defaults['toolbar'] = false;
- SyntaxHighlighter.all();
- </script>
<title>
Apache ActiveMQ ™ -- Pure Master Slave
@@ -84,17 +74,10 @@
<td valign="top" width="100%">
<div class="wiki-content maincontent"><h3
id="PureMasterSlave-PureMasterSlave">Pure Master Slave</h3>
- <div class="aui-message problem shadowed information-macro">
- <p class="title">This feature has been deprecated and will
be removed in version 5.8</p>
- <span class="aui-icon icon-problem">Icon</span>
- <div class="message-content">
-
+<div class="confluence-information-macro
confluence-information-macro-warning"><p class="title">This feature has been
deprecated and will be removed in version 5.8</p><span class="aui-icon
aui-icon-small aui-iconfont-error
confluence-information-macro-icon"></span><div
class="confluence-information-macro-body">
<p>This feature will be removed in 5.8 as it has not evolved to be production
ready. <br clear="none">
You are advised to use <a shape="rect" href="masterslave.html">shared storage
master/slave</a> or the <a shape="rect"
href="replicated-leveldb-store.html">Replicated LevelDB Store</a>.<br
clear="none">
-See <a shape="rect" class="external-link"
href="https://issues.apache.org/jira/browse/AMQ-4165">AMQ-4165</a></p>
- </div>
- </div>
-
+See <a shape="rect" class="external-link"
href="https://issues.apache.org/jira/browse/AMQ-4165">AMQ-4165</a></p></div></div>
<p>A Pure Master Slave configuration provides a basic shared nothing, fully
replicated topology which does not depend on a shared file system or shared
database. </p>
@@ -117,7 +100,7 @@ in a clients transaction will not comple
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[
failover://(tcp://masterhost:61616,tcp://slavehost:61616)?randomize=false
]]></script>
</div></div>
@@ -136,20 +119,14 @@ failover://(tcp://masterhost:61616,tcp:/
<h3 id="PureMasterSlave-ConfiguringPureMasterSlave">Configuring Pure Master
Slave</h3>
- <div class="aui-message warning shadowed information-macro">
- <span class="aui-icon icon-warning">Icon</span>
- <div class="message-content">
-
-<p>You should not configure a connection between the master and a slave. The
connection is automatically established with the slave's configuration. If you
explicitly configure a network connection, you may encounter race conditions
when the master broker is under heavy load.</p>
- </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>You should not configure a connection between the master and a slave. The
connection is automatically established with the slave's configuration. If you
explicitly configure a network connection, you may encounter race conditions
when the master broker is under heavy load.</p></div></div>
<p>A master broker doesn't need any special configuration - it's a normal
broker until a slave broker attaches itself.<br clear="none">
To identify a broker as a slave - there is just one property to set (see
below) as this <a shape="rect" class="external-link"
href="http://svn.apache.org/repos/asf/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/broker/ft/slave2.xml">example
shows</a> - so configuration is nice and easy:</p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
+<script class="brush: xml; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[
<broker masterConnectorURI="tcp://masterhost:62001"
shutdownOnMasterFailure="false">
<persistenceAdapter>
<journaledJDBC journalLogFiles="5"
dataDirectory="${activemq.base}/data/broker2" />
@@ -170,7 +147,7 @@ To identify a broker as a slave - there
<p>In ActiveMQ 4.1 or later you can use a
<strong><masterConnector/></strong> element as an alternative XML
configuration mechanism as shown in the following <a shape="rect"
class="external-link"
href="http://svn.apache.org/repos/asf/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/broker/ft/slave2.xml">example</a>
to configure the user and password that the slave will use to connect to the
master</p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[
<broker brokerName="slave" useJmx="false"
deleteAllMessagesOnStartup="true"
xmlns="http://activemq.apache.org/schema/core">
<services>
<masterConnector remoteURI= "tcp://localhost:62001"
userName="James" password="Cheese"/>
Modified: websites/production/activemq/content/redelivery-policy.html
==============================================================================
--- websites/production/activemq/content/redelivery-policy.html (original)
+++ websites/production/activemq/content/redelivery-policy.html Sat Jun 27
21:23:55 2015
@@ -32,15 +32,6 @@
</style>
<![endif]-->
- <link
href='http://activemq.apache.org/styles/highlighter/styles/shCore.css'
rel='stylesheet' type='text/css' />
- <link
href='http://activemq.apache.org/styles/highlighter/styles/shThemeEclipse.css'
rel='stylesheet' type='text/css' />
- <script
src='http://activemq.apache.org/styles/highlighter/scripts/shCore.js'
type='text/javascript'></script>
- <script
src='http://activemq.apache.org/styles/highlighter/scripts/shBrushJava.js'
type='text/javascript'></script>
-
- <script type="text/javascript">
- SyntaxHighlighter.defaults['toolbar'] = false;
- SyntaxHighlighter.all();
- </script>
<title>
Apache ActiveMQ ™ -- Redelivery Policy
@@ -99,7 +90,7 @@
<p>As of ActiveMQ v5.7.0 you can now configure a <a shape="rect"
class="external-link"
href="http://svn.apache.org/viewvc/activemq/trunk/activemq-client/src/main/java/org/apache/activemq/RedeliveryPolicy.java?view=markup">RedeliveryPolicy</a>
on a per-destination bases. The ActiveMQConnection factory class now exposes
a <a shape="rect" class="external-link"
href="http://svn.apache.org/viewvc/activemq/trunk/activemq-client/src/main/java/org/apache/activemq/broker/region/policy/RedeliveryPolicyMap.java?view=markup">RedeliveryPolicyMap</a>
property that allows to assign a RedeliveryPolicy using named destinations or
using destination wildcards. The code snipped below shows how to configure a
different <a shape="rect" class="external-link"
href="http://svn.apache.org/viewvc/activemq/trunk/activemq-client/src/main/java/org/apache/activemq/RedeliveryPolicy.java?view=markup">RedeliveryPolicy</a>
for Topics and Queues. </p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[
ActiveMQConnection connection ... // Create a connection