I have small problem with Uri. I don't know how to validate Uri which contains: failover,static,vm,broker,fanout, ofcourse i can validate Uri which contain tcp,udp,ssl with URLValidator from org.apache.commons.validator package. I was looking at ActiveMQ documentation, but i couldn't find something to resolve this problem. I must check Uri before i will make connection to ActiveMQ. Here is example:
String url = "failover:(tcp://localhost:61616,tcp://remotehost:61616)?initialReconnectDelay=100";
UrlValidator urlValidator = new UrlValidator(UrlValidator.ALLOW_ALL_SCHEMES);
urlValidator.isValid(url);
ActiveMQConnectionFactory activemg = new ActiveMQConnectionFactory();
activemg.setBrokerURL(url);
activemg.createConnection();
I want check Url before I setBrokerURL. It's not a problem with Uri :
tcp://localhost:61616?transport.trace=false&transport.soTimeout=60000
, but urlValidator is too strict and dont accept Uri which looking like this:
failover:(tcp://localhost:61616,tcp://remotehost:61616)?initialReconnectDelay=100
fanout:(static:(tcp://localhost:61616,tcp://remotehost:61616))?initialReconnectDelay=100
Maybe you know the answer?;)