You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by bu...@apache.org on 2013/11/11 10:22:16 UTC

svn commit: r886145 - in /websites/production/activemq/content: cache/main.pageCache how-do-i-embed-a-broker-inside-a-connection.html

Author: buildbot
Date: Mon Nov 11 09:22:15 2013
New Revision: 886145

Log:
Production update by buildbot for activemq

Modified:
    websites/production/activemq/content/cache/main.pageCache
    websites/production/activemq/content/how-do-i-embed-a-broker-inside-a-connection.html

Modified: websites/production/activemq/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/activemq/content/how-do-i-embed-a-broker-inside-a-connection.html
==============================================================================
--- websites/production/activemq/content/how-do-i-embed-a-broker-inside-a-connection.html (original)
+++ websites/production/activemq/content/how-do-i-embed-a-broker-inside-a-connection.html Mon Nov 11 09:22:15 2013
@@ -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 &#8482; -- How do I embed a Broker inside a Connection
@@ -189,13 +179,99 @@ BrokerService broker = BrokerFactory.cre
 
 <p>If you are already using <a shape="rect" class="external-link" href="http://geronimo.apache.org/xbean/">XBean</a> then you can just mix and match your Spring/XBean <a shape="rect" class="external-link" href="https://svn.apache.org/repos/asf/incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/xbean/activemq.xml">XML configuration</a> with ActiveMQ's configuration.</p>
 
-<div class="error"><span class="error">Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> </div>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+&lt;beans 
+  xmlns="http://www.springframework.org/schema/beans" 
+  xmlns:amq="http://activemq.apache.org/schema/core"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd"&gt;
+
+  &lt;bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/&gt;
+
+  &lt;broker useJmx="true" xmlns="http://activemq.apache.org/schema/core"&gt;
+
+    &lt;persistenceFactory&gt;
+      &lt;kahaDB directory="${basedir}/target" /&gt;
+    &lt;/persistenceFactory&gt;
+
+    &lt;transportConnectors&gt;
+      &lt;transportConnector uri="tcp://localhost:61636" /&gt;
+    &lt;/transportConnectors&gt;
+
+  &lt;/broker&gt;
+&lt;/beans&gt;
+]]></script>
+</div></div>
 
 <h3><a shape="rect" name="HowdoIembedaBrokerinsideaConnection-UsingSpring2.0"></a>Using Spring 2.0</h3>
 
 <p>If you are using Spring 2.0 and ActiveMQ 4.1 or later (and xbean-spring 2.5 or later) you can embed the ActiveMQ broker XML inside any regular Spring.xml file without requiring the above factory bean. e.g. here is an <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/incubator/activemq/trunk/activemq-core/src/test/resources/spring-embedded-xbean.xml">example</a> of a regular Spring XML file in Spring 2.0 which also configures a broker.</p>
 
-<div class="error"><span class="error">Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> </div>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+&lt;beans 
+  xmlns="http://www.springframework.org/schema/beans" 
+  xmlns:amq="http://activemq.apache.org/schema/core"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd"&gt;
+  
+  &lt;!--  lets create an embedded ActiveMQ Broker --&gt;
+  &lt;amq:broker useJmx="false" persistent="false"&gt;
+    &lt;amq:transportConnectors&gt;
+      &lt;amq:transportConnector uri="tcp://localhost:0" /&gt;
+    &lt;/amq:transportConnectors&gt;
+  &lt;/amq:broker&gt;
+
+   &lt;!--  ActiveMQ destinations to use  --&gt;
+  &lt;amq:queue id="destination"  physicalName="org.apache.activemq.spring.Test.spring.embedded"/&gt;
+
+  &lt;!-- JMS ConnectionFactory to use, configuring the embedded broker using XML --&gt;
+  &lt;amq:connectionFactory id="jmsFactory" brokerURL="vm://localhost"/&gt;
+  
+
+  &lt;!-- Spring JMS Template --&gt;
+  &lt;bean id="myJmsTemplate" class="org.springframework.jms.core.JmsTemplate"&gt;
+    &lt;property name="connectionFactory"&gt;
+      &lt;!-- lets wrap in a pool to avoid creating a connection per send --&gt;
+      &lt;bean class="org.springframework.jms.connection.SingleConnectionFactory"&gt;
+        &lt;property name="targetConnectionFactory"&gt;
+          &lt;ref local="jmsFactory" /&gt;
+        &lt;/property&gt;
+      &lt;/bean&gt;
+    &lt;/property&gt;
+  &lt;/bean&gt;
+
+  &lt;bean id="consumerJmsTemplate" class="org.springframework.jms.core.JmsTemplate"&gt;
+    &lt;property name="connectionFactory" ref="jmsFactory"/&gt;
+  &lt;/bean&gt;
+
+  &lt;!-- a sample POJO which uses a Spring JmsTemplate --&gt;
+  &lt;bean id="producer" class="org.apache.activemq.spring.SpringProducer"&gt;
+    &lt;property name="template"&gt;
+      &lt;ref bean="myJmsTemplate"&gt;&lt;/ref&gt;
+    &lt;/property&gt;
+
+    &lt;property name="destination"&gt;
+      &lt;ref bean="destination" /&gt;
+    &lt;/property&gt;
+
+    &lt;property name="messageCount"&gt;
+      &lt;value&gt;10&lt;/value&gt;
+    &lt;/property&gt;
+  &lt;/bean&gt;
+
+  &lt;!-- a sample POJO consumer --&gt;
+  &lt;bean id="consumer" class="org.apache.activemq.spring.SpringConsumer"&gt;
+    &lt;property name="template" ref="consumerJmsTemplate"/&gt;
+    &lt;property name="destination" ref="destination"/&gt;
+  &lt;/bean&gt;
+
+&lt;/beans&gt;
+]]></script>
+</div></div>
 
 <h3><a shape="rect" name="HowdoIembedaBrokerinsideaConnection-UsingActiveMQConnectionFactory"></a>Using ActiveMQConnectionFactory </h3>