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>