Advertisement
Laures

Cluster ActiveMQ config

Jan 24th, 2012
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 5.55 KB | None | 0 0
  1. <beans xmlns="http://www.springframework.org/schema/beans"
  2.     xmlns:amq="http://activemq.apache.org/schema/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3.     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  4.  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
  5.  
  6.     <!-- Allows us to use system properties as variables in this configuration
  7.         file -->
  8.     <bean
  9.         class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
  10.         <property name="locations">
  11.             <value>file:${activemq.base}/conf/messaging.properties</value>
  12.         </property>
  13.     </bean>
  14.  
  15.     <!-- The <broker> element is used to configure the ActiveMQ broker. -->
  16.     <broker xmlns="http://activemq.apache.org/schema/core"
  17.         brokerName="${broker.name}" dataDirectory="${activemq.base}/../data" waitForSlave="${cluster.replication}">
  18.  
  19.         <!-- For better performances use VM cursor and small memory limit. For
  20.             more information, see: http://activemq.apache.org/message-cursors.html Also,
  21.             if your producer is "hanging", it's probably due to producer flow control.
  22.             For more information, see: http://activemq.apache.org/producer-flow-control.html -->
  23.  
  24.         <destinationPolicy>
  25.             <policyMap>
  26.                 <policyEntries>
  27.                     <policyEntry topic=">" producerFlowControl="false" advisoryWhenFull="true">
  28.                         <pendingSubscriberPolicy>
  29.                             <fileCursor />
  30.                         </pendingSubscriberPolicy>
  31.                     </policyEntry>
  32.                     <policyEntry queue=">" producerFlowControl="false" advisoryWhenFull="true">
  33.                         <deadLetterStrategy>
  34.                             <!-- Use the prefix 'DLQ.' for the destination name, and make the
  35.                                 DLQ a queue rather than a topic -->
  36.                             <individualDeadLetterStrategy
  37.                                 queuePrefix="DLQ." useQueueForQueueMessages="true" processNonPersistent="true" />
  38.                         </deadLetterStrategy>
  39.                         <!-- Use VM cursor for better latency For more information, see: http://activemq.apache.org/message-cursors.html -->
  40.                         <pendingQueuePolicy>
  41.                             <fileQueueCursor />
  42.                         </pendingQueuePolicy>
  43.                     </policyEntry>
  44.                 </policyEntries>
  45.             </policyMap>
  46.         </destinationPolicy>
  47.  
  48.         <!-- Default destinations -->
  49.         <destinations>
  50.         </destinations>
  51.  
  52.         <!-- The managementContext is used to configure how ActiveMQ is exposed
  53.             in JMX. By default, ActiveMQ uses the MBean server that is started by the
  54.             JVM. For more information, see: http://activemq.apache.org/jmx.html -->
  55.         <managementContext>
  56.             <managementContext createConnector="true" />
  57.         </managementContext>
  58.  
  59.         <!-- The store and forward broker networks ActiveMQ will listen to Create
  60.             a duplex connector to the first broker -->
  61.         <networkConnectors>
  62.             <!-- This Marker will be replaced by the startstop script -->
  63.             <networkConnector name="mq-clusterA-server01-master" uri="static:(failover:(tcp://mq-clusterA-server01-master:61618,tcp://mq-clusterA-server01-slave-01:61618)?randomize=false)" duplex="false" userName="admin" password="admin" bridgeTempDestinations="false" />
  64.             <networkConnector name="mq-clusterA-server02-master" uri="static:(failover:(tcp://mq-clusterA-server02-master:61618,tcp://mq-clusterA-server02-slave-01:61618)?randomize=false)" duplex="false" userName="admin" password="admin" bridgeTempDestinations="false" />
  65.         </networkConnectors>
  66.  
  67.         <!-- Configure message persistence for the broker. The default persistence
  68.             mechanism is the KahaDB store (identified by the kahaDB tag). For more information,
  69.             see: http://activemq.apache.org/persistence.html -->
  70.         <persistenceAdapter>
  71.             <kahaDB directory="${activemq.base}/../data/kahadb" />
  72.         </persistenceAdapter>
  73.  
  74.         <!-- Simple Authentication -->
  75.         <plugins>
  76.             <!-- use JAAS to authenticate using the login.config file on the classpath
  77.                 to configure JAAS -->
  78.             <jaasAuthenticationPlugin configuration="globaldataAuthentication" />
  79.  
  80.             <!-- lets configure a destination based authorization mechanism -->
  81.             <bean xmlns="http://www.springframework.org/schema/beans" id="authPlugin"
  82.                 class="org.apache.activemq.security.AuthorizationPlugin">
  83.                 <property name="map">
  84.                     <bean id="globaldataAuthorizationMap" class="..." \>
  85.                 </property>
  86.             </bean>
  87.  
  88.             <!-- load the statistics plugin for metering and memory monitoring -->
  89.             <statisticsBrokerPlugin />
  90.         </plugins>
  91.  
  92.         <systemUsage>
  93.             <systemUsage sendFailIfNoSpace="true">
  94.                 <memoryUsage>
  95.                     <memoryUsage limit="1 gb" />
  96.                 </memoryUsage>
  97.                 <storeUsage>
  98.                     <storeUsage limit="10 gb" />
  99.                 </storeUsage>
  100.                 <tempUsage>
  101.                     <tempUsage limit="20 gb" />
  102.                 </tempUsage>
  103.             </systemUsage>
  104.         </systemUsage>
  105.  
  106.         <!-- The transport connectors expose ActiveMQ over a given protocol to
  107.             clients and other brokers. For more information, see: http://activemq.apache.org/configuring-transports.html -->
  108.         <transportConnectors>
  109.             <transportConnector name="stomp"
  110.                 uri="stomp://0.0.0.0:61612?transport.closeAsync=false" />
  111.             <transportConnector name="stomp+nio"
  112.                 uri="stomp+nio://0.0.0.0:61613?transport.closeAsync=false" />
  113.             <transportConnector name="openwire-external" uri="tcp://0.0.0.0:61616" />
  114.             <transportConnector name="openwire-internal" uri="tcp://0.0.0.0:61617" />
  115.             <transportConnector name="openwire-cluster" uri="tcp://0.0.0.0:61618" />
  116.         </transportConnectors>
  117.  
  118.     </broker>
  119.  
  120.     <!-- Uncomment to enable Camel Take a look at activemq-camel.xml for more
  121.         details <import resource="camel.xml"/> -->
  122.  
  123.     <!-- Enable web consoles and REST API Take a look at activemq-jetty.xml
  124.         for more details -->
  125.     <import resource="jetty.xml" />
  126.  
  127. </beans>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement