Red Hat JBoss AMQ Clients Sample java program for failover and reconnection

286 views Asked by At

I am trying to create a test program that will have failover feature. I am using and following this document. https://access.redhat.com/documentation/en-us/red_hat_amq/7.0/html/using_the_amq_jms_client/configuration#logging According document failover URI format is following. failover:(amqp://host1:port[,amqp://host2:port...])[?option=value[&option2=value...]] Do you have any sample example that uses URI using above format? I looked examples, but those are not using this URI scheme.

1

There are 1 answers

0
Justin Ross On

If you are looking for an example connection URI, there are two here:

https://access.redhat.com/documentation/en-us/red_hat_amq/7.1/html/using_the_amq_jms_client/configuration#connection_uri_options_failover

If you are looking for an example JMS program, any example that uses that connection URI will work. The docs have one for sending messages and one for receiving them. Either will do.

https://access.redhat.com/documentation/en-us/red_hat_amq/7.0/html/using_the_amq_jms_client/examples

To inject a connection URI into a JMS program:

  1. Set the connectionfactory.<lookup-name> attribute in your JNDI properties to your chosen URI.
  2. Use a matching <lookup-name> to perform the lookup in your JMS program.

The examples use myFactoryLookup as the <lookup-name>.

https://access.redhat.com/documentation/en-us/red_hat_amq/7.0/html/using_the_amq_jms_client/examples#configuring_the_jndi_context