如何解决ActiveMQ Artemis和代理URI
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&retryInterval=1000&retryIntervalMultiplier=1.5&maxRetryInterval=60000&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"
。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。