[jboss-user] [JBoss Messaging] - JBoss 5.0.1, how to create new topic
maxogm
do-not-reply at jboss.com
Tue Apr 28 12:07:38 EDT 2009
Hello...
I need to create new topic in Jboss 5.0.1 from java applications. Did someone know how to do this.
In Jboss 4.0.1sp1 I do this using next method in Java:
| private void createTopic(String topicName) throws NamingException, InstanceNotFoundException, MBeanException, ReflectionException, IOException {
| Properties props = new Properties();
| props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
| props.put(Context.PROVIDER_URL, "jnp://localhost:1099");
|
| InitialContext iniCtx = new InitialContext(props);
|
| try{
| iniCtx.lookup("topic/" + topicName + "");
| }catch (NameNotFoundException e) {
| ObjectName destinationManager = ObjectNameFactory.create("jboss.mq:service=DestinationManager");
| RMIAdaptor server = null;
| server = (RMIAdaptor) iniCtx.lookup("jmx/invoker/RMIAdaptor");
| server.invoke(destinationManager, "createTopic", new Object[] { topicName, "topic/" + topicName }, new String[] {
| String.class.getName(), String.class.getName() });
| }
| }
|
|
I try to modificate previous code to work with Jboss 5.0.1GA, but I not success. Sorry on very bad English.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4227329#4227329
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4227329
More information about the jboss-user
mailing list