openMQ をローカルにインストールしたところ、問題なく動作しました。次のコードをQueueConnectionFactory
使用して、JNDI ルックアップを使用して取得しました。
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
上記は、 andにもアクセスする接続ファクトリを返します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"
私の質問は次のとおりです。
Tomcat Apache サーバー (Linux ボックス) でコードが実行される別のサーバーから openMQ にアクセスできるように、Linux サーバーで openMQ をセットアップするにはどうすればよいですか。
別のサーバーにある
QueueConnectionFactory
openMQから取得するには、コードにどのような変更を加える必要がありますか?
私は GlassFish で openMQ を実行していません。それ自体 (imqbrokerd.exe) で openMQ を実行しています。