Added: incubator/activemq/site/Persistence URL: http://svn.apache.org/viewcvs/incubator/activemq/site/Persistence?rev=374430&view=auto ============================================================================== --- incubator/activemq/site/Persistence (added) +++ incubator/activemq/site/Persistence Thu Feb 2 08:31:10 2006 @@ -0,0 +1,318 @@ + + + + + + + + ActiveMQ - Persistence + + + + + + + + + + + + + + + +
+ + + + + + +
+

Overview

+ +

Community

+ +

Using ActiveMQ

+ +

Features

+ +

Connectivitiy

+ +

Utilities

+ +

External Tools

+ +

Related Projects

+ +

Support

+ +

Developers

+ +

Tools we use

+ +

Feeds

+ + + + + + + + + +
+
+
+ Site +
+ + + News +
+
+ +
+ + + + + +
+ Persistence + + +
+
+ + +
+
+

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.

+

Our out of the box default configuration uses Apache Derby as the default database, which is easy to embed - but we support all the major SQL databases - just reconfigure your JDBC configuration in the Xml Configuration.

+

High performance journal

+

To achieve high performance of durable messaging 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).

+

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 only 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.

+

Our journal is based on lots of the great work in the Howl 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.

+

Configuring persistence

+

For full explict control over configuration check out the Xml Configuration. 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.

+

+

+
activemq.persistenceAdapter
+
+

+

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.

+

+

+
activemq myconfig.xml
+
+

+

or just

+

+

+
activemq
+
+

+

Here is a sample XML configuration which shows how to configure the journal and the JDBC persistence.
AMQ 4.x

+

+

+
<beans xmlns="http://activemq.org/config/1.0">
+  
+  <broker useJmx="true">
+
+	<!-- In ActiveMQ 4, you can setup destination policies -->  
+    <destinationPolicy>
+      <policyMap><policyEntries>
+        
+          <policyEntry topic="FOO.>">
+            <dispatchPolicy>
+              <strictOrderDispatchPolicy />
+            </dispatchPolicy>
+            <subscriptionRecoveryPolicy>
+              <lastImageSubscriptionRecoveryPolicy />
+            </subscriptionRecoveryPolicy>
+          </policyEntry>
+
+      </policyEntries></policyMap>
+    </destinationPolicy>
+  
+  
+    <persistenceAdapter>
+      <journaledJDBC journalLogFiles="5" dataDirectory="../activemq-data"/>
+
+    </persistenceAdapter>
+  
+    <transportConnectors>
+       <transportConnector uri="tcp://localhost:61616" discoveryUri="multicast://default"/>
+       
+       <transportConnector uri="stomp://localhost:61617"/>
+    </transportConnectors>
+    
+    <networkConnectors>
+      <!-- by default just auto discover the other brokers -->
+      <networkConnector uri="multicast://default"/>
+      <!--  
+      <networkConnector uri="static://(tcp://host1:61616,tcp://host2:61616)"/>
+      -->
+    </networkConnectors>
+    
+  </broker>
+</beans>
+
+

+

For more details see the Getting Started guide.

+

JDBC Persistence without Journaling

+

To enable JDBC persistence of JMS messages without journaling, we need to change the message broker's default persistence configuration from

+

+

+
<persistence>
+  <journalPersistence directory="../var/journal">
+      <jdbcPersistence dataSourceRef="derby-ds"/>
+  </journalPersistence>
+</persistence>
+
+

+

to

+

+

+
<persistence>
+     <jdbcPersistence dataSourceRef="derby-ds"/>
+ </persistence>
+
+

+

Make sure to send durable messages so that it will be persisted in the database server while waiting to be consumed by clients. More information on configuration JDBC persistence at JDBC Support

+

Disaster Recovery options

+

For people with high DR requirements we have various options for providing a Replicated Message Store to allow full failover in times of major data centre failure.

+
+
+ +   +