You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by th...@printus.de on 2021/02/11 16:36:12 UTC

Bridging Artemis with Live/Backup Configuration

Hi,

has someone already used bridging with Live / Backup groups of Artemis? If so, what is the configuration like?

I am using Artemis version 2.16.0 and tested both options (JMS Bridge, Camel). In both cases I got an error message when starting the backup server, probably because Camel cannot establish a connection to the (passive) Artemis endpoint.

Is there a way to integrate bridging into the lifecycle of the server in such a way that the connection is only established when the backup server becomes live server, as is the case with addresses and queues:
...
2021-02-09 19:49:06,056 INFO  [org.apache.activemq.artemis.core.server] AMQ221071: Failing over based on quorum vote results.
2021-02-09 19:49:06,124 INFO  [org.apache.activemq.artemis.core.server] AMQ221037: ActiveMQServerImpl::serverUUID=05bd0a29-6b07-11eb-bad0-0242ac120002 to become 'live'
2021-02-11 13:54:51,516 INFO  [org.apache.activemq.artemis.core.server] AMQ221080: Deploying address TARGET.Q supporting [ANYCAST]
2021-02-11 13:54:51,516 INFO  [org.apache.activemq.artemis.core.server] AMQ221003: Deploying ANYCAST queue TARGET.Q on address TARGET.Q
2021-02-11 13:54:51,733 INFO  [org.apache.activemq.artemis.core.server] AMQ221007: Server is now live



Error message when using JMS Bridge implementation:
2021-02-09 19:47:20,260 INFO  [org.springframework.web.context.ContextLoader] Root WebApplicationContext: initialization started
2021-02-09 19:47:20,491 INFO  [org.apache.activemq.artemis.core.server] AMQ221024: Backup server ActiveMQServerImpl::serverUUID=05bd0a29-6b07-11eb-bad0-0242ac120002 is synchronized with live-server.
2021-02-09 19:47:20,557 INFO  [org.apache.activemq.artemis.core.server] AMQ221031: backup announced
2021-02-09 19:47:21,038 WARN  [org.apache.activemq.artemis.jms.bridge] AMQ342010: Failed to connect JMS Bridge artemis-jms-bridge-retoure: javax.jms.JMSException: Failed to create session factory
        at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:886) [artemis-jms-client-2.16.0.jar:2.16.0]
        at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:299) [artemis-jms-client-2.16.0.jar:2.16.0]
        at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:294) [artemis-jms-client-2.16.0.jar:2.16.0]
        at org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl.createConnection(JMSBridgeImpl.java:1108) [artemis-jms-server-2.16.0.jar:2.16.0]
        at org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl.setupJMSObjects(JMSBridgeImpl.java:1233) [artemis-jms-server-2.16.0.jar:2.16.0]
        at org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl.start(JMSBridgeImpl.java:404) [artemis-jms-server-2.16.0.jar:2.16.0]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [java.base:]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [java.base:]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [java.base:]
        at java.base/java.lang.reflect.Method.invoke(Method.java:566) [java.base:]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1903) [spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1846) [spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1774) [spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) [spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) [spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) [spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) [spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) [spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) [spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:849) [spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) [spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) [spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
        at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:401) [spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:292) [spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:103) [spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
        at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:933)
        at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:553)
        at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:892)
        at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:356)
        at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1445)
        at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1409)
        at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:825)
        at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:275)
        at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:524)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:117)
        at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
        at org.eclipse.jetty.server.Server.start(Server.java:407)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
        at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
        at org.eclipse.jetty.server.Server.doStart(Server.java:371)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
        at org.apache.activemq.artemis.component.WebServerComponent.start(WebServerComponent.java:263) [artemis-web-2.16.0.jar:2.16.0]
        at org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.addExternalComponent(ActiveMQServerImpl.java:908) [artemis-server-2.16.0.jar:2.16.0]
        at org.apache.activemq.artemis.cli.commands.Run.execute(Run.java:126) [artemis-cli-2.16.0.jar:2.16.0]
        at org.apache.activemq.artemis.cli.Artemis.internalExecute(Artemis.java:153) [artemis-cli-2.16.0.jar:2.16.0]
        at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:101) [artemis-cli-2.16.0.jar:2.16.0]
       at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:128) [artemis-cli-2.16.0.jar:2.16.0]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [java.base:]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [java.base:]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [java.base:]
        at java.base/java.lang.reflect.Method.invoke(Method.java:566) [java.base:]
        at org.apache.activemq.artemis.boot.Artemis.execute(Artemis.java:134) [artemis-boot.jar:2.16.0]
        at org.apache.activemq.artemis.boot.Artemis.main(Artemis.java:50) [artemis-boot.jar:2.16.0]
Caused by: ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ219007: Cannot connect to server(s). Tried with all available servers.]
        at org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:703) [artemis-core-client-2.16.0.jar:2.16.0]
        at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:884) [artemis-jms-client-2.16.0.jar:2.16.0]
        ... 56 more
