This content has been marked as final.
Show 6 replies
-
2. Re: JBoss 5.0.1, how to create new topic
maxogm Apr 28, 2009 11:01 PM (in response to maxogm)OK, I saw that...
But I dont known how to use ServerPeer to deploy topic.
If someone has an example.
Thanks -
3. Re: JBoss 5.0.1, how to create new topic
gaohoward Apr 28, 2009 11:06 PM (in response to maxogm)You can have a look at the JBM examples source, especially this file:
examples/common/src/org/jboss/example/jms/common/Util.java
the deployQueue() method. -
4. Re: JBoss 5.0.1, how to create new topic
maxogm Apr 28, 2009 11:33 PM (in response to maxogm)I try that example yesterday, and always I got
Unable to find operation createQueue(java.lang.String,java.lang.String)
This is my example:package com.jboss.test; import java.util.Properties; import javax.management.MBeanServerConnection; import javax.management.ObjectName; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NameNotFoundException; public class MakeQueue { public static void main(String[] args) throws Exception { Properties props = new Properties(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming"); props.put(Context.PROVIDER_URL, "jnp://localhost:1100"); InitialContext iniCtx = new InitialContext(props); try{ iniCtx.lookup("queue/test"); }catch (NameNotFoundException e) { MBeanServerConnection mBeanServer = lookupMBeanServerProxy(iniCtx); ObjectName serverObjectName = new ObjectName("jboss.messaging:service=ServerPeer"); String queueName = "test"; mBeanServer.invoke(serverObjectName, "createQueue", new Object[] {queueName, "queue/test"}, new String[] {"java.lang.String", "java.lang.String"}); } } private static MBeanServerConnection lookupMBeanServerProxy(InitialContext ic) throws Exception { if (ic == null) { ic = new InitialContext(); } return (MBeanServerConnection)ic.lookup("jmx/invoker/RMIAdaptor"); } }
In build path I include all jar from JBoss 5.0.1/client and jboss-messaging.jar -
5. Re: JBoss 5.0.1, how to create new topic
gaohoward Apr 28, 2009 11:47 PM (in response to maxogm)Sorry, the operation name should be 'deployQueue', not 'createQueue'.
-
6. Re: JBoss 5.0.1, how to create new topic
maxogm Apr 29, 2009 12:02 AM (in response to maxogm)Works
Thanks