Hello,
I'm currently trying to set up a Spring Artemis client and particularly the 
failover mechanism.

I sat up Artemis using a cluster two nodes replicated using a static definition:

Below my primary node configuration (from the broker.xml file)

<cluster-user>USER</cluster-user>
<cluster-password>PASSWORD</cluster-password>
    <ha-policy>
       <replication>
          <backup>
             <allow-failback>true</allow-failback>
          </backup>
       </replication>
    </ha-policy>
<connectors>
  <connector name="backup">tcp://artemis-backup:61616</connector>
  <connector name="primary">tcp://artemis-primary:61616</connector>
</connectors>
<acceptors>
  <acceptor 
name="artemis">tcp://0.0.0.0:61616?protocols=OPENWIRE,CORE</acceptor>
</acceptors>
   
<cluster-connections>
  <cluster-connection name="my-cluster">
    <connector-ref>backup</connector-ref>
    <static-connectors>
      <connector-ref>primary</connector-ref>
    </static-connectors>
    <retry-interval>1000</retry-interval>
    <use-duplicate-detection>true</use-duplicate-detection>
  </cluster-connection>
</cluster-connections>


On the client side, I use Spring Boot & the artemis starter

<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-artemis</artifactId>
</dependency>

and configured the properties as following:

spring.artemis.broker-url=(${ARTEMIS_PRIMARY_URL}?name=primary,${ARTEMIS_BACKUP_URL}?name=backup)?protocol=CORE&ha=true&reconnectAttempts=1000&failoverAttempts=1000&clientFailureCheckPeriod=30000
spring.artemis.user=USER
spring.artemis.password=PASSSWORD
spring.artemis.mode=native

Unfortunately, when I run several write/read calls using the JMSTemplate, it 
fails when the primary node stops and the backup node takes over it. An 
exception is automatically raised and the client doesn't automatically shift to 
the backup server on the fly. 
Otherwise, when I re-try my request, it's OK. 

When I try to do the same with the OPENWIRE protocol and the failover URL, it 
works. During the same thread, the failover is perfectly handled.

How can I get the same behaviour with the CORE protocol?

Thanks in advance.

Best Regards,
Alexandre

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to