【发布时间】:2011-09-04 12:20:39
【问题描述】:
我在本地安装了 openMQ,它工作正常。我使用以下代码通过 JNDI 查找来获取 QueueConnectionFactory。
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.fscontext.RefFSContextFactory");
env.put(Context.PROVIDER_URL, "file:///C:/objectstore");
Context ctx = new InitialContext(env);
QueueConnectionFactory myFactory = (QueueConnectionFactory) ctx.lookup("MyQueueConnection");
上面返回给我的连接工厂,我也可以从那里访问replyQueue 和requestQueue。
这就是我设置队列的方式
imqobjmgr add -l "MyQueueConnection"" -j "java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContext
Factory" -j "java.naming.provider.url=file:///C://objectstore" -t qf -o "imqAddressList=mq://localhost:7676/jms"
imqobjmgr add -l "cn=DEVL.REQUEST" -j "java.naming.factory.initial=com.sun.jndi.fscontext.RefFSCon
textFactory" -j "java.naming.provider.url=file:///C://objectstore" -t q -o "imqDestinationName=requestQueue"
imqobjmgr add -l "cn=DEVL.REPLY" -j "java.naming.factory.initial=com.sun.jndi.fscontext.RefFSConte
xtFactory" -j "java.naming.provider.url=file:///C://objectstore" -t q -o "imqDestinationName=replyQueue"
我的问题是:
如何在 Linux 上设置 openMQ 服务器,以便我可以访问 openMQ 来自不同的服务器 代码将在 tomcat 中运行 apache 服务器(也是一个 linux 机器)。
我必须做出哪些改变 从openMQ获取
QueueConnectionFactory的代码
坐在不同的服务器上?
我没有在 GlassFish 中运行 openMQ,我自己运行 openMQ (imqbrokerd.exe)。
【问题讨论】: