On 5/12/07, Jiang <zju_jjc@163.com> wrote:
>
> James, I do not add topic to JNDI.
I know. But you look up the destination in JNDI - which is why its not
being found.
> What I do is add Topic to ActiveMQ server
> remotely through JMX just as the code below :
> jmxUrl = new
> JMXServiceURL("service:jmx:rmi:///jndi/rmi://10.4.1.64:1099/jmxrmi");
> JMXConnector jmxc = JMXConnectorFactory.connect(jmxUrl);
> MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();
> ObjectName mBeanName = new
> ObjectName("org.apache.activemq:BrokerName=localhost,Type=Broker");
> mbsc.invoke(mBeanName, "addTopic",new Object[]{"Hello"}, new String[]
> {"java.lang.String"});
> mbsc.invoke(mBeanName, "addQueue",new Object[]{"World"}, new String[]
> {"java.lang.String"});
>
> And I want to retrieve the topic I just addd. ActiveMQ is running on the
> server pc. And the client code is running on the client pc. They are not the
> same machine. How can I get the topic ?(I try the client code but it failed
> to get the topic)???
The simplest way is just to call session.createTopic(name)
--
James
-------
http://macstrac.blogspot.com/
|