<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
    xmlns:jms="http://www.springframework.org/schema/jms"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
    http://www.springframework.org/schema/jms
    http://www.springframework.org/schema/jms/spring-jms-3.2.xsd">

<!-- WebSphere MQ Connection Factory -->
    <bean id="targetConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
        <property name="hostName">
            <value>${esbmon.mq.hostname}</value>
        </property>
        <property name="port">
            <value>${esbmon.mq.port}</value>
        </property>
        <property name="queueManager">
            <value>${esbmon.mq.queueManagerName}</value>
        </property>
        <property name="channel">
            <value>${esbmon.mq.channel}</value>
        </property>
        <!-- com.ibm.mq.jms.JMSC.MQJMS_TP_CLIENT_MQ_TCPIP=1 -->
        <property name="transportType" value="1" />
    </bean>
    
    <!-- Spring用于管理真正的ConnectionFactory的ConnectionFactory;
        MessageListenerContainer已经建立缓存机制,这里直接使用SingleConnectionFactory而不是
        CachingConnectionFactory
        -->
    <bean id="connectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">  
        <!-- 目标ConnectionFactory对应真实的可以产生JMS Connection的ConnectionFactory -->  
        <property name="targetConnectionFactory" ref="targetConnectionFactory"/>
        <!-- 使用SingleConnectionFactory时,开启reconnectOnException很重要 -->
        <property name="reconnectOnException" value="true"></property>
    </bean>

<!-- JMS Destination Resolver -->
    <bean id="jmsDestinationResolver"
        class="org.springframework.jms.support.destination.DynamicDestinationResolver">
    </bean>

<!-- 事务管理器,将messageListener的onMessage方法作为一个事务 -->
    <bean id="jmsTransactionManager"
        class="org.springframework.jms.connection.JmsTransactionManager">
        <property name="connectionFactory" ref="connectionFactory" />
    </bean>
    
    <!-- 配置成 jta事物,是消息接受事物和数据库操作事物失败都能回滚-->
    <bean id="jtaTransactionManager"
          class="org.springframework.transaction.jta.JtaTransactionManager">
           <property name="connectionFactory" ref="connectionFactory" />
           <property name="sessionTransacted" value="true" />
    </bean>
    
    <!-- 任务处理线程池 -->
    <bean id="jmsListenerTaskExecutor"
        class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
        <property name="corePoolSize">
            <value>${esbmon.jmsListenerExecutor.corePoolSize}</value>
        </property>
        <property name="maxPoolSize">
            <value>${esbmon.jmsListenerExecutor.maxPoolSize}</value>
        </property>
        <property name="keepAliveSeconds">
            <value>${esbmon.jmsListenerExecutor.keepAliveSeconds}</value>
        </property>
        <property name="queueCapacity">
            <value>${esbmon.jmsListenerExecutor.queueCapacity}</value>
        </property>
        <property name="rejectedExecutionHandler">
            <bean class="${esbmon.jmsListenerExecutor.handler}" />
        </property>        
        <property name="threadNamePrefix" value="jmsListenerTaskExecutor" />
    </bean>
    
    <!-- jms listenercontainer用于异步接受消息,JmsTemplate类用来生产消息和同步接收消息  -->
    <!-- container-type:容器的类型, default、simple、default102 或者 simple102 -->
    <!-- connection-factory:JMS ConnectionFactory Bean的引用 -->
    <!-- task-executor:JMS TaskExecutor Bean的引用 -->
    <!-- destination-resolver:DestinationResolver 策略的引用 -->
    <!-- message-converter:MessageConverter 策略的引用用 -->
    <!-- destination-type:目的地类型,queue、topic 或者 durableTopic -->
    <!-- client-id:容器在JMS客户端的id -->
    <!-- acknowledge: JMS消息的确认模式,auto、client、dups-ok 或者 transacted -->
    <!-- transaction-manager:PlatformTransactionManager Bean的引用 -->
    <!-- concurrency:可激活的Session最大并发数 -->
    <!-- prefetch:加载进每个Session的最大消息数,增加这个值会造成并发空闲 -->
    <!-- receive-timeout:每次接收消息的超时时间 -->
    <!-- cache:缓存级别 -->
    <jms:listener-container container-type="default"
        connection-factory="jtaTransactionManager" destination-type="queue"
        transaction-manager="jmsTransactionManager" task-executor="jmsListenerTaskExecutor"
        destination-resolver="jmsDestinationResolver" concurrency="30" prefetch="100"
        receive-timeout="3000" acknowledge="transacted">
        <!-- id: 容器的Bean名称 -->
        <!-- destination: 目的地的名称,由DestinationResolver的策略决定 -->
        <!-- ref: 处理对象的Bean名称 -->
        <!-- method: 处理器中被调用的方法名, 如果ref指向 MessageListener或SessionAwareMessageListener,则这个属性可以被忽略 -->
        <!-- selector: 可选的消息选择器 -->
        <jms:listener id="svcLogListener" destination="${esbmon.mq.queueName.serviceLog}"
            ref="svcLogJmsListener" />
        <jms:listener id="sysLogListener" destination="${esbmon.mq.queueName.systemLog}"
            ref="sysLogJmsListener" />
        <jms:listener id="MqLogListener" destination="${esbmon.mq.queueName.mqSvcLog}"
             ref="pubSubLogJmsListener" />
    </jms:listener-container>

