【问题标题】:ActiveMQ 5.15.5, Camel ActiveMQ component brokerURL to connect two standalone brokersActiveMQ 5.15.5,Camel ActiveMQ 组件 brokerURL 连接两个独立的 broker
【发布时间】:2021-07-15 03:26:27
【问题描述】:

我有两个独立的代理正在使用来自另一个系统的消息。

客户端消费者使用Camel来消费消息,下面是使用camel-activemq组件的部分配置。

我试图在 borkerURL 中提供主机信息,但抛出了一些异常。 使用罐子 弹簧芯4.2.4, 弹簧启动:1.3.1, activemq 骆驼:5.12.1, activemq-broker:5.12.1等

...

  <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
    <property name="brokerURL" value="(tcp://host1:61616,tcp://host2:61616)?wireFormat.maxInactivityDuration=500000" />
  </bean>

  <bean id="jmsPooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" init-method="start" destroy-method="stop">
    <property name="maxConnections" value="10" />
    <property name="connectionFactory" ref="jmsConnectionFactory" />
  </bean>

  <bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
    <property name="connectionFactory" ref="jmsPooledConnectionFactory" />
    <property name="concurrentConsumers" value="1" />
    <property name="maxConcurrentConsumers" value="1" />
  </bean>

  <bean id="jms" class="org.apache.activemq.camel.component.ActiveMQComponent">
    <property name="configuration" ref="jmsConfig" />
    <property name="transacted" value="true" />
  </bean>
...

当我使用上下文运行骆驼主程序时,进程抛出异常。

:PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'brokerURL' threw exception; nested exception is java.lang.IllegalArgumentException: Invalid broker URI: (tcp://host1:61616,tcp://host2:61616)?wireFormat.maxInactivityDuration=500000

有没有办法传入两个独立代理的 borker URL?

【问题讨论】:

    标签: spring apache-camel activemq spring-camel


    【解决方案1】:

    如果代理是故障转移系统的一部分,请使用 ActiveMQ 客户端的“故障转移”协议。 如果代理有不同的队列,请创建两个具有不同配置和代理 URL 的不同组件。 在你的路由中引用 jms1 或 jms2。

    【讨论】:

      猜你喜欢
      • 2011-04-09
      • 2016-11-18
      • 1970-01-01
      • 2021-12-17
      • 2014-07-17
      • 2016-06-08
      • 2012-10-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多