ActiveMQ的activemq.xml详细配置讲解

阅读更多
  1. <beans  
  2.   xmlns="http://www.springframework.org/schema/beans"  
  3.   xmlns:amq="http://activemq.org/config/1.0"  
  4.   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   
  5.   http://activemq.org/config/1.0 http://activemq.apache.org/schema/activemq-core.xsd   
  6.   http://activemq.apache.org/camel/schema/spring>  
  7.     
  8.     
  9.     
  10.     
  11.     
  12.   <broker xmlns="http://activemq.org/config/1.0" brokerName="192.168.1.148" persistent ="true" dataDirectory="${activemq.base}/data" useShutdownHook="false">  
  13.     
  14.       
  15.       
  16.     <destinationPolicy>  
  17.       <policyMap>  
  18.         <policyEntries>  
  19.          
  20.           <policyEntry topic="EUCITA.>" producerFlowControl="false" memoryLimit="10mb">  
  21.               
  22.         <dispatchPolicy>  
  23.             
  24.               <strictOrderDispatchPolicy/>  
  25.             dispatchPolicy>  
  26.           
  27.             <subscriptionRecoveryPolicy>  
  28.             
  29.               <lastImageSubscriptionRecoveryPolicy/>  
  30.             subscriptionRecoveryPolicy>  
  31.           policyEntry>  
  32.         policyEntries>  
  33.       policyMap>  
  34.     destinationPolicy>  
  35.   
  36.       
  37.     <transportConnectors>  
  38.        <transportConnector name="openwire" uri="tcp://192.168.1.148:61616" discoveryUri="multicast://default"/>  
  39.        <transportConnector name="ssl"     uri="ssl://192.168.1.148:61617"/>  
  40.        <transportConnector name="stomp"   uri="stomp://192.168.1.148:61613"/>  
  41.        <transportConnector name="xmpp"    uri="xmpp://192.168.1.148:61222"/>  
  42.     transportConnectors>  
  43.       
  44.       
  45.     <persistenceAdapter>  
  46.       <amqPersistenceAdapter directory="${activemq.base}/data"/>  
  47.     persistenceAdapter>  
  48. broker>  
  49.   
  50.     
  51.     <commandAgent xmlns="http://activemq.org/config/1.0"/>  
  52.      
  53.     
  54.   <jetty xmlns="http://mortbay.com/schemas/jetty/1.0">  
  55.     <connectors>  
  56.       <nioConnector port="8161" />  
  57.     connectors>  
  58.   
  59.     <handlers>  
  60.       <webAppContext contextPath="/admin" resourceBase="${activemq.base}/webapps/admin" logUrlOnStart="true" />        
  61.       <webAppContext contextPath="/demo" resourceBase="${activemq.base}/webapps/demo" logUrlOnStart="true" />          
  62.     handlers>  
  63.   jetty>    
  64. beans>  


















































注释

关于XML配置中元素的具体信息可以参考http://activemq.apache.org/xbean-xml-reference-50.html 下面介绍本篇配置使用的一些重要元素。

DispathPolicy

ActiveMQ支持3中不同的分发策略(避免翻译了以后误解,这里用原文):

  1. :Simple dispatch policy that sends a message to every subscription that matches the message.
  2. :Simple dispatch policy that sends a message to every subscription that matches the message.
  3. :Dispatch policy that causes every subscription to see messages in the same order.

SubscriptionRecoveryPolicy

ActiveMQ支持6种恢复策略,可以自行选择使用不同的策略

  1. : keep a fixed count of last messages.
  2. : keep a fixed amount of memory available in RAM for message history which is evicted in time order.
  3. :only keep the last message.
  4. :disable recovery of messages.
  5. :perform a user specific query mechanism to load any messages they may have missed.
  6. :keep a timed buffer of messages around in memory and use that to recover new subscriptions.
  • active文档.rar (921.4 KB)
  • 下载次数: 455

你可能感兴趣的:(ActiveMQ,XML,Spring,Apache,Servlet)