无法在WebSphere中以编程方式创建JMS主题 [英] Not able to create JMS topic programatically in WebSphere
本文介绍了无法在WebSphere中以编程方式创建JMS主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法创建SIB JMS主题或队列.我尝试了下面的代码.代码运行无任何异常或错误
I'm not able to create SIB JMS topic or queue. I tried the below code. The code ran without any exception or error
public void createSIBJMSTopic(String topicName, String jndiName, String busName, String topicSpace) {
try {
String server = "server1";
String description = "abc";
Session session = new Session();
CommandMgr commandMgr = CommandMgr.getCommandMgr(client);
configService = new ConfigServiceProxy(client);
System.out.println("Commands list" + commandMgr.listAllCommands().toString());
AdminCommand cmd = commandMgr.createCommand("createSIBJMSTopic");
System.out.println(session);
ObjectName targetObject = configService.resolve(session, null, "Node=mbaastest40Node02,Server=server1")[0];
cmd.setTargetObject(targetObject);
cmd.setParameter("name", topicName);
cmd.setParameter("jndiName", jndiName);
cmd.setParameter("busName", busName);
cmd.setParameter("topicSpace", topicSpace);
System.out.println("Before Execute");
cmd.execute();
CommandResult result = cmd.getCommandResult();
System.out.println("after execute");
if (result.isSuccessful())
System.out.println(result.toString());
if (!result.isSuccessful())
throw new AdminException(result.getException());
System.out.println("done");
configService.save(session, true);
System.out.println("After save");
}
catch (Exception e) {
e.printStackTrace();
}
}
推荐答案
您需要通过以下方式将 AdminCommand 与配置 Session 链接:
You need to link the AdminCommand with the config Session via:
AdminCommand cmd = commandMgr.createCommand("createSIBJMSTopic");
cmd.setConfigSession(session);
You should also note the recommendation to call configService.discard(session)
when done:
这是一个很好的入门文章可能会有所帮助也是.
Here's a good getting started article that may help too.
这篇关于无法在WebSphere中以编程方式创建JMS主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文