为单个 Liberty 服务器配置点到点消息传递

可以配置点到点消息传递,例如,将消息发送至队列,或者从队列接收消息。

过程

  1. server.xml 文件中配置消息传递功能部件。如果要执行 JNDI 查找,那么还必须添加 jndi-1.0 功能部件。
    <featureManager>
       <feature>wasJmsServer-1.0</feature>
       <feature>wasJmsClient-2.0</feature>
       <feature>jndi-1.0</feature>
    </featureManager>
  2. 配置消息传递引擎以创建一个称为 libertyQ 的队列,如以下示例中所示。
    <messagingEngine>
       <queue id="libertyQ" 
          forceReliability="ReliablePersistent"
          maxMessageDepth="5000">
       </queue>
    </messagingEngine>
  3. 声明队列连接工厂资源以创建与消息传递引擎的连接,如以下示例中所示。
    <jmsQueueConnectionFactory jndiName="jms/libertyQCF" connectionManagerRef="ConMgr2">
        <properties.wasJms
          nonPersistentMapping="ExpressNonPersistent"  
          persistentMapping="ReliablePersistent"/>
    </jmsQueueConnectionFactory>
    <connectionManager id="ConMgr2" maxPoolSize="2"/>
  4. 声明队列资源,以与 libertyQ 队列创建生产者/使用者会话,如以下示例中所示。
    <jmsQueue jndiName="jms/libertyQue">
        <properties.wasJms queueName="libertyQ"
          deliveryMode="Application" 
          timeToLive="500000" 
          priority="1"
          readAhead="AsConnection" />
    </jmsQueue>
  5. 对 Liberty 上部署的消息驱动的 bean 声明激活规范。消息驱动的 Bean 使用激活规范以异步使用来自 jmsQueue 资源的消息。
    <jmsActivationSpec id="JMSSample/JMSApp/SampleMDB">
        <properties.wasJms destinationRef="jms/libertyQue" />
    </jmsActivationSpec>
    标识值必须按以下格式给出:application name/module name/bean name format,其中 application name 是所部署应用程序的名称,module name 是打包该 bean 的模块的名称,bean name 是企业 bean 的 ejb-name。请确保 destinationRef 属性指向有效 jmsQueue 资源标识。
    注: 仅当该 bean 打包到 EAR 文件中时,应用程序名称才适用。
  6. 可选: 可以配置 wasJmsSecurity-1.0 功能部件,以使 wasJmsServer-1.0 功能部件能以安全方式工作。有关更多信息,请参阅对 Liberty 启用安全 JMS 消息传递 点到点消息传递已配置成将消息发送到队列,或者从队列接收消息。

用于指示主题类型的图标 任务主题



时间戳记图标 最近一次更新时间: Monday, 5 December 2016
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-libcore-mp&topic=twlp_msg_single_p2p
文件名:twlp_msg_single_p2p.html