</beans>

IBM Mq Spring JMS 的xml配置的更多相关文章

  1. Spring 入门 web.xml配置详解

    Spring 入门 web.xml配置详解 https://www.cnblogs.com/cczz_11/p/4363314.html https://blog.csdn.net/hellolove ...

  2. spring之pom.xml配置

    spring之pom.xml配置 <?xml version="1.0" encoding="UTF-8"?> <project xmlns= ...

  3. 这一次搞懂Spring Web零xml配置原理以及父子容器关系

    前言 在使用Spring和SpringMVC的老版本进行开发时,我们需要配置很多的xml文件,非常的繁琐,总是让用户自行选择配置也是非常不好的.基于约定大于配置的规定,Spring提供了很多注解帮助我 ...

  4. Spring IOC-基于XML配置的容器

    Spring IOC-基于XML配置的容器 我们先分析一下AbstractXmlApplicationContext这个容器的加载过程. AbstractXmlApplicationContext的老 ...

  5. Spring Ioc容器xml配置

    Spring Ioc容器xml配置基本结构: <?xml version="1.0" encoding="UTF-8"?> <beans xm ...

  6. IBM MQ消息中间件jms消息中RHF2消息头的处理

    公司的技术平台在和某券商对接IBM MQ消息中间件时,发送到MQ中的消息多出了消息头信息:RHF2,造成消息的接收处理不正常.在此记录此问题的处理方式. 在IBM MQ中提供了一个参数 targetC ...

  7. Spring 使用AOP——xml配置

    目录 AOP介绍 Spring进行2种实现AOP的方式 导入jar包 基于schema-based方式实现AOP 创建前置通知 创建后置通知 修改Spring配置文件 基于schema-based方式 ...

  8. Spring RedisTemplate操作-xml配置(1)

    网上没能找到全的spring redistemplate操作例子,故特意化了点时间做了接口调用练习,基本包含了所有redistemplate方法. 该操作例子是个系列,该片为spring xml配置, ...

  9. 关于Spring中applicationContext.xml配置错误“org/springframework/transaction/interceptor/TransactionInterceptor”的问题解决

    问题描述: 在配置spring的applicationContext.xml中的默认事务管理器的时候可能会出现这样的错误: Error occured processing XML 'org/spri ...

随机推荐

  1. Webbench源代码分析(转载)

    转载地址 http://blog.csdn.net/kangroger/article/details/42500703 Web Bench是一个网站压力测试的工具.其最后更新时间是2004年,已经十 ...

  2. 【转】HDU1028

    转自博客园ID:2108,老卢同志 http://www.cnblogs.com/--ZHIYUAN/p/6102893.html Ignatius and the Princess III Time ...

  3. 【转】母函数(Generating function)详解 — TankyWoo(红色字体为批注)

    母函数(Generating function)详解 - Tanky Woo 在数学中,某个序列的母函数(Generating function,又称生成函数)是一种形式幂级数,其每一项的系数可以提供 ...

  4. LYF电子书制作工具(CHM格式)

    可以制作CHM电子书 可以制作电子相册 下载地址:http://files.cnblogs.com/files/blogLYF/LYF电子书制作安装包.zip http://files.cnblogs ...

  5. toString--->转字符串

    因为它是Object里面已经有了的方法,而所有类都是继承Object,所以“所有对象都有这个方法”.它通常只是为了方便输出,比如System.out.println(xx),括号里面的“xx”如果不是 ...

  6. iwinfo 的使用

    以前使用iwconfig来配置和获取wireless的信息,目前openwrt已经废弃这种方式,采用 iwinfo 和 iw 命令来进行替代. iwinfo的使用方法如下: root@hbg:/# i ...

  7. Centos虚拟机安装分区分配

    i 安装hadoop虚拟机

  8. 一步一步学EF系列【4、升级篇 实体与数据库的映射】live writer真坑,第4次补发

    前言 之前的几篇文章,被推荐到首页后,又被博客园下了,原因内容太少,那我要写多点呢,还是就按照这种频率进行写呢?本身我的意图这个系列就是想已最简单最容易理解的方式进行,每篇内容也不要太多,这样初学者容 ...

  9. csv格式导出文件

    先上传连个图片看看效果,这是界面效果dwz框架(springmvc开发) 点击导出csv效果图 js部分的代码(带条件查询的csv导出): function exportReportCsv(){ ex ...

  10. javascript注释规范

    注释在代码编写过程中的重要性,写代码超过半年的就能深深的体会到.没有注释的代码都不是好代码.为了别人学习,同时为了自己以后对代码进行'升级',看看js/javascript代码注释规范与示例.来自:h ...