ACTIVEMQ——常用配置(1)

1、在配置文件中添加队列,在broker中添加如下代码

<destinations>        
     <queue physicalName="widgets" />        
     <queue physicalName="spacecontrol" />   
     <queue physicalName="displays" />    
</destinations>


2、配置用户并为一个队列配置不同的角色
<plugins>        
     <simpleAuthenticationPlugin>            
         <users>                
           <authenticationUser username="sa" password="manager" groups="producers,consumers,admins" />               
 	   <authenticationUser username="frontend" password="manager" groups="producers,consumers" />                 
           <authenticationUser username="backend" password="manager" groups="consumers" />                
     </users>        
     </simpleAuthenticationPlugin>        
     <authorizationPlugin>            
          <map>                
             <authorizationMap>                    
                 <authorizationEntries>  
                        //控制用户对队列的操作权限                      
                    <authorizationEntry queue=">" write="producers" read="consumers" admin="admins" />                      
	            </authorizationEntries>                
              </authorizationMap>           
          </map>        
     </authorizationPlugin>    
</plugins>


3、配置网页访问用户名密码
<!-- Web Console.  Auth is via JAAS.  Beware: jetty-plus-6.1.4.jar contains the         
JAAS classes, and is not included with ActiveMQ.  You need to download separately.  
Web Console queue browser will fail, as it tries to use JMS         
to browse the queue, and that requires a password.-->    
<jetty xmlns="http://mortbay.com/schemas/jetty/1.0">        
     <connectors>            
          <nioConnector port="8161" />     
     </connectors>      
     <userRealms>     
     <!-- "name" must match the realm in web.xml, and "loginModuleName" must be defined in login.conf -->  
          <jaasUserRealm name="ActiveMQ" loginModuleName="ActiveMQ"        
          callbackHandlerClass="org.mortbay.jetty.plus.jaas.callback.DefaultCallbackHandler" />   
     </userRealms>        
     <handlers>    
          <webAppContext contextPath="/admin" resourceBase="${activemq.base}/webapps/admin" logUrlOnStart="true" />  
     </handlers>    
</jetty>







    
    
    
    


   

你可能感兴趣的:(ACTIVEMQ——常用配置(1))