You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by fo...@apache.org on 2006/03/02 12:48:05 UTC
svn commit: r382356 - in /incubator/activemq/site: C+Integration
Design+Documents MasterSlave Should+I+use+XA Stomp
Author: foconer
Date: Thu Mar 2 03:47:45 2006
New Revision: 382356
URL: http://svn.apache.org/viewcvs?rev=382356&view=rev
Log:
Latest HTML dump from the confluence wiki created by wikimesh; see the confluence log for a detailed
changelog
Modified:
incubator/activemq/site/C+Integration
incubator/activemq/site/Design+Documents
incubator/activemq/site/MasterSlave
incubator/activemq/site/Should+I+use+XA
incubator/activemq/site/Stomp
Modified: incubator/activemq/site/C+Integration
URL: http://svn.apache.org/viewcvs/incubator/activemq/site/C%2BIntegration?rev=382356&r1=382355&r2=382356&view=diff
==============================================================================
--- incubator/activemq/site/C+Integration (original)
+++ incubator/activemq/site/C+Integration Thu Mar 2 03:47:45 2006
@@ -256,9 +256,14 @@
</div>
<p>It is very common for an organisation to have lots of legacy C code which needs integration into the message bus. The current available solutions are</p>
<ul>
- <li>use the <span class="nobr"><a href="http://stomp.codehaus.org/C+Client">Stomp C Client</a></span> for any version of ActiveMQ from 3.1 onwards. You can also use <span class="nobr"><a href="http://stomp.codehaus.org/">Stomp</a></span> from many other languages like .Net, Python, Ruby, Perl etc.</li>
<li>use the <a href="/OpenWire+C+Client" title="OpenWire C Client">OpenWire C Client</a> which is only available in ActiveMQ 4.x or later.</li>
<li>we are working on the <a href="/OpenWire+CPP+Client" title="OpenWire CPP Client">OpenWire CPP Client</a></li>
+ <li>the <a href="/CMS" title="CMS">CMS</a> C++ client which is a C++ API to <span class="nobr"><a href="http://stomp.codehaus.org/">Stomp</a></span> which can also be implemented with <a href="/OpenWire" title="OpenWire">OpenWire</a></li>
+</ul>
+
+
+<ul>
+ <li>use the <span class="nobr"><a href="http://stomp.codehaus.org/C+Client">Stomp C Client</a></span> for any version of ActiveMQ from 3.1 onwards. You can also use <span class="nobr"><a href="http://stomp.codehaus.org/">Stomp</a></span> from many other languages like .Net, Python, Ruby, Perl etc.</li>
</ul>
Modified: incubator/activemq/site/Design+Documents
URL: http://svn.apache.org/viewcvs/incubator/activemq/site/Design%2BDocuments?rev=382356&r1=382355&r2=382356&view=diff
==============================================================================
--- incubator/activemq/site/Design+Documents (original)
+++ incubator/activemq/site/Design+Documents Thu Mar 2 03:47:45 2006
@@ -255,6 +255,7 @@
</div>
<ul>
+ <li><a href="/Slow+Consumers" title="Slow Consumers">Slow Consumers</a></li>
<li><a href="/Durable+Queue+Memory+Management" title="Durable Queue Memory Management">Durable Queue Memory Management</a></li>
<li><a href="/Supporting+IO+Streams" title="Supporting IO Streams">Supporting IO Streams</a></li>
<li><a href="/Message+Redelivery+and+DLQ+Handling" title="Message Redelivery and DLQ Handling">Message Redelivery and DLQ Handling</a></li>
Modified: incubator/activemq/site/MasterSlave
URL: http://svn.apache.org/viewcvs/incubator/activemq/site/MasterSlave?rev=382356&r1=382355&r2=382356&view=diff
==============================================================================
--- incubator/activemq/site/MasterSlave (original)
+++ incubator/activemq/site/MasterSlave Thu Mar 2 03:47:45 2006
@@ -254,8 +254,8 @@
</center>
</div>
- <table cellpadding="5" width="85%" cellspacing="8px" class="noteMacro" border="0" align="center"><colgroup><col width="24"/><col/></colgroup><tr><td valign="top"><img src="http://docs.codehaus.org/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"/></td><td><b class="strong">Apache ActiveMQ 4.0 Feature</b><br/>
-<p>The Master/Slave functionality is only available in the Apache ActiveMQ 4.0 m5 release and above</p></td></tr></table>
+ <table cellpadding="5" width="85%" cellspacing="8px" class="noteMacro" border="0" align="center"><colgroup><col width="24"/><col/></colgroup><tr><td valign="top"><img src="http://docs.codehaus.org/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"/></td><td><b class="strong">Apache ActiveMQ 4.0 Feature</b><br/><br/>
+The Master/Slave functionality is only available in the Apache ActiveMQ 4.0 m5 release and above</td></tr></table>
<p> </p>
<div class="section_3"><h3><a name="MasterSlave-Introduction"></a>Introduction</h3>
@@ -288,11 +288,15 @@
<ul>
- <li>clients should only use a failover transport for connecting to the master broker - e.g. <b><em>failover://(tcp://masterhost:62001)</em></b><br/>
-The master informs the failover transport on the client the <b><em>URI</em></b> of the slave broker, so in the event of failure the client will automatically<br/>
-re-connect to the slave.</li>
+ <li>clients should use a failover transport for connecting to the master broker first and then the slave. e.g. using a URL such as</li>
</ul>
+
+<div class="code"><div class="codeContent">
+<pre class="code-java">failover:<span class="code-comment">//(tcp://masterhost:61616,tcp://slavehost:61616)?randomize=<span class="code-keyword">false</span></span></pre>
+</div></div>
+
+<p>The <b>randomize</b> property just disables randomness so that the transport will always try the master first, then the slave if it can't connect to that. Note that the slave does not accept connections until it becomes the master</p>
</div><div class="section_3"><h3><a name="MasterSlave-ConfiguringMasterSlave"></a>Configuring MasterSlave</h3>
Modified: incubator/activemq/site/Should+I+use+XA
URL: http://svn.apache.org/viewcvs/incubator/activemq/site/Should%2BI%2Buse%2BXA?rev=382356&r1=382355&r2=382356&view=diff
==============================================================================
--- incubator/activemq/site/Should+I+use+XA (original)
+++ incubator/activemq/site/Should+I+use+XA Thu Mar 2 03:47:45 2006
@@ -254,16 +254,15 @@
</center>
</div>
- <p>A common use of JMS is to consume messages from a queue or topic, process them using a database or EJB, then acknowledge / commit the message. </p>
+ <p>A common use of JMS is to consume messages from a queue or topic, process them using a database or EJB, then acknowledge / commit the message.</p>
<p>If you are using more than one resource; e.g. reading a JMS message and writing to a database, you really should use XA - its purpose is to provide atomic transactions for multiple transactional resources. For example there is a small window from when you complete updating the database and your changes are committed up to the point at which you commit/acknowledge the message; if there is a network/hardware/process failure inside that window, the message will be redelivered and you may end up processing duplicates.</p>
<p>The problem with XA is it can be a bit slow; as the XA protocol requires multiple syncs to disk to ensure it can always recover properly under every possible failure scenario. This adds significant cost (in terms of latency, performance, resources and complexity). Also quite a few EJB servers and databases don't actually properly support XA! <img class="emoticon" src="http://docs.codehaus.org/images/icons/emoticons/smile.gif" height="20" width="20" align="absmiddle" alt="" border="0"/></p>
-<p>So a good optimisation is to use regular JMS transactions - with no XA - and just perform some duplicate message detection in your code to check you have not already processed this. e.g. in pseudocode it'd be something like the following...</p>
-
+<p>So a good optimisation is to use regular JMS transactions - with no XA - and just perform some duplicate message detection in your code to check you have not already processed the message. e.g. in pseudocode it'd be something like the following...</p>
<div class="code"><div class="codeContent">
-<pre class="code-java">onMessage
+<pre class="code-java">onMessage
<span class="code-keyword">try</span> {
<span class="code-keyword">if</span> I have not processed <span class="code-keyword">this</span> message successfully before {
<span class="code-keyword">do</span> some stuff in the database / with EJBs etc
@@ -275,13 +274,17 @@
jms.rollback()
}</pre>
</div></div>
-
-<p>This leads to <b>much</b> better performance since you are not performing many slow syncs to disk (per transaction!) for the XA protocol. The only downside with this approach is it means you have to use some application specific logic to detect if you've processed the message before or not. However its quite common that you'll have some way of detecting this. e.g. if the message contains a purchase order and version; have you stored that purchase order and version in the database yet? </p>
+<p>This leads to <b>much</b> better performance since you are not performing many slow syncs to disk (per transaction!) for the XA protocol. The only downside with this approach is it means you have to use some application specific logic to detect if you've processed the message before or not. However its quite common that you'll have some way of detecting this. e.g. if the message contains a purchase order and version; have you stored that purchase order and version in the database yet?</p>
<p>So provided the message has some kind of ID and version, you can often detect duplicates yourself and so not require to pay the performance cost of XA</p>
-<p>It may also be worth reading <a href="/Should+I+use+transactions" title="Should I use transactions">Should I use transactions</a></p>
+<p>It may also be worth reading <a href="/Should+I+use+transactions" title="Should I use transactions">Should I use transactions</a>.</p>
+
+<div class="section_3"><h3><a name="ShouldIuseXA-Furtheroptimisation"></a>Further optimisation</h3>
+
+<p>Performing duplicate detection can add a performance overhead. e.g. doing a database query to see if you've processed the purchase order before etc. Most of the time things will work; its only in rare circumstances (ilke if a server crashes mid-way processing some messages) that messages get redelivered.</p>
+<p>So you can use the <span class="nobr"><a href="http://java.sun.com/j2ee/1.4/docs/api/javax/jms/Message.html#getJMSRedelivered()">Message.getJMSRedelivered()</a></span> method to detect if a message has been redelivered and only if its been redelivered then perform the duplicate detection check.</p></div>
</div>
<div style="text-align: center; width: 100%; padding-top: 1cm;padding-bottom: 1cm">
<script type="text/javascript"><!--
Modified: incubator/activemq/site/Stomp
URL: http://svn.apache.org/viewcvs/incubator/activemq/site/Stomp?rev=382356&r1=382355&r2=382356&view=diff
==============================================================================
--- incubator/activemq/site/Stomp (original)
+++ incubator/activemq/site/Stomp Thu Mar 2 03:47:45 2006
@@ -261,51 +261,83 @@
<div class="section_3"><h3><a name="Stomp-EnablingtheActiveMQBrokerforStomp"></a>Enabling the ActiveMQ Broker for Stomp</h3>
<p>Its very easy to enable ActiveMQ for Stomp. Just add a connector to the broker using the stomp URL.</p>
-
<div class="code"><div class="codeContent">
<pre class="code-xml"><span class="code-tag"><connector></span>
<span class="code-tag"><serverTransport uri=<span class="code-quote">"stomp://localhost:61626"</span>/></span>
<span class="code-tag"></connector></span></pre>
</div></div>
-
<p>Of course use any host name and port you like.</p>
-<p>To see a full example, try <span class="nobr"><a href="http://activemq.org/checkout/activemq/modules/assembly/src/release/example/conf/activemq-stomp.xml">this XML</a></span>. If you save <span class="nobr"><a href="http://activemq.org/checkout/activemq/modules/assembly/src/release/example/conf/activemq-stomp.xml">this XML</a></span> as foo.xml then you can run stomp via the command line as </p>
-
+<p>To see a full example, try <span class="nobr"><a href="http://activemq.org/checkout/activemq/modules/assembly/src/release/example/conf/activemq-stomp.xml">this XML</a></span>. If you save <span class="nobr"><a href="http://activemq.org/checkout/activemq/modules/assembly/src/release/example/conf/activemq-stomp.xml">this XML</a></span> as foo.xml then you can run stomp via the command line as</p>
<div class="code"><div class="codeContent">
<pre class="code-java">activemq xbean:foo.xml</pre>
</div></div>
-
<p>For more help see <a href="/Run+Broker" title="Run Broker">Run Broker</a>.</p>
</div><div class="section_3"><h3><a name="Stomp-WorkingwithDestinationswithStomp"></a>Working with Destinations with Stomp</h3>
-<p>Note that the prefix in stomp <b>/queue/</b> or <b>/topic/</b> is removed from the string before passing it to ActiveMQ as a JMS destination. Also note that the default separator in MOM systems is . (DOT). So <b>FOO.BAR</b> is the normal syntax of a MOM queue - the Stomp equivalent would be <b>/queue/FOO.BAR</b></p>
-
-<table cellpadding="5" width="85%" cellspacing="8px" class="warningMacro" border="0" align="center"><colgroup><col width="24"/><col/></colgroup><tr><td valign="top"><img src="http://docs.codehaus.org/images/icons/emoticons/forbidden.gif" width="16" height="16" align="absmiddle" alt="" border="0"/></td><td><b class="strong">Be careful about starting destinations with /</b><br/>
-<p>If in Stomp world you use <b>/queue/foo/bar</b> then in a JMS world the queue would be called <b>foo/bar</b> not <b>/foo/bar</b>. </p></td></tr></table>
+<p>Note that the prefix in stomp <b>/queue/</b> or <b>/topic/</b> is removed from the string before passing it to ActiveMQ as a JMS destination. Also note that the default separator in MOM systems is . (DOT). So <b>FOO.BAR</b> is the normal syntax of a MOM queue - the Stomp equivalent would be */queue/FOO.BAR*<table cellpadding="5" width="85%" cellspacing="8px" class="warningMacro" border="0" align="center"><colgroup><col width="24"/><col/></colgroup><tr><td valign="top"><img src="http://docs.codehaus.org/images/icons/emoticons/forbidden.gif" width="16" height="16" align="absmiddle" alt="" border="0"/></td><td><b class="strong">Be careful about starting destinations with /</b><br/><br/>
+If in Stomp world you use <b>/queue/foo/bar</b> then in a JMS world the queue would be called <b>foo/bar</b> not <b>/foo/bar</b>. </td></tr></table></p>
</div><div class="section_3"><h3><a name="Stomp-UsingJMSsemanticswithStomp"></a>Using JMS semantics with Stomp</h3>
<p>Note that Stomp is designed to be as simple as possible - so any scripting language / platform can message any other with minimal effort.</p>
-<p>Stomp allows pluggable headers on each request such as sending & receiving messages. In the ActiveMQ server we auto-detect all of the standard JMS properties such as</p>
+<p>Stomp allows pluggable headers on each request such as sending & receiving messages. These custom headers can then be used inside JMS selectors used in any client of ActiveMQ (Stomp or OpenWire)</p>
+<p>In the ActiveMQ server we auto-detect standard JMS properties such as</p>
<ul>
- <li>JMSReplyTo - the destination you should send replies to</li>
- <li>JMSCorrelationID - good consumes will add this header to any responses they send</li>
+ <li>JMSXGroupID and JMSXGroupSeq for specifying the <a href="/Message+Groups" title="Message Groups">Message Groups</a></li>
</ul>
+<p>In addition Stomp supports the following standard JMS properties</p>
+<table class="confluenceTable"><tbody>
+<tr>
+<th class="confluenceTh"> Stomp header </th>
+<th class="confluenceTh"> JMS header </th>
+<th class="confluenceTh"> Description </th>
+</tr>
+<tr>
+<td class="confluenceTd"> correlation-id </td>
+<td class="confluenceTd"> JMSCorrelationID </td>
+<td class="confluenceTd"> good consumes will add this header to any responses they send </td>
+</tr>
+<tr>
+<td class="confluenceTd"> expires </td>
+<td class="confluenceTd"> JMSExpiration </td>
+<td class="confluenceTd"> the expiration time of the message </td>
+</tr>
+<tr>
+<td class="confluenceTd"> persistent </td>
+<td class="confluenceTd"> JMSDeliveryMode </td>
+<td class="confluenceTd"> whether or not the message is persistent</td>
+</tr>
+<tr>
+<td class="confluenceTd"> priority </td>
+<td class="confluenceTd"> JMSPriority </td>
+<td class="confluenceTd"> the priority on the message </td>
+</tr>
+<tr>
+<td class="confluenceTd"> reply-to </td>
+<td class="confluenceTd"> JMSReplyTo </td>
+<td class="confluenceTd"> the destination you should send replies to </td>
+</tr>
+<tr>
+<td class="confluenceTd"> type </td>
+<td class="confluenceTd"> JMSType </td>
+<td class="confluenceTd"> sets the type of the message</td>
+</tr>
+</tbody></table>
+
</div><div class="section_3"><h3><a name="Stomp-ActiveMQextensionstoStomp"></a>ActiveMQ extensions to Stomp</h3>
<p>You can add custom headers to Stomp commands to configure the ActiveMQ protocol. Here are some examples</p>
-
<table class="confluenceTable"><tbody>
<tr>
-<th class="confluenceTh">Verb</th>
-<th class="confluenceTh">Header</th>
-<th class="confluenceTh">Description</th>
+<th class="confluenceTh"> Verb </th>
+<th class="confluenceTh"> Header </th>
+<th class="confluenceTh"> Description </th>
</tr>
<tr>
<td class="confluenceTd"> SUBSCRIBE </td>