跳转到主要内容

单击提交则表示您同意developerWorks 的条款和条件。 查看条款和条件.

当您初次登录到 developerWorks 时,将会为您创建一份概要信息。您在 developerWorks 概要信息中选择公开的信息将公开显示给其他人,但您可以随时修改这些信息的显示状态。您的姓名(除非选择隐藏)和昵称将和您在 developerWorks 发布的内容一同显示。

所有提交的信息确保安全。

  • 关闭 [x]

当您初次登录到 developerWorks 时,将会为您创建一份概要信息,您需要指定一个昵称。您的昵称将和您在 developerWorks 发布的内容显示在一起。

昵称长度在 3 至 31 个字符之间。 您的昵称在 developerWorks 社区中必须是唯一的,并且出于隐私保护的原因,不能是您的电子邮件地址。

单击提交则表示您同意developerWorks 的条款和条件。 查看条款和条件.

所有提交的信息确保安全。

  • 关闭 [x]

在 WebSphere Application Server V5 中使用嵌入式 JMS 提供程序和 MQ JMS 提供程序启用 JMS 应用程序

Andy Capella (capella@us.ibm.com), 顾问兼软件工程师, IBM Pervasive Computing Development
Andy Capella 的照片
Andy Capella 是 IBM Pervasive Computing 的软件工程师。他是 TCP/IP networking、WebSphere Application Server 和 PerVasive Computing (PVC) Location-Based Services 产品开发小组的主管。他参与过主要的开放源代码技术论坛,包括 IETF、J2EE、WAP 和 OGC。目前,他从事 PVC Intelligent Notification Services 方面的研究。

简介: 本文展示了 Java™ Messaging Service (JMS) 应用程序开发人员和管理员如何使用嵌入式 JMS 或 MQ JMS 提供程序来启用应用程序,以使其运行在 IBM® WebSphere® Application Server Version 5 上。文中还介绍了需要安装什么产品来支持任何一个 JMS 提供程序。本文提供了如何为点到点和发布/订阅配置 JMS 资源的示例,还提供了如何使用任何一个 JMS 提供程序在 JMS 应用程序中配置 Message Driver Bean 使用的侦听器端口的示例。所包含的示例日志清单可以帮助指导您验证配置。最重要的是,对于使用 MQ JMS 提供程序的开发人员来说,本文提供了使用 MQ JMS 提供程序时所需的 WebSphere MQ 和 WebSphere Business Integration Message Broker 设置命令和配置代码。

发布日期: 2005 年 1 月 19 日
级别: 初级
访问情况 : 743 次浏览
评论: 


概述

WebSphere Application Server V5(以下称为 Application Server)提供了一个新的消息传递功能,该功能包括对 Java Messaging Service (JMS) 提供程序的支持。Application Server 包括一个称为嵌入式 JMS 提供程序的内部 JMS 提供程序。该提供程序依赖于 IBM 消息传递技术的子集,即用于点到点消息传递的 WebSphere MQ V5.3 和用于发布/订阅消息传递的 WebSphere MQ Event Broker V2.1。Application Server V5 还支持 WebSphere MQ 作为 JMS 提供程序。

本文描述了如何启用 JMS Java 2 Platform Enterprise Edition (J2EE) 应用程序以在 Application Server 中使用嵌入式 JMS 提供程序或者 MQ JMS 提供程序。


安装 JMS 提供程序

下面的部分描述了如何安装嵌入式 JMS 提供程序或者 MQ JMS 提供程序。

嵌入式 JMS 提供程序

要使用嵌入式 JMS 支持,请在安装 Application Server V5 时选择 Embedded Messaging Client 和 Embedded Messaging Server 选项。嵌入式消息传递客户机启用运行在 Application Server 上的应用程序,以与 WebSphere JMS 提供程序进行通信。嵌入式消息传递服务器包含 WebSphere JMS 提供程序的消息传递服务器的功能,并提供点到点和发布/订阅消息传递功能。如果系统上已存在 Websphere MQ,则 Application Server 可以将其作为 JMS 提供程序,但是您必须确保安装了正确的 WebSphere MQ 版本以及功能,如下一部分所述。

MQ JMS 提供程序

