activemq artemis和代理uri

ssgvzors  于 2021-06-24  发布在  Storm
关注(0)|答案(1)|浏览(426)

我有一个spring框架配置文件

<?xml version="1.0" encoding="UTF-8"?>
<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:amq="http://activemq.apache.org/schema/core"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core-5.15.12.xsd">

    <amq:queue id="testRequestQueue" physicalName="test.storm.in.request.queue" />

    <amq:connectionFactory id="jmsConnectionFactory" brokerURL="failover:(tcp://localhost:61616)?retryInterval=1000&amp;retryIntervalMultiplier=1.5&amp;maxRetryInterval=60000&amp;maxReconnectAttempts=1000" />

</beans>

但是,当我在storm群集上运行时,我得到一个错误消息:

Caused by: java.lang.IllegalArgumentException: Invalid connect parameters: {retryIntervalMultiplier=1.5, maxRetryInterval=60000, retryInterval=1000}

文档非常混乱。我不确定activemq和activemqartemis配置是否相同或相似。我不知道如何为apacheactivemq artemis配置代理uri。
所以我的问题是我做错了什么?
这是我的 pom.xml :

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.example</groupId>
    <artifactId>itvs_pletra_imaps_test1_pagal_schema</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <maven.compiler.plugin>3.8.1</maven.compiler.plugin>
        <maven-surefire-plugin.version>3.0.0-M5</maven-surefire-plugin.version>
        <maven-war-plugin.version>3.3.1</maven-war-plugin.version>
        <javee-api.version>8.0.1</javee-api.version>
        <reactive-streams.version>1.0.3</reactive-streams.version>
        <spring-web-and-context.version>5.2.9.RELEASE</spring-web-and-context.version>
        <httpclient.version>4.5.12</httpclient.version>
        <jaxb-api.version>2.4.0-b180830.0359</jaxb-api.version>
        <hibernate-core.version>5.3.0.Final</hibernate-core.version>
        <mockito-junit-jupiter.version>3.5.10</mockito-junit-jupiter.version>
        <junit-jupiter-api.version>5.7.0</junit-jupiter-api.version>
        <junit-jupiter-params.version>5.7.0</junit-jupiter-params.version>
        <slf4j-api.version>2.0.0-alpha1</slf4j-api.version>
        <log4j-core.version>2.13.3</log4j-core.version>
        <log4j-slf4j-impl.version>2.13.3</log4j-slf4j-impl.version>
        <cxf-rt-frontend-jaxws.version>3.3.6</cxf-rt-frontend-jaxws.version>
        <cxf.version>3.4.0</cxf.version>
        <maven-assembly-plugin.version>3.3.0</maven-assembly-plugin.version>
        <maven-shade-plugin.version>3.2.4</maven-shade-plugin.version>
        <storm-core.version>2.2.0</storm-core.version>
        <storm-client.version>2.2.0</storm-client.version>
        <storm-jms.version>2.2.0</storm-jms.version>
        <activemq-spring.version>5.16.0</activemq-spring.version>
        <javax.jms-api.version>2.0.1</javax.jms-api.version>
        <artemis-spring-integration.version>2.15.0</artemis-spring-integration.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>${jaxb-api.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.storm</groupId>
            <artifactId>storm-jms-examples</artifactId>
            <version>${storm-core.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>log4j-over-slf4j</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.logging.log4j</groupId>
                    <artifactId>log4j-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>javax.jms</groupId>
            <artifactId>javax.jms-api</artifactId>
            <version>${javax.jms-api.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>apache-artemis</artifactId>
            <version>2.15.0</version>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${spring-web-and-context.version}</version>
        </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>
        <dependency>
            <groupId>org.apache.xbean</groupId>
            <artifactId>xbean-spring</artifactId>
            <version>4.18</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
            <version>${cxf-rt-frontend-jaxws.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.storm</groupId>
            <artifactId>storm-core</artifactId>
            <version>${storm-core.version}</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.logging.log4j</groupId>
                    <artifactId>log4j-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>log4j-over-slf4j</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.logging.log4j</groupId>
                    <artifactId>log4j-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.logging.log4j</groupId>
                    <artifactId>log4j-slf4j-impl</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.storm</groupId>
            <artifactId>storm-jms</artifactId>
            <version>${storm-jms.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.logging.log4j</groupId>
                    <artifactId>log4j-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>log4j-over-slf4j</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.logging.log4j</groupId>
                    <artifactId>log4j-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.logging.log4j</groupId>
                    <artifactId>log4j-slf4j-impl</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.storm</groupId>
            <artifactId>storm-client</artifactId>
            <version>${storm-client.version}</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <!-- declare the exclusion here -->
                    <groupId>org.apache.logging.log4j</groupId>
                    <artifactId>log4j-core</artifactId>
                </exclusion>
                <exclusion>
                    <!-- declare the exclusion here -->
                    <groupId>org.slf4j</groupId>
                    <artifactId>log4j-over-slf4j</artifactId>
                </exclusion>
                <exclusion>
                    <!-- declare the exclusion here -->
                    <groupId>org.apache.logging.log4j</groupId>
                    <artifactId>log4j-api</artifactId>
                </exclusion>
                <exclusion>
                    <!-- declare the exclusion here -->
                    <groupId>org.apache.logging.log4j</groupId>
                    <artifactId>log4j-slf4j-impl</artifactId>
                </exclusion>
                <exclusion>
                    <!-- declare the exclusion here -->
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.reactivestreams</groupId>
            <artifactId>reactive-streams</artifactId>
            <version>${reactive-streams.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j-api.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>${httpclient.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>${log4j-core.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j-impl</artifactId>
            <version>${log4j-slf4j-impl.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.ws</groupId>
            <artifactId>jbossws-api</artifactId>
            <version>1.1.2.Final</version>
        </dependency>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>${javee-api.version}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${hibernate-core.version}</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
            <version>${junit-jupiter-params.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>${junit-jupiter-api.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
            <version>${mockito-junit-jupiter.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>
tzxcd3kk

tzxcd3kk1#

uri完全取决于您正在使用的客户端。activemq5.xjms客户端实现与activemqartemisjms客户端实现不同。事实上,他们使用完全不同的协议(即openwire for 5.x和“core”for artemis)。
从您的spring配置中不清楚您使用的是哪个客户机。而且,你的报告也不清楚 pom.xml 既然您已经定义了5.x和artemis依赖关系,那么您正在使用哪个客户端,例如:

...
<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客户端。不幸的是,您使用的参数是针对activemqartemisjms客户机的(即。 retryIntervalMultiplier=1.5, maxRetryInterval=60000, retryInterval=1000 ).
因此,您需要更改项目以便使用activemqartemisjms客户机,或者删除那些不正确的参数。
要清楚的是,activemqartemis用户手册中记录的客户机url参数是专门针对activemqartemisjms或核心客户机的。您可以在这里找到ActiveMQ5.x客户机的参数。
如果要在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>

之后,您可以从您的应用程序中删除任何activemq5.x依赖项 pom.xml 以及 xmlns:amq="activemq.apache.org/schema/core" 从你的Spring配置。

相关问题