Apache ActiveMq

ActiveMQ “Classic” 下载地址

本文以windows版本为例子 解压apache-activemq-5.15.15-bin.zip压缩包

获得目录结构

bin 命令目录
conf 配置文件
data 数据日志文件
docs 文档说明
examples 例子:配置文件、代码
lib jar包
webapps 管理台应用
webapps-demo 管理台应用的例子

启动mq

bin\win64\activemq.bat

安装服务

bin\win64\InstallService.bat

卸载服务

bin\win64\UninstallService.bat

配置 管理后台端口8161 配置文件conf\jetty.xml

管理后台帐号密码文件 conf\jetty-realm.properties

配置文件conf\activemq.xml

可用协议,根据自己的需求注释去除

<transportConnectors>
            <transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
            <transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
            <transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
            <transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
            <transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
</transportConnectors>

权限例子 examples\conf\activemq-security.xml

<plugins>
        <simpleAuthenticationPlugin>
            <users>
                <authenticationUser username="system" password="${activemq.password}" groups="users,admins"/>
                <authenticationUser username="user" password="${guest.password}"  groups="users"/>
                <authenticationUser username="guest" password="${guest.password}" groups="guests"/>
            </users>
        </simpleAuthenticationPlugin>

      <authorizationPlugin>
        <map>
          <authorizationMap>
            <authorizationEntries>
              <authorizationEntry queue=">" read="admins" write="admins" admin="admins" />
              <authorizationEntry queue="USERS.>" read="users" write="users" admin="users" />
              <authorizationEntry queue="GUEST.>" read="guests" write="guests,users" admin="guests,users" />
              
              <authorizationEntry queue="TEST.Q" read="guests" write="guests" />
              
              <authorizationEntry topic=">" read="admins" write="admins" admin="admins" />
              <authorizationEntry topic="USERS.>" read="users" write="users" admin="users" />
              <authorizationEntry topic="GUEST.>" read="guests" write="guests,users" admin="guests,users" />
              
              <authorizationEntry topic="ActiveMQ.Advisory.>" read="guests,users" write="guests,users" admin="guests,users"/>
            </authorizationEntries>
          </authorizationMap>
        </map>
      </authorizationPlugin>
    </plugins>

authenticationUser 配置 用户 密码 用户组  密码可以设置到配置文件 conf\credentials.properties

authorizationEntry 配置权限