このサンプルでは、WebSphere MQ を JMS プロバイダーとして使用するので、JMSAdmin ツールを使用して管理対象オブジェクトを作成する必要があります。
始める前に:
サンプルを Linux 上で実行する場合、以下の手順を実行する必要があります。
>mq_install_directory</java/lib/com.ibm.mqjms.jar
>JAVA_HOME</bin
以下の手順では、WebSphere MQ が mq_install_dir のディレクトリーにインストールされていることを想定しています。 JMSAdmin ツールと JMSAdmin 構成ファイルは、以下の場所にあります。
JMSAdmin ツールを使用するには、その前に JMSAdmin.config ファイルに変更を加えることが必要な場合があります。
# The following line specifies which JNDI service provider is in use. # It currently indicates a File System Context. If a different # service provider is used, this line must be commented out, and the # appropriate one must be uncommented. # # com.sun.jndi.fscontext.RefFSContextFactory is the FileSystem JNDI Context # #INITIAL_CONTEXT_FACTORY=com.sun.jndi.ldap.LdapCtxFactory INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory #INITIAL_CONTEXT_FACTORY=com.ibm.ejs.ns.jndi.CNInitialContextFactory #INITIAL_CONTEXT_FACTORY=com.ibm.websphere.naming.WsnInitialContextFactory # # The following line specifies the URL of the service provider's initial # context. It currently refers to an File System Context. Examples of a # LDAP root context URL and WebSphere's JNDI namespace are also shown, commented # out. # # PROVIDER_URL needs changing to, e.g. file:///home/user/JNDI-Directory # on Unix platforms. The 'JNDI-Directory' folder needs to be created in the # location specified. # #PROVIDER_URL=ldap://localhost/o=ibm,c=us PROVIDER_URL=file:/C:/JNDI-Directory #PROVIDER_URL=iiop://localhost/
これで、オブジェクトを作成できます。
サンプルで使用する JMS 接続ファクトリーと宛先を構成するには、WebSphere MQ JMSAdmin ツールを実行して JNDI 管理対象オブジェクトを作成します。
JMSSampleObjects.defs ファイルを入力として使用して JMSAdmin ツールを実行することにより、オブジェクトを作成します。
ブローカーで使用するポートが 2414 でない場合は、JMSSampleObjects.defs の中でポートの設定値を編集します。
コマンド行に、以下のコマンドを入力します。
cd mq_install_dir¥java¥bin JMSAdmin < "workspace_path¥JMSNodesSampleFlowProject¥JMSSampleObjects.defs"
cd mq_install_dir/java/bin . ./setjmsenv ./JMSAdmin < "workspace_path/JMSNodesSampleFlowProject/JMSSampleObjects.defs"
mq_install_dir は、WebSphere MQ がインストールされている場所であり、workspace_path は、WebSphere Message Broker Toolkit ワークスペース・ディレクトリーの絶対パスです。
それらのオブジェクトと .bindings ファイルが作成されます。
次に、JNDI オブジェクトおよび MQInput ノード属性を以下のようにして変更します。
mq_install_dir\java\bin\JMSAdmin
mq_install_dir/java/bin/JMSAdmin
WebSphere MQ がインストールされる場所は mq_install_dir になります。
alter q(publishqueue) queue(PUBLISHQUEUE)
end
作成したばかりの .bindings ファイルの場所を、メッセージ・フロー内の JMS ノードに通知する必要があります。
JMS ノードで .bindings ファイルの位置を構成するには、次のようにします。
これでメッセージ・フローが構成され、ブローカーにデプロイする準備ができました。
JMSGateway および JMSInput_Publication フローをデプロイするために、両方のメッセージ・フローが入ったブローカー・アーカイブ (BAR) ファイルを作成します。
BAR ファイルを作成するには、次のようにします。
これで、サンプルを実行する準備ができたことになります。