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 ™ -- 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[
+<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">
+
+ <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+
+ <broker useJmx="true" xmlns="http://activemq.apache.org/schema/core">
+
+ <persistenceFactory>
+ <kahaDB directory="${basedir}/target" />
+ </persistenceFactory>
+
+ <transportConnectors>
+ <transportConnector uri="tcp://localhost:61636" />
+ </transportConnectors>
+
+ </broker>
+</beans>
+]]></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[
+<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">
+
+ <!-- lets create an embedded ActiveMQ Broker -->
+ <amq:broker useJmx="false" persistent="false">
+ <amq:transportConnectors>
+ <amq:transportConnector uri="tcp://localhost:0" />
+ </amq:transportConnectors>
+ </amq:broker>
+
+ <!-- ActiveMQ destinations to use -->
+ <amq:queue id="destination" physicalName="org.apache.activemq.spring.Test.spring.embedded"/>
+
+ <!-- JMS ConnectionFactory to use, configuring the embedded broker using XML -->
+ <amq:connectionFactory id="jmsFactory" brokerURL="vm://localhost"/>
+
+
+ <!-- Spring JMS Template -->
+ <bean id="myJmsTemplate" class="org.springframework.jms.core.JmsTemplate">
+ <property name="connectionFactory">
+ <!-- lets wrap in a pool to avoid creating a connection per send -->
+ <bean class="org.springframework.jms.connection.SingleConnectionFactory">
+ <property name="targetConnectionFactory">
+ <ref local="jmsFactory" />
+ </property>
+ </bean>
+ </property>
+ </bean>
+
+ <bean id="consumerJmsTemplate" class="org.springframework.jms.core.JmsTemplate">
+ <property name="connectionFactory" ref="jmsFactory"/>
+ </bean>
+
+ <!-- a sample POJO which uses a Spring JmsTemplate -->
+ <bean id="producer" class="org.apache.activemq.spring.SpringProducer">
+ <property name="template">
+ <ref bean="myJmsTemplate"></ref>
+ </property>
+
+ <property name="destination">
+ <ref bean="destination" />
+ </property>
+
+ <property name="messageCount">
+ <value>10</value>
+ </property>
+ </bean>
+
+ <!-- a sample POJO consumer -->
+ <bean id="consumer" class="org.apache.activemq.spring.SpringConsumer">
+ <property name="template" ref="consumerJmsTemplate"/>
+ <property name="destination" ref="destination"/>
+ </bean>
+
+</beans>
+]]></script>
+</div></div>
<h3><a shape="rect" name="HowdoIembedaBrokerinsideaConnection-UsingActiveMQConnectionFactory"></a>Using ActiveMQConnectionFactory </h3>