2021-02-09 19:47:21,051 WARN  [org.apache.activemq.artemis.jms.bridge] AMQ342001: Failed to start JMS Bridge artemis-jms-bridge-retoure
2021-02-09 19:47:21,054 WARN  [org.apache.activemq.artemis.jms.bridge] AMQ342004: JMS Bridge artemis-jms-bridge-retoure, will retry after a pause of 50,000 ms


Error message when using Camel:
2021-02-11 13:53:55,710 INFO  [org.apache.camel.spring.SpringCamelContext] Apache Camel 2.25.0 (CamelContext: bridgeContext) is starting
2021-02-11 13:53:55,712 INFO  [org.apache.camel.management.ManagedManagementStrategy] JMX is enabled
2021-02-11 13:53:55,833 INFO  [org.apache.camel.impl.converter.DefaultTypeConverter] Type converters loaded (core: 195, classpath: 1)
2021-02-11 13:53:56,582 INFO  [org.apache.camel.spring.SpringCamelContext] Route: artemis-jms-bridge-retoure started and consuming from: jms://queue://SOURCE.Q?asyncConsumer=true&concurrentConsumers=8&connectionFactory=%23wmqConnectionFactoryWrapper&disableReplyTo=true&mapJmsMessage=false&maxConcurrentConsumers=16
2021-02-11 13:53:56,594 INFO  [org.apache.camel.spring.SpringCamelContext] Total 1 routes, of which 1 are started
2021-02-11 13:53:56,614 INFO  [org.apache.camel.spring.SpringCamelContext] Apache Camel 2.25.0 (CamelContext: bridgeContext) started in 0.885 seconds
2021-02-11 13:53:56,630 INFO  [org.springframework.web.context.ContextLoader] Root WebApplicationContext initialized in 2985 ms
2021-02-11 13:53:56,627 ERROR [org.apache.camel.component.jms.DefaultJmsMessageListenerContainer] Could not refresh JMS Connection for destination 'TARGET.Q' - retrying using FixedBackOff{interval=5000, currentAttempts=0, maxAttempts=unlimited}. Cause: Failed to create session factory; nested exception is ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ219007: Cannot connect to server(s). Tried with all available servers.]
2021-02-11 13:53:56,673 INFO  [org.apache.activemq.artemis] AMQ241001: HTTP Server started at http://0.0.0.0:8161
2021-02-11 13:53:56,674 INFO  [org.apache.activemq.artemis] AMQ241002: Artemis Jolokia REST API available at http://0.0.0.0:8161/console/jolokia
2021-02-11 13:53:56,674 INFO  [org.apache.activemq.artemis] AMQ241004: Artemis Console available at http://0.0.0.0:8161/console



JMS Bridge Configuration:
<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
       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.xsd">

    <bean id="wmqConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
      <property name="transportType" value="1"/>
      <property name="hostName" value="XXXX"/>
      <property name="port" value="1414"/>
      <property name="queueManager" value="XXXX"/>
      <property name="channel" value="XXXX"/>
      <property name="targetClientMatching" value="true"/>
   </bean>

   <bean id="wmqConnectionFactoryWrapper"  class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
        <property name="targetConnectionFactory" ref="wmqConnectionFactory" />
        <property name="username" value="XXXX" />
        <property name="password" value="XXXX" />
   </bean>

   <bean id="wmqConnectionFactoryFactory" class="org.artemis.bridge.ConnectionFactoryFactoryBean">
      <constructor-arg ref="wmqConnectionFactory"/>
   </bean>

   <bean id="amqConnectionFactory" class="org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory">
    <constructor-arg name="url" value="vm://1"/>
    <constructor-arg name="user" value="XXXX"/>
    <constructor-arg name="password" value="XXXX"/>
   </bean>

   <bean id="amqConnectionFactoryFactory" class="org.artemis.bridge.ConnectionFactoryFactoryBean">
      <constructor-arg ref="amqConnectionFactory"/>
   </bean>

   <bean id="wmqDestinationFactoryRetoure" class="org.artemis.bridge.DestinationFactoryBean">
      <constructor-arg ref="wmqDestinationRetoure"/>
   </bean>

   <bean id="amqDestinationFactoryRetoure" class="org.artemis.bridge.DestinationFactoryBean">
      <constructor-arg ref="amqDestinationRetoure"/>
   </bean>

   <bean id="wmqDestinationRetoure" class="com.ibm.mq.jms.MQQueue">
      <constructor-arg value="TARGET.Q"/>
   </bean>

   <bean id="amqDestinationRetoure" class="org.apache.activemq.artemis.jms.client.ActiveMQQueue">
      <constructor-arg value="SOURCE.Q"/>
   </bean>

   <bean id="artemis-jms-bridge-retoure" class="org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl" init-method="start" destroy-method="stop">
      <property name="bridgeName" value="artemis-jms-bridge-retoure"/>
      <property name="sourceConnectionFactoryFactory" ref="amqConnectionFactoryFactory"/>
      <property name="targetConnectionFactoryFactory" ref="wmqConnectionFactoryFactory"/>
      <property name="sourceDestinationFactory" ref="amqDestinationFactoryRetoure"/>
      <property name="targetDestinationFactory" ref="wmqDestinationFactoryRetoure"/>
      <property name="qualityOfServiceMode" value="DUPLICATES_OK"/>
      <property name="failureRetryInterval" value="50000"/>
      <property name="failoverTimeout" value="5000"/>
      <property name="maxRetries" value="-1"/>
      <property name="maxBatchSize" value="1"/>
      <property name="maxBatchTime" value="-1"/>
   </bean>
