certainly, simply like this:
ActiveMQSslConnectionFactory connectionFactory = new ActiveMQSslConnectionFactory("failover:(ssl://192.168.1.112:61617,ssl://192.168.1.112:61619)?randomize=false&maxReconnectAttempts=Value")
All failover Transport Options can be set in the url
http://activemq.apache.org/failover-transport-reference.html
If you want to change the url later, you can call connectionFactory.setBrokerURL("newURL")
, after that all new connections created will be configured with the new parameters of the url.
if you want to change that after the creation of the ConnectionFactory, keep in mind that a new instance of FailoverTransport is created for each new Connection based on the url parameters and each Connection holds an instance of his FailoverTransport, so to change his state you can access it like this :
((FailoverTransport) ((TransportFilter) ((TransportFilter) ((ActiveMQConnection) connection).getTransport()).getNext()).getNext())
.setMaxReconnectAttempts(10);
or more readable :
org.apache.activemq.transport.TransportFilter responseCorrelator = (TransportFilter) ((ActiveMQConnection) connection).getTransport();
TransportFilter mutexTransport = (TransportFilter) responseCorrelator.getNext();
FailoverTransport failoverTransport = (FailoverTransport) mutexTransport.getNext();
failoverTransport.setMaxReconnectAttempts(10);
to understand why all these casts, you can take a look at source code of this method :
org.apache.activemq.transport.failover.FailoverTransportFactory.doConnect(URI)
here https://github.com/apache/activemq/blob/master/activemq-client/src/main/java/org/apache/activemq/transport/failover/FailoverTransportFactory.java