ActiveMQ Artemis和代理URI

问题描述

我有一个Spring Framework配置文件

Symbol

但是,当我在Storm集群上运行时,出现错误消息:

includeThisOnlyOnce :: Rules ()

文档非常混乱。我不确定ActiveMQ和ActiveMQ Artemis配置是否相同或相似。我不知道如何为Apache ActiveMQ Artemis配置代理uri。

所以我的问题是我在做什么错了?

这是我的compile

Sources

解决方法

URI取决于您使用的客户端的100%。 ActiveMQ 5.x JMS客户端实现与ActiveMQ Artemis JMS客户端实现不同。实际上,它们在幕后使用了完全不同的协议(例如,对于5.x使用OpenWire,对于Artemis使用“核心”)。

从您的Spring配置中不清楚您正在使用哪个客户端。此外,由于您已经定义了 5.x和Artemis依赖项,因此pom.xml尚不清楚您正在使用哪个客户端,例如:

...
<dependency>
    <groupId>org.apache.activemq</groupId>
    <artifactId>apache-artemis</artifactId>
    <version>2.15.0</version>
    <type>pom</type>
</dependency>
...
<dependency>
    <groupId>org.apache.activemq</groupId>
    <artifactId>activemq-spring</artifactId>
    <version>${activemq-spring.version}</version>
</dependency>
<dependency>
    <groupId>org.apache.activemq</groupId>
    <artifactId>artemis-spring-integration</artifactId>
    <version>2.15.0</version>
</dependency>
...

但是,您收到的异常消息(即“无效的连接参数”)表明您正在使用ActiveMQ 5.x OpenWire JMS客户端。不幸的是,您使用的是用于ActiveMQ Artemis JMS客户端的参数(即retryIntervalMultiplier=1.5,maxRetryInterval=60000,retryInterval=1000)。

因此,您需要更改项目,以便使用ActiveMQ Artemis JMS客户端,或删除那些不适当的参数。

为清楚起见,《 ActiveMQ Artemis用户手册》中记录的客户端URL参数专门针对ActiveMQ Artemis JMS或核心客户端。您可以找到ActiveMQ 5.x客户端here的参数。

如果您想在Spring配置中使用ActiveMQ Artemis资源,则可以使用以下内容:

<bean id="jmsConnectionFactory" class="org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory">
   <property name="brokerURL" value="tcp://localhost:61616?ha=true&amp;retryInterval=1000&amp;retryIntervalMultiplier=1.5&amp;maxRetryInterval=60000&amp;maxReconnectAttempts=1000"/>
</bean>

<bean id="testRequestQueue" class="org.apache.activemq.artemis.jms.client.ActiveMQQueue">
   <constructor-arg index="0" value="test.storm.in.request.queue"/>
</bean>

之后,您可以从pom.xml中删除所有ActiveMQ 5.x依赖关系,也可以从Spring配置中删除xmlns:amq="activemq.apache.org/schema/core"

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...