Guest User

Activemq config

a guest
May 28th, 2013
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 8.84 KB | None | 0 0
  1. <!--
  2.    Licensed to the Apache Software Foundation (ASF) under one or more
  3.    contributor license agreements.  See the NOTICE file distributed with
  4.    this work for additional information regarding copyright ownership.
  5.    The ASF licenses this file to You under the Apache License, Version 2.0
  6.    (the "License"); you may not use this file except in compliance with
  7.    the License.  You may obtain a copy of the License at
  8.  
  9.    http://www.apache.org/licenses/LICENSE-2.0
  10.  
  11.    Unless required by applicable law or agreed to in writing, software
  12.    distributed under the License is distributed on an "AS IS" BASIS,
  13.    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.    See the License for the specific language governing permissions and
  15.    limitations under the License.
  16. -->
  17. <!-- START SNIPPET: example -->
  18. <beans
  19.  xmlns="http://www.springframework.org/schema/beans"
  20.  xmlns:amq="http://activemq.apache.org/schema/core"
  21.  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  22.  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
  23.  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
  24.  
  25.     <!-- Allows us to use system properties as variables in this configuration file
  26.    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
  27.        <property name="locations">
  28.            <value>file:${activemq.conf}/credentials.properties</value>
  29.        </property>
  30.    </bean>-->
  31.  
  32. <!--  when using the password in plain text here it works
  33.     <bean id="configurationEncryptor" class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor">
  34.       <property name="algorithm" value="PBEWithMD5AndDES"/>
  35.       <property name="password" value="activemq"/>
  36.     </bean> -->
  37.  
  38. <!-- Allows us to use encrypted system properties as variables in this configuration file
  39. doesnt seem to work even if ACTIVEMQ_ENCRYPTION_PASSWORD is set in the environment -->
  40.   <bean id="environmentVariablesConfiguration" class="org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig">
  41.     <property name="algorithm" value="PBEWithMD5AndDES" />
  42.     <property name="passwordEnvName" value="ACTIVEMQ_ENCRYPTION_PASSWORD" />
  43.   </bean>
  44.                                                                      
  45.   <bean id="configurationEncryptor" class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor">
  46.     <property name="config" ref="environmentVariablesConfiguration" />
  47.   </bean>  
  48.    
  49.   <bean id="propertyConfigurer" class="org.jasypt.spring.properties.EncryptablePropertyPlaceholderConfigurer">
  50.       <constructor-arg ref="configurationEncryptor" />
  51.       <property name="location" value="file:${activemq.conf}/credentials-enc.properties"/>
  52.   </bean>
  53.  
  54.  
  55.  
  56.  
  57.     <!--
  58.        The <broker> element is used to configure the ActiveMQ broker.
  59.    -->
  60.     <broker xmlns="http://activemq.apache.org/schema/core" brokerName="virtualBroaker" dataDirectory="${activemq.data}">
  61.  
  62.         <!--
  63.            For better performances use VM cursor and small memory limit.
  64.            For more information, see:
  65.  
  66.            http://activemq.apache.org/message-cursors.html
  67.  
  68.            Also, if your producer is "hanging", it's probably due to producer flow control.
  69.            For more information, see:
  70.            http://activemq.apache.org/producer-flow-control.html
  71.        -->
  72.  
  73.         <destinationPolicy>
  74.             <policyMap>
  75.               <policyEntries>
  76.                 <policyEntry topic=">" producerFlowControl="true">
  77.                     <!-- The constantPendingMessageLimitStrategy is used to prevent
  78.                         slow topic consumers to block producers and affect other consumers
  79.                         by limiting the number of messages that are retained
  80.                         For more information, see:
  81.  
  82.                         http://activemq.apache.org/slow-consumer-handling.html
  83.  
  84.                    -->
  85.                   <pendingMessageLimitStrategy>
  86.                     <constantPendingMessageLimitStrategy limit="1000"/>
  87.                   </pendingMessageLimitStrategy>
  88.                 </policyEntry>
  89.                 <policyEntry queue=">" producerFlowControl="true" memoryLimit="1mb">
  90.                   <!-- Use VM cursor for better latency
  91.                       For more information, see:
  92.  
  93.                       http://activemq.apache.org/message-cursors.html
  94.  
  95.                  <pendingQueuePolicy>
  96.                    <vmQueueCursor/>
  97.                  </pendingQueuePolicy>
  98.                  -->
  99.                 </policyEntry>
  100.               </policyEntries>
  101.             </policyMap>
  102.         </destinationPolicy>
  103.  
  104.  
  105.         <!--
  106.            The managementContext is used to configure how ActiveMQ is exposed in
  107.            JMX. By default, ActiveMQ uses the MBean server that is started by
  108.            the JVM. For more information, see:
  109.  
  110.            http://activemq.apache.org/jmx.html
  111.        -->
  112.         <managementContext>
  113.             <managementContext createConnector="false"/>
  114.         </managementContext>
  115.  
  116.         <!--
  117.            Configure message persistence for the broker. The default persistence
  118.            mechanism is the KahaDB store (identified by the kahaDB tag).
  119.            For more information, see:
  120.  
  121.            http://activemq.apache.org/persistence.html
  122.        -->
  123.         <persistenceAdapter>
  124.             <kahaDB directory="${activemq.data}/kahadb"/>
  125.         </persistenceAdapter>
  126.  
  127.     <plugins>
  128.     <simpleAuthenticationPlugin anonymousAccessAllowed="true">
  129.         <users>
  130.         <authenticationUser username="system" password="manager"
  131.             groups="anonymous,admins"/>
  132.         </users>
  133.     </simpleAuthenticationPlugin>
  134.  
  135.  
  136.       <!--  Lets configure a destination based authorization mechanism -->
  137.       <authorizationPlugin>
  138.         <map>
  139.           <authorizationMap>
  140.             <authorizationEntries>
  141.               <authorizationEntry queue=">" read="admins,anonymous" write="admins" admin="admins,anonymous" />
  142.              
  143.               <authorizationEntry topic=">" read="admins,anonymous"  write="admins" admin="admins,anonymous" />
  144.  
  145.             </authorizationEntries>
  146.           </authorizationMap>
  147.         </map>
  148.       </authorizationPlugin>
  149.  
  150.     </plugins>
  151.  
  152.     <sslContext>
  153.         <sslContext keyStore="server-a.ks" keyStorePassword="rsaubuntu" trustStore="shared.ks" trustStorePassword="rsashared"/>
  154.     </sslContext>
  155.  
  156.  
  157.           <!--
  158.            The systemUsage controls the maximum amount of space the broker will
  159.            use before slowing down producers. For more information, see:
  160.            http://activemq.apache.org/producer-flow-control.html
  161.            If using ActiveMQ embedded - the following limits could safely be used:
  162.  
  163.        <systemUsage>
  164.            <systemUsage>
  165.                <memoryUsage>
  166.                    <memoryUsage limit="20 mb"/>
  167.                </memoryUsage>
  168.                <storeUsage>
  169.                    <storeUsage limit="1 gb"/>
  170.                </storeUsage>
  171.                <tempUsage>
  172.                    <tempUsage limit="100 mb"/>
  173.                </tempUsage>
  174.            </systemUsage>
  175.        </systemUsage>
  176.        -->
  177.           <systemUsage>
  178.             <systemUsage>
  179.                 <memoryUsage>
  180.                     <memoryUsage limit="128 mb"/>
  181.                 </memoryUsage>
  182.                 <storeUsage>
  183.                     <storeUsage limit="3 gb"/>
  184.                 </storeUsage>
  185.                 <tempUsage>
  186.                     <tempUsage limit="1 gb"/>
  187.                 </tempUsage>
  188.             </systemUsage>
  189.         </systemUsage>
  190.  
  191.         <!--
  192.            The transport connectors expose ActiveMQ over a given protocol to
  193.            clients and other brokers. For more information, see:
  194.  
  195.            http://activemq.apache.org/configuring-transports.html
  196.        -->
  197.         <transportConnectors>
  198.             <!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
  199.             <transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireformat.maxFrameSize=104857600"/>
  200.             <transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireformat.maxFrameSize=104857600"/>
  201.         <transportConnector name="ssl" uri="ssl://0.0.0.0:61617?trace=true?needClientAuth=false"/>
  202.         </transportConnectors>
  203.  
  204.         <!-- destroy the spring context on shutdown to stop jetty -->
  205.         <shutdownHooks>
  206.             <bean xmlns="http://www.springframework.org/schema/beans" class="org.apache.activemq.hooks.SpringContextHook" />
  207.         </shutdownHooks>
  208.  
  209.     </broker>
  210.  
  211.  
  212.     <!--
  213.        Enable web consoles, REST and Ajax APIs and demos
  214.  
  215.        Take a look at ${ACTIVEMQ_HOME}/conf/jetty.xml for more details
  216.    -->
  217.     <import resource="jetty.xml"/>
  218.  
  219. </beans>
  220. <!-- END SNIPPET: example -->
Advertisement
Add Comment
Please, Sign In to add comment