【问题标题】:How do I specify the JMX port for an embedded activemq instance?如何为嵌入式 activemq 实例指定 JMX 端口?
【发布时间】:2011-09-25 04:48:08
【问题描述】:

我正在创建一个嵌入式 activemq 实例,以便测试通过 JMX 创建/删除主题。 代码看起来有点像下面。 broker.connectorPort 是我尝试设置 JMX 端口,但它不起作用。

String connectString="vm://localhost?broker.persistence=false&broker.useJmx=true&broker.connectorPort=2011"

ActiveMQConnectionFactory activeMQConnectionFactory = new ActiveMQConnectionFactory();

activeMQConnectionFactory.setBrokerURL(connectString);

ActiveMQConnection activeMQConnection = (ActiveMQConnection) activeMQConnectionFactory.createConnection();
activeMQConnection.start();

使用 activemq.xml 进行配置时,以下 xml 有效。我不确定如何将其翻译为 brokerURL。

<managementContext>
        <managementContext connectorPort="2011" createConnector="true"/>
</managementContext>

【问题讨论】:

    标签: activemq broker


    【解决方案1】:

    通过手动创建代理解决..

        BrokerService broker = new BrokerService();
        broker.setUseJmx(true);
        broker.getManagementContext().setConnectorPort(9999);
        broker.start();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-11-08
      • 2021-05-30
      • 1970-01-01
      • 2013-10-24
      • 2015-10-27
      • 2017-03-03
      • 2012-04-16
      相关资源
      最近更新 更多