0
votes

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?;)

1
This "question" is not very clear. Needs more explanation of the problem and information on what you have tried etcTim Bish

1 Answers

0
votes

There isn't such a tool for validating the various broker URI options and transport selections. You'd have to write something on your own. Perhaps you can create something by digesting the activemq.xsd and seeing what options are allowed and their associated types.