Application Server V5 支持 WebSphere MQ 作为备用 JMS 提供程序。要安装 MQ JMS 提供程序,请执行以下操作:

  1. 如 WebSphere MQ 附带的安装说明所述,安装具有 Application Server V5 支持的所需 MQ 功能的 WebSphere MQ V5.3。这将启用点到点消息传递支持。
  2. 如果您需要发布/订阅消息传递支持,则还必须安装一个发布/订阅代理。确保发布/订阅代理支持所安装的 Websphere MQ。IBM 提供三个发布/订阅代理:
    • WebSphere MQ Event Broker V2.1
    • WebSphere Business Integration(以下称为 BI )Event Broker V5
    • WebSphere Business Integration Message Broker V5

在本文中,我们将 BI Message Broker V5 作为发布/订阅代理。


配置和启动 JMS 提供程序

下面的部分描述如何配置和启动嵌入式 JMS 提供程序和 MQ JMS 提供程序。

嵌入式 JMS 提供程序

一旦安装了 Application Server 以使用嵌入式 JMS 提供程序,就转到管理控制台并完成下面的步骤,以便启用将由 JMS J2EE 应用程序使用的 JMS 资源:

  1. 在 Application Server 管理控制台中,选择 Resources => WebSphere JMS Provider 并创建由 JMS J2EE 应用程序使用的 JMS 资源(即,Queue Connection Factories、Queue Destinations、TopicConnectionFactories 和 Topic Destinations)。创建 Queue Connection Factories 和 Queue destinations 以用于点到点消息传递应用程序。创建 Topic Connection Factories 和 Topic destinations 以用于发布/订阅消息传递应用程序。
    图 1. Websphere JMS 提供程序
    图 1. Websphere JMS 提供程序
  2. 创建示例 JMS 资源 SmQueueConnectionFactorySmTopicConnectionFactorySmQueueSub,如下面的示例所示:
    图 2. Queue Connection Factory 示例
    图 2. Queue Connection Factory 示例

    图 3. Topic Connection Factory 示例
    图 3. Topic Connection Factory 示例

    图 4. Queue Destination 示例
    图 4. Queue Destination 示例
  3. 要确保将 JMS 资源正确地绑定到 Java 命名和目录接口 (JNDI) 名称空间,在运行 JMS J2EE 应用程序的 Application Server SystemOut.log 中查找下面的关键消息。将资源绑定到名称空间,这样应用程序就可以动态地对其进行查找。使用 javax.naming.InitialContext 类查找方法以定位资源。另外,在创建 JMS 资源时管理员必须为它配置一个范围。这决定了 JMS 资源可以由一个应用服务器使用,还是由运行在节点上的所有应用服务器或运行在网络部署单元 (Network Deployment cell) 的所有应用服务器使用。
    [10/5/04 16:11:40:062 EDT] 4d253026 ResourceMgrIm I WSVR0049I: 
    Binding SmQueueConnectionFactory as jms/SmQueueConnectionFactory
    [10/5/04 16:11:40:062 EDT] 4d253026 ResourceMgrIm I WSVR0049I: 
    Binding SmQueueSub as jms/SmQueueSub
    [10/5/04 16:11:40:109 EDT] 4d253026 ResourceMgrIm I WSVR0049I:
    Binding SmTopicConnectionFactory as jms/SmTopicConnectionFactory
    			

  4. 在管理控制台中,将 JMS Queue 和 Topic 目的资源添加到运行 JMS J2EE 应用程序的 Application Server 的 JMS 服务器。并且,将 JMS 服务器的初始状态属性设置为 started,以便确保在 Application Server 启动时 JMS 服务器可以自动启动。 例如,添加 JMS Queue 目的资源,SmQueueSub,并将 JMS 服务器的初始状态属性设置为 started,如下面的示例所示:
    1. 选择 Servers => Application Servers。这将显示有关管理域中应用服务器的一个表。
    2. 在内容窗格中,单击 Application Server 的名称(例如,MYServer)。这将显示内容窗格中 Application Server 的属性。
    3. 在内容窗格中,在 Additional Properties 下,选择 Server components => JMS Servers。这将显示内容窗格中 JMS 服务器的属性。
    4. 将所创建的 Queue 和 Topic 目的资源添加到 JMS 服务器的 Queue names 属性中。
    5. 确保将 JMS 服务器 Initial State 属性设置为 started

    图 5. JMS 服务器属性
    图 5. JMS 服务器属性
  5. 在运行 JMS J2EE 应用程序的 Application Server SystemOut.log 中查找下面的关键消息,以确保嵌入式 JMS 服务器正常启动:
    [5/11/04 11:28:51:234 EDT] 4dc429c9 JMSEmbeddedPr A MSGS0050I: 
    Starting the Queue Manager
    [5/11/04 11:28:52:953 EDT] 4dc429c9 JMSEmbeddedPr A MSGS0051I: 
    Queue Manager open for business
    [5/11/04 11:28:52:953 EDT] 4dc429c9 JMSEmbeddedPr A MSGS0052I: 
    Starting the Broker
    [5/11/04 11:28:55:453 EDT] 4dc429c9 JMSEmbeddedPr A MSGS0053I: 
    Broker open for business
    			

  6. 如果 JMS J2EE 应用程序使用 Message Driver Bean,则需要在管理控制台创建侦听器端口。侦听器端口允许 JMS 应用程序异步侦听消息。Message Driver Bean 所使用的侦听器端口在运行 JMS J2EE 应用程序的 Application Server 的消息侦听器服务 (Message Listener Service) 中创建。下面的 JMS J2EE 应用程序描述符展示了侦听器端口的示例定义(重点突出部分):
    <?xml version="1.0" encoding="UTF-8"?>
    <ejbbnd:EJBJarBinding xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" 
    xmlns:ejbbnd="ejbbnd.xmi" 
    xmlns:ejb="ejb.xmi" xmi:id="EJBJarBinding_1055163252462" currentBackendId="DB2UDBNT_V72_1">
        <ejbJar href="META-INF/ejb-jar.xml#ejb-jar_ID"/>
        <ejbBindings xmi:id="EnterpriseBeanBinding_1055163252462" 
        jndiName="ejb/com/ibm/pvc/ins/sm/server/SubscriptionServiceHome">
          <enterpriseBean xmi:type="ejb:Session" 
          href="META-INF/ejb-jar.xml#SubscriptionService"/>
        </ejbBindings>
        <ejbBindings xmi:id="EnterpriseBeanBinding_1055197456298" 
        jndiName="ejb/com/ibm/websphere/startupservice/SubscriptionStartUpBean">
          <enterpriseBean xmi:type="ejb:Session"
           href="META-INF/ejb-jar.xml#AppStartUp"/>
        </ejbBindings>
        <ejbBindings xmi:id="EnterpriseBeanBinding_1056144206631"
        jndiName="ejb/com/ibm/pvc/ins/sm/database/Triggers">
          <enterpriseBean xmi:type="ejb:ContainerManagedEntity" 
     href="META-INF/ejb-jar.xml#Triggers"/>
        </ejbBindings>
        <ejbBindings xmi:type="ejbbnd:MessageDrivenBeanBinding" 
         xmi:id="MessageDrivenBeanBinding_1060968316889" 
         listenerInputPortName="SmLpSub">
          <enterpriseBean xmi:type="ejb:MessageDriven"
          href="META-INF/ejb-jar.xml#MessageDriven_1060968316889"/>
        </ejbBindings>
        <ejbBindings xmi:id="EnterpriseBeanBinding_1062106510434" 
      jndiName="ejb/com/ibm/pvc/ins/sm/server/SubscriptionAdminServiceHome">
          <enterpriseBean xmi:type="ejb:Session" 
          href="META-INF/ejb-jar.xml#SubscriptionAdminService"/>
        </ejbBindings>
        <ejbBindings xmi:id="EnterpriseBeanBinding_1082140050533" 
        jndiName="ejb/com/ibm/pvc/ins/sm/database/SubOwner">
          <enterpriseBean xmi:type="ejb:ContainerManagedEntity" 
     href="META-INF/ejb-jar.xml#SubOwner"/>
        </ejbBindings>
    <defaultCMPConnectionFactory xmi:id="CMPConnectionFactoryBinding_1056146794783" 
         jndiName="jdbc/insdb" resAuth="Container"/>
      </ejbbnd:EJBJarBinding>
    		

    例如,要为 JMS J2EE 应用程序定义侦听器端口 SmLpSub,请执行以下操作:
    1. 在管理控制台的导航窗格中,选择 Servers => Application Servers
    2. 单击包含应用程序的服务器(例如,MYServer)。
    3. 选择 Configuration 选项卡。
    4. Additional Properties 部分中,选择 Message Listener Service
    5. Additional Properties 部分中,选择 Listener Ports
    6. 单击 New,添加侦听器端口 SmLpSub
    7. Name 中,指定 SmLpSub
    8. Connection Factory jndi name 字段中,指定 jms/SmQueueConnectionFactory
    9. Destination jndi name 字段中,指定 jms/SmQueueSub

    图 6. 侦听器端口 SmLpSub 示例
    图 6. 侦听器端口 SmLpSub 示例
  7. 在运行 JMS J2EE 应用程序的 Application Server SystemOut.log 中查找下面的关键消息,以确保对侦听器端口进行正确定义:
    [10/5/04 16:11:55:859 EDT] 4d253026 MDBListenerIm I WMSG0042I: MDB Listener SmLpSub 
    	started successfully for JMSDestination jms/SmQueueSub
    			

  8. 完成了上述步骤后,启动 Application Server,然后在管理控制台部署并启动 JMS J2EE 应用程序,以便对其进行验证。