</beans>


Camel Configuration:
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:camel="http://camel.apache.org/schema/spring"
       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.xsd
                           http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">

  <bean id="amqConnectionFactory" class="org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory">
    <constructor-arg name="url" value="vm://1"/>
    <constructor-arg name="user" value="XXXX"/>
    <constructor-arg name="password" value="XXXX"/>
  </bean>

  <bean id="wmqConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
    <property name="transportType" value="1"/>
    <property name="hostName" value="XXXX"/>
    <property name="port" value="1414"/>
    <property name="queueManager" value="XXXX"/>
    <property name="channel" value="XXXX"/>
    <property name="targetClientMatching" value="true"/>
  </bean>

  <bean id="wmqConnectionFactoryWrapper"  class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
        <property name="targetConnectionFactory" ref="wmqConnectionFactory" />
        <property name="username" value="XXXX" />
        <property name="password" value="XXXX" />
  </bean>

  <camelContext id="bridgeContext" trace="false" xmlns="http://camel.apache.org/schema/spring">
                <route id="artemis-jms-bridge-retoure">
      <from uri="jms:queue://SOURCE.Q?connectionFactory=#wmqConnectionFactoryWrapper&amp;disableReplyTo=true&amp;concurrentConsumers=8&amp;asyncConsumer=true&amp;maxConcurrentConsumers=16&amp;mapJmsMessage=false"/>
      <to uri="jms:queue://TARGET.Q?connectionFactory=#amqConnectionFactory&amp;exchangePattern=InOnly&amp;forceSendOriginalMessage=true"/>
    </route>
  </camelContext>
</beans>


Thanks,
Thomas


Re: Bridging Artemis with Live/Backup Configuration

Posted by Justin Bertram <jb...@apache.org>.
I don't know of any way to *automatically* tie a web application's
life-cycle to that of the broker. This should be possible manually, though.
You could create your own "middle-man" bean of sorts that registers itself
with the broker using a
org.apache.activemq.artemis.core.server.ActivateCallback and then your
callback implementation could manage the bridge. Otherwise you should
consider running the bridge as a process separate from the broker.


Justin

On Thu, Feb 11, 2021 at 10:36 AM <th...@printus.de> wrote:

