I have written below utility code to check whether Solace MQ destination is up or not without sending any message to destination.
...
try {
env = new Hashtable<String, Object>();
env.put(InitialContext.INITIAL_CONTEXT_FACTORY, "com.solacesystems.jndi.SolJNDIInitialContextFactory");
env.put(InitialContext.PROVIDER_URL, urlStr);
env.put(Context.SECURITY_PRINCIPAL, principalStr);
env.put(Context.SECURITY_CREDENTIALS, pwdStr);
initialContext = new InitialContext(env);
cf = (SolConnectionFactory) initialContext.lookup(jndiname);
connection = cf.createConnection();
SolDestination dest = (SolDestination) initialContext.lookup(destString);
System.out.println("Successfully connected.")
} catch (Exception e) {
System.out.println("Failed to connect.")
}
Do I need to add something or will it validate the destination?