MQ JMS 提供程序

一旦安装了 WebSphere MQ、BI Message Broker 和 Application Server 以使用 MQ JMS 提供程序,就执行下面的步骤,以便启用将由 JMS J2EE 应用程序使用的 JMS 资源:

  1. 在 WebSphere MQ 中,创建一个队列管理器。在创建队列管理器时,记录队列管理器的名称、主机以及端口,在 Application Server 中设置 JMS 资源时需要使用它们。下面的 WebSphere MQ 命令展示了如何创建一个示例队列管理器 WAS_mytest1_MYServer
    crtmqm WAS_mytest1_MYServer
    

    有关创建队列管理器的详细信息,请参阅 WebSphere MQ 文档。
  2. 在 BI Message Broker 中,为与创建的队列管理器相关的 JMS 发布/订阅消息传递创建一个代理。该代理与队列管理器相关,并且可以只与一个队列管理器相关。下面的 BI Message Broker 命令展示了如何创建一个与队列管理器 WAS_mytest1_MYServer 相关的示例代理 MYBroker1
    mqsicreatebroker MYBroker1 -i <service_id> -a 
    <service_pswd> -q WAS_mytest1_MYServer -n 
    <broker_db> <db> -u <db_id> -p <db_pswd>
    

    其中:
    • <service_id> 必须是本地组 mqbrkrs 的成员,并且有权访问安装 BI Message Broker 的主机目录
    • <service_pwsd> 是与 service_id 相关的密码
    • <broker_db> 是在其中创建代理表的数据库的 ODBC 数据源名称 (DSN)
    • <db> 是在其中创建代理表的数据库的 ODBC 数据源名称 (DSN)
    • <db_id> 是数据库用户 ID
    • <db_pwsd> 是与 db_id 相关的数据库密码
    有关创建代理的其他详细信息,请参阅 WebSphere Business Integration Message Broker。
  3. 在 Application Server 管理控制台中,配置 Application Server 以使用 MQ JMS 提供程序。导航到 Environment => Manage WebSphere Variables,并且将 MQJMS_LIB_ROOT 环境变量设置为安装 WebSphere MQ 的目录,如下所示:
    图 7. 管理 WebSphere 变量
    图 7. 管理 WebSphere 变量
  4. 在 Application Server 管理控制台中,选择 Resources => WebSphere MQ JMS Provider,并创建 JMS J2EE 应用程序使用的 MQ JMS 资源(即,Queue Connection Factories、Queue Destinations、TopicConnectionFactories 和 Topic Destinations)。
    图 8. WebSphere MQ JMS 提供程序
    图 8. WebSphere MQ JMS 提供程序
    创建示例 MQ JMS 资源 SmQueueConnectionFactorySmTopicConnectionFactorySmQueueSub,如下面的示例所示:
    图 9. Queue Connection Factory 示例
    图 9. Queue Connection Factory 示例

    图 10. Topic Connection Factory 示例
    图 10. Topic Connection Factory 示例

    图 11. Topic Connection Factory 示例(继续)
    图 11. Topic Connection Factory 示例(继续)

    图 12. Queue Destination 示例
    图 12. Queue Destination 示例

    图 13. Queue Destination 示例(继续)
    图 13. Queue Destination 示例(继续)
  5. 下面是一个这样的示例:在运行 JMS J2EE 应用程序的 Application Server SystemOut.log 中查找关键消息,以确保 MQ JMS 资源被正确地绑定到 JNDI 名称空间:
    [10/5/04 16:11:40:062 EDT] 4d253026 ResourceMgrIm I WSVR0049I: 
    Binding SmQueueConnectionFactory 
    	as jms/SmQueueConnectionFactory
    [10/5/04 16:11:40:062 EDT] 4d253026 ResourceMgrIm I WSVR0049I: 
    Binding SmQueueSub 
    	as jms/SmQueueSub
    [10/5/04 16:11:40:109 EDT] 4d253026 ResourceMgrIm I WSVR0049I: 
    Binding SmTopicConnectionFactory 
    	as jms/SmTopicConnectionFactory
    			

  6. 在 Application Server 管理控制台中,选择 Servers => Application Servers,并在运行 JMS J2EE 应用程序的 Application Server 的消息侦听器服务中创建侦听器端口。该步骤与嵌入式 JMS 提供程序中的步骤相同。
  7. 在 Websphere MQ 中,在队列管理器上创建与在 Application Server 中创建的 JMS Queue 目的资源对应的队列。下面的 WebSphere MQ 命令在队列管理器 WAS_mytest1_MYServer 上创建示例队列 SmQueueSub
    strmqm WAS_mytest1_MYServer
    runmqsc WAS_mytest1_MYServer  < sm_mq.mqsc
    end
    endmqm WAS_mytest1_MYServer
    			

    其中文件 sm_mq.mqsc 的内容为:
    ********************************************************************/
    *                                                                  */
    *   SM Subscriber Queue                                            */
    *                                                                  */
    ********************************************************************/
    **   Create a local queue
        DEFINE QLOCAL(SmQueueSub) REPLACE +
            DESCR(Subscription Manager Subscriber Queue) +
    *   Persistent messages OK
            DEFPSIST(YES)  +
    *   Shareable
            SHARE DEFSOPT(SHARED) +
    *   Maximum queue depth
            MAXDEPTH(100000)
    

  8. 在 WebSphere MQ 中,在 WebSphere MQ 队列管理器中创建内部 JMS 发布/订阅队列,以进行 JMS 发布/订阅消息传递。下面的 WebSphere MQ 命令为示例队列管理器 WAS_mytest1_MYServer 创建内部 JMS 发布/订阅队列:
    strmqm WAS_mytest1_MYServer
    runmqsc WAS_mytest1_MYServer  < mq_jms.mqsc
    end
    endmqm WAS_mytest1_MYServer
    			

    其中文件 mq_jms.mqsc 的内容为:
    ********************************************************************/
    *                                                                  */
    *   JMS Publish/Subscribe Administration Queue                     */
    *                                                                  */
    ********************************************************************/
    **   Create a local queue
        DEFINE QLOCAL(SYSTEM.JMS.ADMIN.QUEUE) REPLACE +
            DESCR(Websphere MQ - JMS Classes - admin queue) +
    *   Persistent messages OK
            DEFPSIST(YES)  +
    *   Non-Shareable
            NOSHARE
    ********************************************************************/
    *                                                                  */
    *   JMS Publish/Subscribe Subscriber Status Queue                  */
    *                                                                  */
    ********************************************************************/
    **   Create a local queue
        DEFINE QLOCAL(SYSTEM.JMS.PS.STATUS.QUEUE) REPLACE +
            DESCR(Websphere MQ - JMS Classes - PS status queue) +
    *   Persistent messages OK
            DEFPSIST(YES)  +
    *   Shareable
            SHARE DEFSOPT(SHARED)
    ********************************************************************/
    *                                                                  */
    *   JMS Publish/Subscribe Report Queue                             */
    *                                                                  */
    ********************************************************************/
    **   Create a local queue
        DEFINE QLOCAL(SYSTEM.JMS.REPORT.QUEUE) REPLACE +
            DESCR(Websphere MQ - JMS Classes - Report queue) +
    *   Persistent messages OK
            DEFPSIST(YES)  +
    *   Shareable
            SHARE DEFSOPT(SHARED)
    ********************************************************************/
    *                                                                  */
    *   JMS Publish/Subscribe Subscribers Model Queue                  */
    *                                                                  */
    *   Create model queue used by subscribers to create a permanent   */
    *   queue for subsciptions                                         */
    *                                                                  */
    ********************************************************************/
    *   General reply queue                                            */
        DEFINE QMODEL(SYSTEM.JMS.MODEL.QUEUE) REPLACE +
            DESCR(Websphere MQ - JMS Classes - Model queue) +
    *   Queue Definition Type
            DEFTYPE(PERMDYN) +
    *   Shareable
            SHARE DEFSOPT(SHARED)
    ********************************************************************/
    *                                                                  */
    *   JMS Publish/Subscribe Default Non-Durable Shared Queue         */
    *                                                                  */
    *   Create local queue used as the default shared queue by         */
    *   non-durable subscribers                                        */
    *                                                                  */
    ********************************************************************/
    **   Create a local queue
        DEFINE QLOCAL(SYSTEM.JMS.ND.SUBSCRIBER.QUEUE) REPLACE +
            DESCR(Websphere MQ - JMS Classes - PS ND shared queue) +
    *   Persistent messages OK
            DEFPSIST(YES)  +
    *   Shareable
            SHARE DEFSOPT(SHARED) +
    *   Maximum queue depth
            MAXDEPTH(100000)
    ********************************************************************/
    *                                                                  */
    *   JMS Publish/Subscribe Default Non-Durable Shared Queue for     */
    *   ConnectionConsumer functionality                               */
    *                                                                  */
    *   Create local queue used as the default shared queue by         */
    *   non-durable connection consumers                               */
    *                                                                  */
    ********************************************************************/
    **   Create a local queue
        DEFINE QLOCAL(SYSTEM.JMS.ND.CC.SUBSCRIBER.QUEUE) REPLACE +
            DESCR(Websphere MQ - JMS Classes - PS ND CC shared q) +
    *   Persistent messages OK
            DEFPSIST(YES)  +
    *   Shareable
            SHARE DEFSOPT(SHARED)  +
    *   Maximum queue depth
            MAXDEPTH(100000)
    ********************************************************************/
    *                                                                  */
    *   JMS Publish/Subscribe Default Durable Shared Queue             */
    *                                                                  */
    *   Create local queue used as the default shared queue by durable */
    *   subscribers                                                    */
    *                                                                  */
    ********************************************************************/
    **   Create a local queue
        DEFINE QLOCAL(SYSTEM.JMS.D.SUBSCRIBER.QUEUE) REPLACE +
            DESCR(Websphere MQ - JMS Classes - PS D shared queue) +
    *   Persistent messages OK
            DEFPSIST(YES)  +
    *   Shareable
            SHARE DEFSOPT(SHARED)  +
    *   Maximum queue depth
            MAXDEPTH(100000)
    ********************************************************************/
    *                                                                  */
    *   JMS Publish/Subscribe Default Durable Shared Queue for         */
    *   ConnectionConsumer functionality                               */
    *                                                                  */
    *   Create local queue used as the default shared queue by durable */
    *   connection consumers                                           */
    *                                                                  */
    ********************************************************************/
    **   Create a local queue
        DEFINE QLOCAL(SYSTEM.JMS.D.CC.SUBSCRIBER.QUEUE) REPLACE +
            DESCR(Websphere MQ - JMS Classes - PS D CC shared q) +
    *   Persistent messages OK
            DEFPSIST(YES)  +
    *   Shareable
            SHARE DEFSOPT(SHARED)  +
    *   Maximum queue depth
            MAXDEPTH(100000)
    ********************************************************************/
    *                                                                  */
    *   WAS Subscription Manager Publication Queue                     */
    *                                                                  */
    ********************************************************************/
    **   Create a local queue
        DEFINE QLOCAL(SYSTEM.BROKER.DEFAULT.STREAM) REPLACE +
            DESCR(Websphere MQ - Broker Deafult Stream) +
    *   Persistent messages OK
            DEFPSIST(YES)  +
    *   Shareable
            SHARE DEFSOPT(SHARED)  +
    *   Maximum queue depth
            MAXDEPTH(100000)
    			

  9. 在 BI Message Broker 工具包中,创建消息流 (MYPubSub.msgflow) 以处理发布消息。然后将消息流保存到一个称为 BAR (Broker Archive) 文件的文件中。在部署消息流时使用该 BAR 文件。

    下面是一个简单的消息流示例,一旦部署了该消息流,就允许代理接收输入发布消息以及将其传送到对特定主题感兴趣的订户。该简单消息流示例包括一个 MQ 输入节点 SmPublication 和一个发布节点 SmPublishResults。MQInputNode 允许代理使用缺省的代理队列 SYSTEM.BROKER.DEFAULT.STREAM 来接受发布消息。发布节点允许代理将消息传送到对该主题感兴趣的订户。


    图 15. Message Broker 工具包
    图 15. Message Broker 工具包

    创建消息流后,要确保启动队列管理器和代理,然后将消息流部署到该代理,以便允许此代理处理发布消息。下面的 BI Message Broker 命令将一个消息流部署到示例代理 MYBroker1 中:

    strmqm WAS_mytest1_MYServer
    mqsistart MYBroker1
    mqsideploy -b MYBroker1 -e <execution_group_name> -bar <broker_archive_file_name> 
    

    其中:

    • <execution_group_name> 是部署到的代理执行组的名称
    • <broker_archive_file_name> 是在创建消息流的步骤中创建的 BAR 文件的名称

    有关部署消息流的详细信息,请参阅 WebSphere Business Integration Message Broker 文档。

  10. 完成这些任务后,启动 WebSphere MQ、BI Message Broker 和 Application Server,然后在管理控制台部署并启动 JMS J2EE 应用程序,以验证该应用程序。