> Hi,
>
> has someone already used bridging with Live / Backup groups of Artemis? If
> so, what is the configuration like?
>
> I am using Artemis version 2.16.0 and tested both options (JMS Bridge,
> Camel). In both cases I got an error message when starting the backup
> server, probably because Camel cannot establish a connection to the
> (passive) Artemis endpoint.
>
> Is there a way to integrate bridging into the lifecycle of the server in
> such a way that the connection is only established when the backup server
> becomes live server, as is the case with addresses and queues:
> ...
> 2021-02-09 19:49:06,056 INFO  [org.apache.activemq.artemis.core.server]
> AMQ221071: Failing over based on quorum vote results.
> 2021-02-09 19:49:06,124 INFO  [org.apache.activemq.artemis.core.server]
> AMQ221037:
> ActiveMQServerImpl::serverUUID=05bd0a29-6b07-11eb-bad0-0242ac120002 to
> become 'live'
> 2021-02-11 13:54:51,516 INFO  [org.apache.activemq.artemis.core.server]
> AMQ221080: Deploying address TARGET.Q supporting [ANYCAST]
> 2021-02-11 13:54:51,516 INFO  [org.apache.activemq.artemis.core.server]
> AMQ221003: Deploying ANYCAST queue TARGET.Q on address TARGET.Q
> 2021-02-11 13:54:51,733 INFO  [org.apache.activemq.artemis.core.server]
> AMQ221007: Server is now live
>
>
>
> Error message when using JMS Bridge implementation:
> 2021-02-09 19:47:20,260 INFO
> [org.springframework.web.context.ContextLoader] Root WebApplicationContext:
> initialization started
> 2021-02-09 19:47:20,491 INFO  [org.apache.activemq.artemis.core.server]
> AMQ221024: Backup server
> ActiveMQServerImpl::serverUUID=05bd0a29-6b07-11eb-bad0-0242ac120002 is
> synchronized with live-server.
> 2021-02-09 19:47:20,557 INFO  [org.apache.activemq.artemis.core.server]
> AMQ221031: backup announced
> 2021-02-09 19:47:21,038 WARN  [org.apache.activemq.artemis.jms.bridge]
> AMQ342010: Failed to connect JMS Bridge artemis-jms-bridge-retoure:
> javax.jms.JMSException: Failed to create session factory
>         at
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:886)
> [artemis-jms-client-2.16.0.jar:2.16.0]
>         at
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:299)
> [artemis-jms-client-2.16.0.jar:2.16.0]
>         at
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:294)
> [artemis-jms-client-2.16.0.jar:2.16.0]
>         at
> org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl.createConnection(JMSBridgeImpl.java:1108)
> [artemis-jms-server-2.16.0.jar:2.16.0]
>         at
> org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl.setupJMSObjects(JMSBridgeImpl.java:1233)
> [artemis-jms-server-2.16.0.jar:2.16.0]
>         at
> org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl.start(JMSBridgeImpl.java:404)
> [artemis-jms-server-2.16.0.jar:2.16.0]
>         at
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method) [java.base:]
>         at
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> [java.base:]
>         at
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> [java.base:]
>         at java.base/java.lang.reflect.Method.invoke(Method.java:566)
> [java.base:]
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1903)
> [spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1846)
> [spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1774)
> [spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
> [spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
> [spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
>         at
> org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
> [spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
>         at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
> [spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
>         at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
> [spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
>         at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
> [spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
>         at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:849)
> [spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
>         at
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877)
> [spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
>         at
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
> [spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
>         at
> org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:401)
> [spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
>         at
> org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:292)
> [spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
>         at
> org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:103)
> [spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
>         at
> org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:933)
>         at
> org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:553)
>         at
> org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:892)
>         at
> org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:356)
>         at
> org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1445)
>         at
> org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1409)
>         at
> org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:825)
>         at
> org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:275)
>         at
> org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:524)
>         at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
>         at
> org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
>         at
> org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:117)
>         at
> org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
>         at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
>         at
> org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
>         at org.eclipse.jetty.server.Server.start(Server.java:407)
>         at
> org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
>         at
> org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
>         at org.eclipse.jetty.server.Server.doStart(Server.java:371)
>         at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
>         at
> org.apache.activemq.artemis.component.WebServerComponent.start(WebServerComponent.java:263)
> [artemis-web-2.16.0.jar:2.16.0]
>         at
> org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.addExternalComponent(ActiveMQServerImpl.java:908)
> [artemis-server-2.16.0.jar:2.16.0]
>         at
> org.apache.activemq.artemis.cli.commands.Run.execute(Run.java:126)
> [artemis-cli-2.16.0.jar:2.16.0]
>         at
> org.apache.activemq.artemis.cli.Artemis.internalExecute(Artemis.java:153)
> [artemis-cli-2.16.0.jar:2.16.0]
>         at
> org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:101)
> [artemis-cli-2.16.0.jar:2.16.0]
>        at
> org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:128)
> [artemis-cli-2.16.0.jar:2.16.0]
>         at
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method) [java.base:]
>         at
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> [java.base:]
>         at
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> [java.base:]
>         at java.base/java.lang.reflect.Method.invoke(Method.java:566)
> [java.base:]
>         at
> org.apache.activemq.artemis.boot.Artemis.execute(Artemis.java:134)
> [artemis-boot.jar:2.16.0]
>         at org.apache.activemq.artemis.boot.Artemis.main(Artemis.java:50)
> [artemis-boot.jar:2.16.0]
> Caused by: ActiveMQNotConnectedException[errorType=NOT_CONNECTED
> message=AMQ219007: Cannot connect to server(s). Tried with all available
> servers.]
>         at
> org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:703)
> [artemis-core-client-2.16.0.jar:2.16.0]
>         at
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:884)
> [artemis-jms-client-2.16.0.jar:2.16.0]
>         ... 56 more
> 2021-02-09 19:47:21,051 WARN  [org.apache.activemq.artemis.jms.bridge]
> AMQ342001: Failed to start JMS Bridge artemis-jms-bridge-retoure
> 2021-02-09 19:47:21,054 WARN  [org.apache.activemq.artemis.jms.bridge]
> AMQ342004: JMS Bridge artemis-jms-bridge-retoure, will retry after a pause
> of 50,000 ms
>
>
> Error message when using Camel:
> 2021-02-11 13:53:55,710 INFO  [org.apache.camel.spring.SpringCamelContext]
> Apache Camel 2.25.0 (CamelContext: bridgeContext) is starting
> 2021-02-11 13:53:55,712 INFO
> [org.apache.camel.management.ManagedManagementStrategy] JMX is enabled
> 2021-02-11 13:53:55,833 INFO
> [org.apache.camel.impl.converter.DefaultTypeConverter] Type converters
> loaded (core: 195, classpath: 1)
> 2021-02-11 13:53:56,582 INFO  [org.apache.camel.spring.SpringCamelContext]
> Route: artemis-jms-bridge-retoure started and consuming from:
> jms://queue://SOURCE.Q?asyncConsumer=true&concurrentConsumers=8&connectionFactory=%23wmqConnectionFactoryWrapper&disableReplyTo=true&mapJmsMessage=false&maxConcurrentConsumers=16
> 2021-02-11 13:53:56,594 INFO  [org.apache.camel.spring.SpringCamelContext]
> Total 1 routes, of which 1 are started
> 2021-02-11 13:53:56,614 INFO  [org.apache.camel.spring.SpringCamelContext]
> Apache Camel 2.25.0 (CamelContext: bridgeContext) started in 0.885 seconds
> 2021-02-11 13:53:56,630 INFO
> [org.springframework.web.context.ContextLoader] Root WebApplicationContext
> initialized in 2985 ms
> 2021-02-11 13:53:56,627 ERROR
> [org.apache.camel.component.jms.DefaultJmsMessageListenerContainer] Could
> not refresh JMS Connection for destination 'TARGET.Q' - retrying using
> FixedBackOff{interval=5000, currentAttempts=0, maxAttempts=unlimited}.
> Cause: Failed to create session factory; nested exception is
> ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ219007:
> Cannot connect to server(s). Tried with all available servers.]
> 2021-02-11 13:53:56,673 INFO  [org.apache.activemq.artemis] AMQ241001:
> HTTP Server started at http://0.0.0.0:8161
> 2021-02-11 13:53:56,674 INFO  [org.apache.activemq.artemis] AMQ241002:
> Artemis Jolokia REST API available at http://0.0.0.0:8161/console/jolokia
> 2021-02-11 <http://0.0.0.0:8161/console/jolokia2021-02-11> 13:53:56,674
> INFO  [org.apache.activemq.artemis] AMQ241004: Artemis Console available at
> http://0.0.0.0:8161/console
>
>
>
> JMS Bridge Configuration:
> <?xml version="1.0" encoding="UTF-8"?>
>
> <beans xmlns="http://www.springframework.org/schema/beans"
>        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.xsd">
>
>     <bean id="wmqConnectionFactory"
> class="com.ibm.mq.jms.MQQueueConnectionFactory">
>       <property name="transportType" value="1"/>
>       <property name="hostName" value="XXXX"/>
>       <property name="port" value="1414"/>
>       <property name="queueManager" value="XXXX"/>
>       <property name="channel" value="XXXX"/>
>       <property name="targetClientMatching" value="true"/>
>    </bean>
>
>    <bean id="wmqConnectionFactoryWrapper"
> class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
>         <property name="targetConnectionFactory"
> ref="wmqConnectionFactory" />
>         <property name="username" value="XXXX" />
>         <property name="password" value="XXXX" />
>    </bean>
>
>    <bean id="wmqConnectionFactoryFactory"
> class="org.artemis.bridge.ConnectionFactoryFactoryBean">
>       <constructor-arg ref="wmqConnectionFactory"/>
>    </bean>
>
>    <bean id="amqConnectionFactory"
> class="org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory">
>     <constructor-arg name="url" value="vm://1"/>
>     <constructor-arg name="user" value="XXXX"/>
>     <constructor-arg name="password" value="XXXX"/>
>    </bean>
>
>    <bean id="amqConnectionFactoryFactory"
> class="org.artemis.bridge.ConnectionFactoryFactoryBean">
>       <constructor-arg ref="amqConnectionFactory"/>
>    </bean>
>
>    <bean id="wmqDestinationFactoryRetoure"
> class="org.artemis.bridge.DestinationFactoryBean">
>       <constructor-arg ref="wmqDestinationRetoure"/>
>    </bean>
>
>    <bean id="amqDestinationFactoryRetoure"
> class="org.artemis.bridge.DestinationFactoryBean">
>       <constructor-arg ref="amqDestinationRetoure"/>
>    </bean>
>
>    <bean id="wmqDestinationRetoure" class="com.ibm.mq.jms.MQQueue">
>       <constructor-arg value="TARGET.Q"/>
>    </bean>
>
>    <bean id="amqDestinationRetoure"
> class="org.apache.activemq.artemis.jms.client.ActiveMQQueue">
>       <constructor-arg value="SOURCE.Q"/>
>    </bean>
>
>    <bean id="artemis-jms-bridge-retoure"
> class="org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl"
> init-method="start" destroy-method="stop">
>       <property name="bridgeName" value="artemis-jms-bridge-retoure"/>
>       <property name="sourceConnectionFactoryFactory"
> ref="amqConnectionFactoryFactory"/>
>       <property name="targetConnectionFactoryFactory"
> ref="wmqConnectionFactoryFactory"/>
>       <property name="sourceDestinationFactory"
> ref="amqDestinationFactoryRetoure"/>
>       <property name="targetDestinationFactory"
> ref="wmqDestinationFactoryRetoure"/>
>       <property name="qualityOfServiceMode" value="DUPLICATES_OK"/>
>       <property name="failureRetryInterval" value="50000"/>
>       <property name="failoverTimeout" value="5000"/>
>       <property name="maxRetries" value="-1"/>
>       <property name="maxBatchSize" value="1"/>
>       <property name="maxBatchTime" value="-1"/>
>    </bean>
> </beans>
>
>
> Camel Configuration:
> <beans xmlns="http://www.springframework.org/schema/beans"
>        xmlns:camel="http://camel.apache.org/schema/spring"
>        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.xsd
>                            http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd">
>
>   <bean id="amqConnectionFactory"
> class="org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory">
>     <constructor-arg name="url" value="vm://1"/>
>     <constructor-arg name="user" value="XXXX"/>
>     <constructor-arg name="password" value="XXXX"/>
>   </bean>
>
>   <bean id="wmqConnectionFactory"
> class="com.ibm.mq.jms.MQQueueConnectionFactory">
>     <property name="transportType" value="1"/>
>     <property name="hostName" value="XXXX"/>
>     <property name="port" value="1414"/>
>     <property name="queueManager" value="XXXX"/>
>     <property name="channel" value="XXXX"/>
>     <property name="targetClientMatching" value="true"/>
>   </bean>
>
>   <bean id="wmqConnectionFactoryWrapper"
> class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
>         <property name="targetConnectionFactory"
> ref="wmqConnectionFactory" />
>         <property name="username" value="XXXX" />
>         <property name="password" value="XXXX" />
>   </bean>
>
>   <camelContext id="bridgeContext" trace="false" xmlns="
> http://camel.apache.org/schema/spring">
>                 <route id="artemis-jms-bridge-retoure">
>       <from
> uri="jms:queue://SOURCE.Q?connectionFactory=#wmqConnectionFactoryWrapper&amp;disableReplyTo=true&amp;concurrentConsumers=8&amp;asyncConsumer=true&amp;maxConcurrentConsumers=16&amp;mapJmsMessage=false"/>
>       <to
> uri="jms:queue://TARGET.Q?connectionFactory=#amqConnectionFactory&amp;exchangePattern=InOnly&amp;forceSendOriginalMessage=true"/>
>     </route>
>   </camelContext>
> </beans>
>
>
> Thanks,
> Thomas
>
>

