activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From passiba <pasishemei...@hotmail.com>
Subject Spring + embedded ActiveMQ Broker
Date Fri, 05 Dec 2008 19:11:09 GMT

Hi there,

I'm waiting acsousnly your coming chapers about embedding the ActiveMQ in
containgers. How ever I'm facing currently a dialemma of how to get Spring
2.5.6 based application running with the following mave2-dependencies and
the embedded ActiveMQ broker configuration.


currenlty I'm trying to get it started as maven project using following
depenencies
...
<spring.version>2.5.6</spring.version>

...
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- apache ActiveMQ dependency-->
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>5.2.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.xbean</groupId>
<artifactId>xbean-spring</artifactId>
<version>3.4.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId>
<version>1.5.0</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>concurrent</groupId>
<artifactId>concurrent</artifactId>
<version>1.3.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jta_1.1_spec</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-j2ee-management_1.0_spec</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jms_1.1_spec</artifactId>
<version>1.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
<scope>compile</scope>
</dependency>


and with the following apachemq.xml configuration file of embedded activemq
broker


<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"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core.xsd
http://activemq.apache.org/camel/schema/spring
http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">

<!-- Allows us to use system properties as variables in this configuration
file -->
<context:property-placeholder
location="classpath:META-INF/activemq.properties"/>
<broker xmlns="http://activemq.apache.org/schema/core"
brokerName="localhost" useJmx="false">



<!-- Use the following to configure how ActiveMQ is exposed in JMX -->
<managementContext>
<managementContext createConnector="false"/>
</managementContext>

<!-- The store and forward broker networks ActiveMQ will listen to -->
<networkConnectors>
<!-- by default just auto discover the other brokers
<networkConnector name="default-nc" uri="multicast://default"/>-->
<!-- Example of a static configuration: -->
<networkConnector name="localhost" uri="static://(tcp://localhost:61616)"/>

</networkConnectors>



<!-- Or if you want to use pure JDBC without a journal -->
<!---->
<persistenceAdapter>
<jdbcPersistenceAdapter dataSource="#mysql-ds"/>
</persistenceAdapter>


<!-- The transport connectors ActiveMQ will listen to -->
<transportConnectors>


<transportConnector name="openwire" uri="tcp://localhost:61636"/>

</transportConnectors>

</broker>

<!-- MySql DataSource Sample Setup -->
<!-- -->
<bean id="mysql-ds" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="com.mysql.jdbc.Driver"/>
<property name="jdbcUrl"
value="jdbc:mysql://localhost:3306/activemq?relaxAutoCommit=true"/>
<property name="user" value="activemq"/>
<property name="password" value="activemq"/>
<property name="minPoolSize">
<value>10</value>
</property>
<property name="maxPoolSize">
<value>20</value>
</property>
</bean>




</beans>



and reference to the embedded broker

<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util"

xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-2.5.xsd">
<tx:annotation-driven transaction-manager="transactionManager"/>


<bean id="broker" class="org.apache.activemq.xbean.BrokerFactoryBean">
<property name="config" value="classpath:META-INF/activemq.xml" />
<property name="start" value="true" />

</bean>

<bean id="jmsConntectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="vm://localhost"/>


</bean>

Is this the right way of configuring embedded broker
-- 
View this message in context: http://www.nabble.com/Spring-%2B-embedded-ActiveMQ-Broker-tp20860604p20860604.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message