结束语

本文介绍了如何使用嵌入式 JMS 提供程序或 MQ JMS 提供程序以让应用程序能够运行在 Application Server V5 上,作为一个 JMS 应用程序开发人员或管理员,您需要了解这些。文中描述了如何安装这两种 JMS 提供程序、如何为 JMS 应用程序配置 JMS 资源和侦听器端口,以及如何验证配置设置。还提供了使用 MQ JMS 提供程序时所需的 WebSphere MQ 和 BI Message Broker 命令以及设置代码。


参考资料

关于作者

Andy Capella 的照片

Andy Capella 是 IBM Pervasive Computing 的软件工程师。他是 TCP/IP networking、WebSphere Application Server 和 PerVasive Computing (PVC) Location-Based Services 产品开发小组的主管。他参与过主要的开放源代码技术论坛,包括 IETF、J2EE、WAP 和 OGC。目前,他从事 PVC Intelligent Notification Services 方面的研究。

关于报告滥用的帮助

报告滥用

谢谢! 此内容已经标识给管理员注意。


关于报告滥用的帮助

报告滥用

报告滥用提交失败。 请稍后重试。


developerWorks:登录


需要一个 IBM ID?
忘记 IBM ID?


忘记密码?
更改您的密码

单击提交则表示您同意developerWorks 的条款和条件。 使用条款

 


