Skip to content
Browse files

Active mq config and tasks

  • Loading branch information...
1 parent f850eb3 commit bcc405699ca460e338f14977111e09e12db8c870 @rsanheim committed
Showing with 92 additions and 0 deletions.
  1. +79 −0 config/activemq.xml
  2. +13 −0 lib/tasks/activemq.rake
View
79 config/activemq.xml
@@ -0,0 +1,79 @@
+<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
+ 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 -->
+ <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+ <property name="locations">
+ <value>file:///${activemq.base}/conf/credentials.properties</value>
+ </property>
+ </bean>
+
+ <broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.base}/data">
+
+ <!-- Destination specific policies using destination names or wildcards -->
+ <destinationPolicy>
+ <policyMap>
+ <policyEntries>
+ <policyEntry queue=">" memoryLimit="5mb"/>
+ <policyEntry topic=">" memoryLimit="5mb">
+ </policyEntry>
+ </policyEntries>
+ </policyMap>
+ </destinationPolicy>
+
+ <!-- Use the following to configure how ActiveMQ is exposed in JMX -->
+ <managementContext>
+ <managementContext createConnector="false"/>
+ </managementContext>
+
+ <persistenceAdapter>
+ <amqPersistenceAdapter syncOnWrite="false" directory="${activemq.base}/data" maxFileLength="20 mb"/>
+ </persistenceAdapter>
+
+ <sslContext>
+ <sslContext keyStore="file:${activemq.base}/conf/broker.ks" keyStorePassword="password" trustStore="file:${activemq.base}/conf/broker.ts" trustStorePassword="password"/>
+ </sslContext>
+
+ <!-- The maximum about of space the broker will use before slowing down producers -->
+ <systemUsage>
+ <systemUsage>
+ <memoryUsage>
+ <memoryUsage limit="20 mb"/>
+ </memoryUsage>
+ <storeUsage>
+ <storeUsage limit="1 gb" name="foo"/>
+ </storeUsage>
+ <tempUsage>
+ <tempUsage limit="100 mb"/>
+ </tempUsage>
+ </systemUsage>
+ </systemUsage>
+
+
+ <!-- The transport connectors ActiveMQ will listen to -->
+ <transportConnectors>
+ <transportConnector name="stomp" uri="stomp://localhost:61613"/>
+ </transportConnectors>
+
+ </broker>
+
+
+ <!-- An embedded servlet engine for serving up the Admin console -->
+ <jetty xmlns="http://mortbay.com/schemas/jetty/1.0">
+ <connectors>
+ <nioConnector port="8161"/>
+ </connectors>
+
+ <handlers>
+ <webAppContext contextPath="/admin" resourceBase="${activemq.base}/webapps/admin" logUrlOnStart="true"/>
+ <webAppContext contextPath="/fileserver" resourceBase="${activemq.base}/webapps/fileserver" logUrlOnStart="true"/>
+ </handlers>
+ </jetty>
+
+</beans>
+<!-- END SNIPPET: example -->
View
13 lib/tasks/activemq.rake
@@ -0,0 +1,13 @@
+namespace :activemq do
+ desc "Start ActiveMQ"
+ task :start do
+ system("$ACTIVEMQ_HOME/bin/activemq xbean:file:./config/activemq.xml &") || abort("Starting ActiveMQ failed")
+ end
+
+ desc "Stop ActiveMQ"
+ task :stop do
+ pid = `ps -ax |grep [a]ctivemq.xml|awk '{print $1}'`
+ puts "Stopping ActiveMQ at PID #{pid}"
+ system("kill #{pid}") || abort("Stoppin ActiveMQ failed")
+ end
+end

0 comments on commit bcc4056

Please sign in to comment.
Something went wrong with that request. Please try again.