Tuesday, March 13, 2012

Maven and the ActiveMQ Plugin

I've been working with standing up a Quick ActiveMQ instance.  The maven plugin seems to do the trick nicely -

Step 1 - Create a maven pom

[sourcecode language="xml"]
<project>

<modelVersion>4.0.0</modelVersion>

<groupId>com.codingspaces.activemq</groupId>
<artifactId>server</artifactId>
<version>1.0.0</version>
<description/>

<build>

<plugins>

<plugin>

<groupId>org.apache.activemq.tooling</groupId>
<artifactId>maven-activemq-plugin</artifactId>
<version>5.2.0</version>
<configuration>
xbean:file:src/main/resources/activemq.xml
<fork>false</fork>

<systemProperties>
<property>
<name>org.apache.activemq.default.directory.prefix</name>
<value>./target/</value>
</property>
</systemProperties>
</configuration>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>2.5.5</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>5.2.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>

</project>
[/sourcecode]

Step 2 - Create the activemq.xml config file in src/main/resources/

[sourcecode language="xml"]
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.xsd
http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core.xsd">
xmlns="http://activemq.org/config/1.0"
brokerName="vizuri"
useJmx="true">
<destinations>
<queue physicalName="receiveViaBridge" />
</destinations>
<transportConnectors>
<transportConnector name="vizuri" uri="tcp://localhost:61616" discoveryUri="multicast://default"/>
</transportConnectors>
</broker>
</beans>
[/sourcecode]

Step 3 - Run it
mvn clean install activemq:run
Post a Comment