当您初次登录到 developerWorks 时,将会为您创建一份概要信息。您在 developerWorks 概要信息中选择公开的信息将公开显示给其他人,但您可以随时修改这些信息的显示状态。您的姓名(除非选择隐藏)和昵称将和您在 developerWorks 发布的内容一同显示。

请选择您的昵称:

当您初次登录到 developerWorks 时,将会为您创建一份概要信息,您需要指定一个昵称。您的昵称将和您在 developerWorks 发布的内容显示在一起。

昵称长度在 3 至 31 个字符之间。 您的昵称在 developerWorks 社区中必须是唯一的,并且出于隐私保护的原因,不能是您的电子邮件地址。

(长度在 3 至 31 个字符之间)


单击提交则表示您同意developerWorks 的条款和条件。 使用条款.

 


为本文评分

评论

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=10
Zone=WebSphere
ArticleID=88433
ArticleTitle=在 WebSphere Application Server V5 中使用嵌入式 JMS 提供程序和 MQ JMS 提供程序启用 JMS 应用程序
publish-date=01192005
author1-email=capella@us.ibm.com
author1-email-cc=

标签

Help
使用 搜索 文本框在 My developerWorks 中查找包含该标签的所有内容。

使用 滑动条 调节标签的数量。

热门标签 显示了特定专区最受欢迎的标签(例如 Java technology,Linux,WebSphere)。

我的标签 显示了特定专区您标记的标签(例如 Java technology,Linux,WebSphere)。

使用搜索文本框在 My developerWorks 中查找包含该标签的所有内容。热门标签 显示了特定专区最受欢迎的标签(例如 Java technology,Linux,WebSphere)。我的标签 显示了特定专区您标记的标签(例如 Java technology,Linux,WebSphere)。