我在下面编写了实用程序代码来检查 Solace MQ 目标是否已启动,而无需向目标发送任何消息。
...
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.")
}
我需要添加一些东西还是会验证目的地?