Re: Bridging Artemis with Live/Backup Configuration

Posted by Clebert Suconic <cl...@gmail.com>.
There's another option now with Broker Connection as well.


On Thu, Feb 11, 2021 at 11:36 AM <th...@printus.de> wrote:
>
> Hi,
>
> has someone already used bridging with Live / Backup groups of Artemis? If so, what is the configuration like?
>
> I am using Artemis version 2.16.0 and tested both options (JMS Bridge, Camel). In both cases I got an error message when starting the backup server, probably because Camel cannot establish a connection to the (passive) Artemis endpoint.
>
> Is there a way to integrate bridging into the lifecycle of the server in such a way that the connection is only established when the backup server becomes live server, as is the case with addresses and queues:
> ...
> 2021-02-09 19:49:06,056 INFO  [org.apache.activemq.artemis.core.server] AMQ221071: Failing over based on quorum vote results.
> 2021-02-09 19:49:06,124 INFO  [org.apache.activemq.artemis.core.server] AMQ221037: ActiveMQServerImpl::serverUUID=05bd0a29-6b07-11eb-bad0-0242ac120002 to become 'live'
> 2021-02-11 13:54:51,516 INFO  [org.apache.activemq.artemis.core.server] AMQ221080: Deploying address TARGET.Q supporting [ANYCAST]
> 2021-02-11 13:54:51,516 INFO  [org.apache.activemq.artemis.core.server] AMQ221003: Deploying ANYCAST queue TARGET.Q on address TARGET.Q
> 2021-02-11 13:54:51,733 INFO  [org.apache.activemq.artemis.core.server] AMQ221007: Server is now live
>
>
>
> Error message when using JMS Bridge implementation:
> 2021-02-09 19:47:20,260 INFO  [org.springframework.web.context.ContextLoader] Root WebApplicationContext: initialization started
> 2021-02-09 19:47:20,491 INFO  [org.apache.activemq.artemis.core.server] AMQ221024: Backup server ActiveMQServerImpl::serverUUID=05bd0a29-6b07-11eb-bad0-0242ac120002 is synchronized with live-server.
> 2021-02-09 19:47:20,557 INFO  [org.apache.activemq.artemis.core.server] AMQ221031: backup announced
> 2021-02-09 19:47:21,038 WARN  [org.apache.activemq.artemis.jms.bridge] AMQ342010: Failed to connect JMS Bridge artemis-jms-bridge-retoure: javax.jms.JMSException: Failed to create session factory
>         at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:886) [artemis-jms-client-2.16.0.jar:2.16.0]
>         at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:299) [artemis-jms-client-2.16.0.jar:2.16.0]
>         at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:294) [artemis-jms-client-2.16.0.jar:2.16.0]
>         at org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl.createConnection(JMSBridgeImpl.java:1108) [artemis-jms-server-2.16.0.jar:2.16.0]
>         at org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl.setupJMSObjects(JMSBridgeImpl.java:1233) [artemis-jms-server-2.16.0.jar:2.16.0]
>         at org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl.start(JMSBridgeImpl.java:404) [artemis-jms-server-2.16.0.jar:2.16.0]
>         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [java.base:]
>         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [java.base:]
>         at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [java.base:]
>         at java.base/java.lang.reflect.Method.invoke(Method.java:566) [java.base:]
>         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1903) [spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
>         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1846) [spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
>         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1774) [spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
>         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) [spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
>         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) [spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
>         at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) [spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
>         at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) [spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
>         at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) [spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
>         at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) [spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
>         at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:849) [spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
>         at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) [spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
>         at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) [spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
>         at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:401) [spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
>         at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:292) [spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
>         at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:103) [spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
>         at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:933)
>         at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:553)
>         at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:892)
>         at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:356)
>         at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1445)
>         at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1409)
>         at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:825)
>         at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:275)
>         at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:524)
>         at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
>         at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
>         at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:117)
>         at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
>         at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
>         at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
>         at org.eclipse.jetty.server.Server.start(Server.java:407)
>         at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
>         at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
>         at org.eclipse.jetty.server.Server.doStart(Server.java:371)
>         at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
>         at org.apache.activemq.artemis.component.WebServerComponent.start(WebServerComponent.java:263) [artemis-web-2.16.0.jar:2.16.0]
>         at org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.addExternalComponent(ActiveMQServerImpl.java:908) [artemis-server-2.16.0.jar:2.16.0]
>         at org.apache.activemq.artemis.cli.commands.Run.execute(Run.java:126) [artemis-cli-2.16.0.jar:2.16.0]
>         at org.apache.activemq.artemis.cli.Artemis.internalExecute(Artemis.java:153) [artemis-cli-2.16.0.jar:2.16.0]
>         at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:101) [artemis-cli-2.16.0.jar:2.16.0]
>        at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:128) [artemis-cli-2.16.0.jar:2.16.0]
>         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [java.base:]
>         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [java.base:]
>         at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [java.base:]
>         at java.base/java.lang.reflect.Method.invoke(Method.java:566) [java.base:]
>         at org.apache.activemq.artemis.boot.Artemis.execute(Artemis.java:134) [artemis-boot.jar:2.16.0]
>         at org.apache.activemq.artemis.boot.Artemis.main(Artemis.java:50) [artemis-boot.jar:2.16.0]
> Caused by: ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ219007: Cannot connect to server(s). Tried with all available servers.]
>         at org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:703) [artemis-core-client-2.16.0.jar:2.16.0]
>         at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:884) [artemis-jms-client-2.16.0.jar:2.16.0]
>         ... 56 more
> 2021-02-09 19:47:21,051 WARN  [org.apache.activemq.artemis.jms.bridge] AMQ342001: Failed to start JMS Bridge artemis-jms-bridge-retoure
> 2021-02-09 19:47:21,054 WARN  [org.apache.activemq.artemis.jms.bridge] AMQ342004: JMS Bridge artemis-jms-bridge-retoure, will retry after a pause of 50,000 ms
>
>
> Error message when using Camel:
> 2021-02-11 13:53:55,710 INFO  [org.apache.camel.spring.SpringCamelContext] Apache Camel 2.25.0 (CamelContext: bridgeContext) is starting
> 2021-02-11 13:53:55,712 INFO  [org.apache.camel.management.ManagedManagementStrategy] JMX is enabled
> 2021-02-11 13:53:55,833 INFO  [org.apache.camel.impl.converter.DefaultTypeConverter] Type converters loaded (core: 195, classpath: 1)
> 2021-02-11 13:53:56,582 INFO  [org.apache.camel.spring.SpringCamelContext] Route: artemis-jms-bridge-retoure started and consuming from: jms://queue://SOURCE.Q?asyncConsumer=true&concurrentConsumers=8&connectionFactory=%23wmqConnectionFactoryWrapper&disableReplyTo=true&mapJmsMessage=false&maxConcurrentConsumers=16
> 2021-02-11 13:53:56,594 INFO  [org.apache.camel.spring.SpringCamelContext] Total 1 routes, of which 1 are started
> 2021-02-11 13:53:56,614 INFO  [org.apache.camel.spring.SpringCamelContext] Apache Camel 2.25.0 (CamelContext: bridgeContext) started in 0.885 seconds
> 2021-02-11 13:53:56,630 INFO  [org.springframework.web.context.ContextLoader] Root WebApplicationContext initialized in 2985 ms
> 2021-02-11 13:53:56,627 ERROR [org.apache.camel.component.jms.DefaultJmsMessageListenerContainer] Could not refresh JMS Connection for destination 'TARGET.Q' - retrying using FixedBackOff{interval=5000, currentAttempts=0, maxAttempts=unlimited}. Cause: Failed to create session factory; nested exception is ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ219007: Cannot connect to server(s). Tried with all available servers.]
> 2021-02-11 13:53:56,673 INFO  [org.apache.activemq.artemis] AMQ241001: HTTP Server started at http://0.0.0.0:8161
> 2021-02-11 13:53:56,674 INFO  [org.apache.activemq.artemis] AMQ241002: Artemis Jolokia REST API available at http://0.0.0.0:8161/console/jolokia
> 2021-02-11 13:53:56,674 INFO  [org.apache.activemq.artemis] AMQ241004: Artemis Console available at http://0.0.0.0:8161/console
>
>
>
> JMS Bridge Configuration:
> <?xml version="1.0" encoding="UTF-8"?>
>
> <beans xmlns="http://www.springframework.org/schema/beans"
>        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.xsd">
>
>     <bean id="wmqConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
>       <property name="transportType" value="1"/>
>       <property name="hostName" value="XXXX"/>
>       <property name="port" value="1414"/>
>       <property name="queueManager" value="XXXX"/>
>       <property name="channel" value="XXXX"/>
>       <property name="targetClientMatching" value="true"/>
>    </bean>
>
>    <bean id="wmqConnectionFactoryWrapper"  class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
>         <property name="targetConnectionFactory" ref="wmqConnectionFactory" />
>         <property name="username" value="XXXX" />
>         <property name="password" value="XXXX" />
>    </bean>
>
>    <bean id="wmqConnectionFactoryFactory" class="org.artemis.bridge.ConnectionFactoryFactoryBean">
>       <constructor-arg ref="wmqConnectionFactory"/>
>    </bean>
>
>    <bean id="amqConnectionFactory" class="org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory">
>     <constructor-arg name="url" value="vm://1"/>
>     <constructor-arg name="user" value="XXXX"/>
>     <constructor-arg name="password" value="XXXX"/>
>    </bean>
>
>    <bean id="amqConnectionFactoryFactory" class="org.artemis.bridge.ConnectionFactoryFactoryBean">
>       <constructor-arg ref="amqConnectionFactory"/>
>    </bean>
>
>    <bean id="wmqDestinationFactoryRetoure" class="org.artemis.bridge.DestinationFactoryBean">
>       <constructor-arg ref="wmqDestinationRetoure"/>
>    </bean>
>
>    <bean id="amqDestinationFactoryRetoure" class="org.artemis.bridge.DestinationFactoryBean">
>       <constructor-arg ref="amqDestinationRetoure"/>
>    </bean>
>
>    <bean id="wmqDestinationRetoure" class="com.ibm.mq.jms.MQQueue">
>       <constructor-arg value="TARGET.Q"/>
>    </bean>
>
>    <bean id="amqDestinationRetoure" class="org.apache.activemq.artemis.jms.client.ActiveMQQueue">
>       <constructor-arg value="SOURCE.Q"/>
>    </bean>
>
>    <bean id="artemis-jms-bridge-retoure" class="org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl" init-method="start" destroy-method="stop">
>       <property name="bridgeName" value="artemis-jms-bridge-retoure"/>
>       <property name="sourceConnectionFactoryFactory" ref="amqConnectionFactoryFactory"/>
>       <property name="targetConnectionFactoryFactory" ref="wmqConnectionFactoryFactory"/>
>       <property name="sourceDestinationFactory" ref="amqDestinationFactoryRetoure"/>
>       <property name="targetDestinationFactory" ref="wmqDestinationFactoryRetoure"/>
>       <property name="qualityOfServiceMode" value="DUPLICATES_OK"/>
>       <property name="failureRetryInterval" value="50000"/>
>       <property name="failoverTimeout" value="5000"/>
>       <property name="maxRetries" value="-1"/>
>       <property name="maxBatchSize" value="1"/>
>       <property name="maxBatchTime" value="-1"/>
>    </bean>
> </beans>
>
>
> Camel Configuration:
> <beans xmlns="http://www.springframework.org/schema/beans"
>        xmlns:camel="http://camel.apache.org/schema/spring"
>        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.xsd
>                            http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
>
>   <bean id="amqConnectionFactory" class="org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory">
>     <constructor-arg name="url" value="vm://1"/>
>     <constructor-arg name="user" value="XXXX"/>
>     <constructor-arg name="password" value="XXXX"/>
>   </bean>
>
>   <bean id="wmqConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
>     <property name="transportType" value="1"/>
>     <property name="hostName" value="XXXX"/>
>     <property name="port" value="1414"/>
>     <property name="queueManager" value="XXXX"/>
>     <property name="channel" value="XXXX"/>
>     <property name="targetClientMatching" value="true"/>
>   </bean>
>
>   <bean id="wmqConnectionFactoryWrapper"  class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
>         <property name="targetConnectionFactory" ref="wmqConnectionFactory" />
>         <property name="username" value="XXXX" />
>         <property name="password" value="XXXX" />
>   </bean>
>
>   <camelContext id="bridgeContext" trace="false" xmlns="http://camel.apache.org/schema/spring">
>                 <route id="artemis-jms-bridge-retoure">
>       <from uri="jms:queue://SOURCE.Q?connectionFactory=#wmqConnectionFactoryWrapper&amp;disableReplyTo=true&amp;concurrentConsumers=8&amp;asyncConsumer=true&amp;maxConcurrentConsumers=16&amp;mapJmsMessage=false"/>
>       <to uri="jms:queue://TARGET.Q?connectionFactory=#amqConnectionFactory&amp;exchangePattern=InOnly&amp;forceSendOriginalMessage=true"/>
>     </route>
>   </camelContext>
> </beans>
>
>
> Thanks,
> Thomas
>


-- 
Clebert Suconic