我正在创建一个嵌入式 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>