SPRING整合IBMMQ实现全局事物
<?
xml version
=
"
1.0
"
encoding
=
"
UTF-8
"
?>
< beans xmlns = " http://www.springframework.org/schema/beans "
xmlns:xsi = " http://www.w3.org/2001/XMLSchema-instance "
xsi:schemaLocation = " http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd " >
< bean id = " jndiTemplate "
class = " org.springframework.jndi.JndiTemplate " >
< property name = " environment " >
< props >
< prop key = " java.naming.factory.initial " >
com.sun.jndi.fscontext.RefFSContextFactory
</ prop >
< prop key = " java.naming.provider.url " >
file: / C: / JMSDEMO / JNDI / mes
</ prop >
</ props >
</ property >
</ bean >
<!--< bean id = " queueConnectionFactory "
class = " org.springframework.jndi.JndiObjectFactoryBean " >
< property name = " jndiTemplate " >
< ref bean = " jndiTemplate " />
</ property >
< property name = " jndiName " >
< value > JMSDEMOCF </ value >
</ property >
</ bean >
-->
< bean id = " ConnectionFactoryBean " class = " bitronix.tm.resource.jms.JndiXAConnectionFactory " >
<!-- < property name = " className " value = " com.ibm.mq.jms.MQXAQueueConnectionFactory " />-->
<!-- < property name = " uniqueName " value = " MQSeries " />-->
<!-- < property name = " poolSize " value = " 2 " />-->
< property name = " name " value = " JMSDEMOCF " ></ property >
< property name = " initialContextFactory " value = " com.sun.jndi.fscontext.RefFSContextFactory " ></ property >
< property name = " providerUrl " value = " file:/C:/JMSDEMO/JNDI/mes " ></ property >
</ bean >
< bean id = " des "
class = " org.springframework.jndi.JndiObjectFactoryBean " >
< property name = " jndiTemplate " >
< ref local = " jndiTemplate " />
</ property >
< property name = " resourceRef " >
< value > false </ value >
</ property >
< property name = " jndiName " >
< value > JMSDEMOQueue </ value >
</ property >
</ bean >
< bean id = " connectionFactory "
class = " org.springframework.jms.connection.SingleConnectionFactory " >
< property name = " targetConnectionFactory " >
< ref bean = " ConnectionFactoryBean " />
</ property >
</ bean >
<!--< bean id = " ConnectionFactory " factory - bean = " ConnectionFactoryBean " factory - method = " createXAConnection " />-->
< bean id = " BitronixTransactionManager " factory - method = " getTransactionManager "
class = " bitronix.tm.TransactionManagerServices " depends - on = " btmConfig,connectionFactory " destroy - method = " shutdown " />
< bean id = " transactionManager " class = " org.springframework.transaction.jta.JtaTransactionManager " >
< property name = " transactionManager " ref = " BitronixTransactionManager " />
< property name = " userTransaction " ref = " BitronixTransactionManager " />
</ bean >
< bean id = " btmConfig " factory - method = " getConfiguration " class = " bitronix.tm.TransactionManagerServices " >
< property name = " serverId " value = " spring-btm-consumer " />
</ bean >
< bean id = " dataSourceFactoryBean " class = " bitronix.tm.resource.jdbc.DataSourceBean " >
< property name = " className " value = " oracle.jdbc.xa.client.OracleXADataSource " />
< property name = " uniqueName " value = " oracle " />
< property name = " poolSize " value = " 2 " />
< property name = " driverProperties " >
< props >
< prop key = " user " > cdh_dev </ prop >
< prop key = " password " > cdh_dev </ prop >
< prop key = " URL " > jdbc:oracle:thin:@ 10.0 . 24.130 : 1521 :mixdb98 </ prop >
</ props >
</ property >
</ bean >
< bean id = " dataSource " factory - bean = " dataSourceFactoryBean " factory - method = " createResource " />
<!--< bean id = " atomikosConnectionFactory "
class = " com.atomikos.jms.QueueConnectionFactoryBean " init - method = " init " >
< property name = " xaQueueConnectionFactory " >
< ref bean = " queueConnectionFactory " />
</ property >
< property name = " resourceName " value = " MQSeries_XA_RMI " />
</ bean >
< bean id = " connectionFactory "
class = " org.springframework.jms.connection.SingleConnectionFactory " >
< property name = " targetConnectionFactory " >
< ref bean = " atomikosConnectionFactory " />
</ property >
</ bean >
-->
<!--< bean id = " dataSource " class = " com.atomikos.jdbc.SimpleDataSourceBean "
init - method = " init " destroy - method = " close " >
< property name = " uniqueResourceName " >
< value > oracle </ value >
</ property >
< property name = " xaDataSourceClassName " >
< value > oracle.jdbc.xa.client.OracleXADataSource </ value >
</ property >
< property name = " xaDataSourceProperties " >
< value > user = cdh_dev;password = cdh_dev;URL = jdbc:oracle:thin:@ 10.0 . 24.130 : 1521 :mixdb98 </ value >
</ property >
< property name = " exclusiveConnectionMode " >
< value > true </ value >
</ property >
< property name = " connectionPoolSize " value = " 3 " />
</ bean >
-->
<!--< bean id = " atomikosTransactionManager "
class = " com.atomikos.icatch.jta.UserTransactionManager "
init - method = " init " destroy - method = " close " >
< property name = " forceShutdown " >
< value > false </ value >
</ property >
</ bean >
< bean id = " atomikosUserTransaction "
class = " com.atomikos.icatch.jta.UserTransactionImp " >
< property name = " transactionTimeout " value = " 300 " />
</ bean >
< bean id = " transactionManager "
class = " org.springframework.transaction.jta.JtaTransactionManager " >
< property name = " transactionManager " >
< ref bean = " atomikosTransactionManager " />
</ property >
< property name = " userTransaction " >
< ref bean = " atomikosUserTransaction " />
</ property >
</ bean >
-->
< bean id = " messageDao " class = " com.sfexpress.mes_c2.dao.MessageDAO " >
< property name = " dataSource " >
< ref bean = " dataSource " />
</ property >
</ bean >
< bean id = " dataSourceNoTx "
class = " org.springframework.jdbc.datasource.DriverManagerDataSource " >
< property name = " driverClassName " >
< value > oracle.jdbc.driver.OracleDriver </ value >
</ property >
< property name = " url " >
< value > jdbc:oracle:thin:@ 10.0 . 24.130 : 1521 :mixdb98 </ value >
</ property >
< property name = " username " >
< value > cdh_dev </ value >
</ property >
< property name = " password " >
< value > cdh_dev </ value >
</ property >
</ bean >
< bean id = " updateMessageto " class = " com.sfexpress.mes_c2.dao.UpdateMessageto " >
< property name = " dataSource " ref = " dataSourceNoTx " ></ property >
</ bean >
< bean id = " converter "
class = " com.sf.framework.integration.converter.JiBXConverter " />
< bean id = " messageHandler " class = " com.sfexpress.mes_c2.message.MessageHandler " >
< property name = " process " ref = " messagetoProcess " />
< property name = " converter " ref = " converter " />
</ bean >
< bean id = " listenerContainer "
class = " org.springframework.jms.listener.DefaultMessageListenerContainer " >
< property name = " concurrentConsumers " value = " 10 " />
< property name = " connectionFactory " ref = " connectionFactory " />
< property name = " destination " ref = " des " />
< property name = " messageListener " ref = " messageHandler " />
< property name = " transactionManager " ref = " transactionManager " />
< property name = " sessionTransacted " value = " false " />
< property name = " receiveTimeout " value = " 3000 " />
< property name = " recoveryInterval " value = " 6000 " />
</ bean >
< bean id = " messagetoProcess " class = " com.sfexpress.mes_c2.service.MessageToProcess " >
< property name = " messageDao " ref = " messageDao " ></ property >
</ bean >
< bean id = " sendSms " class = " com.sfexpress.mes_c2.send.SendSms " >
< property name = " sendNumEachTime " value = " 500 " ></ property >
< property name = " resendNumLimited " value = " 5 " ></ property >
< property name = " process " ref = " messagetoProcess " ></ property >
< property name = " updateMessageto " ref = " updateMessageto " ></ property >
</ bean >
< bean id = " methodInvokingJobDetail "
class = " org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean " >
< property name = " targetObject " >
< ref bean = " sendSms " />
</ property >
< property name = " targetMethod " >
< value > sendMsg </ value >
</ property >
</ bean >
< bean id = " cronTrigger1 "
class = " org.springframework.scheduling.quartz.CronTriggerBean " >
< property name = " jobDetail " >
< ref bean = " methodInvokingJobDetail " />
</ property >
< property name = " cronExpression " >
< value > 0 / 30 * 08 - 21 * * ?</ value >
</ property >
</ bean >
< bean id = " cronTrigger2 "
class = " org.springframework.scheduling.quartz.CronTriggerBean " >
< property name = " jobDetail " >
< ref bean = " methodInvokingJobDetail " />
</ property >
< property name = " cronExpression " >
< value > 0 5 , 10 , 15 , 20 , 25 , 30 21 * * ?</ value >
</ property >
</ bean >
< bean
class = " org.springframework.scheduling.quartz.SchedulerFactoryBean " >
< property name = " triggers " >
< list >
<!-- < ref local = " cronTrigger1 " />-->
<!-- < ref local = " cronTrigger2 " />-->
<!-- < ref local = " cronTriggerMonitorMQ " />-->
</ list >
</ property >
</ bean >
<!-- 只是测试 发送消息到MQ的队列里,实际不需要 -->
< bean id = " jmsQueueConnectionFactory "
class = " org.springframework.jms.connection.SingleConnectionFactory " >
< property name = " targetConnectionFactory " >
< ref bean = " queueConnectionFactory " />
</ property >
</ bean >
< bean id = " jmsDestinationResolver "
class = " org.springframework.jms.support.destination.JndiDestinationResolver " >
< property name = " jndiTemplate " >
< ref bean = " jndiTemplate " />
</ property >
< property name = " cache " >
< value > true </ value >
</ property >
</ bean >
< bean id = " jmsQueueTemplate "
class = " org.springframework.jms.core.JmsTemplate " >
< property name = " connectionFactory " >
< ref bean = " jmsQueueConnectionFactory " />
</ property >
< property name = " destinationResolver " >
< ref bean = " jmsDestinationResolver " />
</ property >
< property name = " pubSubDomain " >
< value > false </ value >
</ property >
</ bean >
< bean id = " jmsSender " class = " com.sfexpress.mes_c2.test.SendMsgToMQ " >
< property name = " jmsTemplate " >
< ref bean = " jmsQueueTemplate " />
</ property >
< property name = " topicNames " >
< value > JMSDEMOQueue </ value >
</ property >
</ bean >
<!-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -->
< bean id = " monitorMQ "
class = " com.sfexpress.mes_c2.monitorMQ.MonitorMQ " >
< property name = " jmsTemplate " ref = " jmsQueueTemplate " ></ property >
< property name = " destinations " >
< list >
< ref local = " des " />
</ list >
</ property >
</ bean >
< bean id = " c2LogDao " class = " com.sfexpress.mes_c2.dao.C2LogDAO " >
< property name = " dataSource " ref = " dataSourceNoTx " ></ property >
</ bean >
<!-- 发邮件 -->
< bean id = " mailSender " class = " org.springframework.mail.javamail.JavaMailSenderImpl " >
< property name = " host " value = " 10.0.15.22 " /><!-- 邮件服务器地址 -->
< property name = " username " value = " 089244 " ></ property ><!-- 用户名 -->
< property name = " password " value = " 089244 " ></ property ><!-- 密码 -->
<!--< property name = " javaMailProperties " >
< props >
< prop key = " mail.smtp.auth " > true </ prop >
< prop key = " mail.smtp.timeout " > 25000 </ prop >
</ props >
</ property >
--></ bean >
< bean id = " mailMessage " class = " org.springframework.mail.SimpleMailMessage " >
< property name = " from " value = " [email protected] " /><!-- 设置发件人 -->
< property name = " subject " value = " MQ 不行了 " /><!-- 设置主题 -->
< property name = " to " ><!-- 设置收件人 -->
< list >
< value > zhongzhenyang@sf - express.com </ value >
</ list >
</ property >
</ bean >
< bean id = " monitorMqMailImpl " class = " com.sfexpress.mes_c2.monitorMQ.MonitorMqMailTextImpl " >
< property name = " mailSender " ref = " mailSender " />
< property name = " message " ref = " mailMessage " />
</ bean >
< bean id = " monitorMQService "
class = " com.sfexpress.mes_c2.monitorMQ.MonitorMQService " >
< property name = " monitor " ref = " monitorMQ " ></ property >
< property name = " mail " ref = " monitorMqMailImpl " ></ property >
< property name = " logDao " ref = " c2LogDao " ></ property >
</ bean >
< bean id = " jobMonitorMQ "
class = " org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean " >
< property name = " targetObject " >
< ref bean = " monitorMQService " />
</ property >
< property name = " targetMethod " >
< value > service </ value >
</ property >
</ bean >
<!-- 设置监控mq的时间间隔 -->
< bean id = " cronTriggerMonitorMQ "
class = " org.springframework.scheduling.quartz.CronTriggerBean " >
< property name = " jobDetail " >
< ref bean = " jobMonitorMQ " />
</ property >
< property name = " cronExpression " >
< value > 0 / 30 * * * * ?</ value >
</ property >
</ bean >
</ beans >
< beans xmlns = " http://www.springframework.org/schema/beans "
xmlns:xsi = " http://www.w3.org/2001/XMLSchema-instance "
xsi:schemaLocation = " http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd " >
< bean id = " jndiTemplate "
class = " org.springframework.jndi.JndiTemplate " >
< property name = " environment " >
< props >
< prop key = " java.naming.factory.initial " >
com.sun.jndi.fscontext.RefFSContextFactory
</ prop >
< prop key = " java.naming.provider.url " >
file: / C: / JMSDEMO / JNDI / mes
</ prop >
</ props >
</ property >
</ bean >
<!--< bean id = " queueConnectionFactory "
class = " org.springframework.jndi.JndiObjectFactoryBean " >
< property name = " jndiTemplate " >
< ref bean = " jndiTemplate " />
</ property >
< property name = " jndiName " >
< value > JMSDEMOCF </ value >
</ property >
</ bean >
-->
< bean id = " ConnectionFactoryBean " class = " bitronix.tm.resource.jms.JndiXAConnectionFactory " >
<!-- < property name = " className " value = " com.ibm.mq.jms.MQXAQueueConnectionFactory " />-->
<!-- < property name = " uniqueName " value = " MQSeries " />-->
<!-- < property name = " poolSize " value = " 2 " />-->
< property name = " name " value = " JMSDEMOCF " ></ property >
< property name = " initialContextFactory " value = " com.sun.jndi.fscontext.RefFSContextFactory " ></ property >
< property name = " providerUrl " value = " file:/C:/JMSDEMO/JNDI/mes " ></ property >
</ bean >
< bean id = " des "
class = " org.springframework.jndi.JndiObjectFactoryBean " >
< property name = " jndiTemplate " >
< ref local = " jndiTemplate " />
</ property >
< property name = " resourceRef " >
< value > false </ value >
</ property >
< property name = " jndiName " >
< value > JMSDEMOQueue </ value >
</ property >
</ bean >
< bean id = " connectionFactory "
class = " org.springframework.jms.connection.SingleConnectionFactory " >
< property name = " targetConnectionFactory " >
< ref bean = " ConnectionFactoryBean " />
</ property >
</ bean >
<!--< bean id = " ConnectionFactory " factory - bean = " ConnectionFactoryBean " factory - method = " createXAConnection " />-->
< bean id = " BitronixTransactionManager " factory - method = " getTransactionManager "
class = " bitronix.tm.TransactionManagerServices " depends - on = " btmConfig,connectionFactory " destroy - method = " shutdown " />
< bean id = " transactionManager " class = " org.springframework.transaction.jta.JtaTransactionManager " >
< property name = " transactionManager " ref = " BitronixTransactionManager " />
< property name = " userTransaction " ref = " BitronixTransactionManager " />
</ bean >
< bean id = " btmConfig " factory - method = " getConfiguration " class = " bitronix.tm.TransactionManagerServices " >
< property name = " serverId " value = " spring-btm-consumer " />
</ bean >
< bean id = " dataSourceFactoryBean " class = " bitronix.tm.resource.jdbc.DataSourceBean " >
< property name = " className " value = " oracle.jdbc.xa.client.OracleXADataSource " />
< property name = " uniqueName " value = " oracle " />
< property name = " poolSize " value = " 2 " />
< property name = " driverProperties " >
< props >
< prop key = " user " > cdh_dev </ prop >
< prop key = " password " > cdh_dev </ prop >
< prop key = " URL " > jdbc:oracle:thin:@ 10.0 . 24.130 : 1521 :mixdb98 </ prop >
</ props >
</ property >
</ bean >
< bean id = " dataSource " factory - bean = " dataSourceFactoryBean " factory - method = " createResource " />
<!--< bean id = " atomikosConnectionFactory "
class = " com.atomikos.jms.QueueConnectionFactoryBean " init - method = " init " >
< property name = " xaQueueConnectionFactory " >
< ref bean = " queueConnectionFactory " />
</ property >
< property name = " resourceName " value = " MQSeries_XA_RMI " />
</ bean >
< bean id = " connectionFactory "
class = " org.springframework.jms.connection.SingleConnectionFactory " >
< property name = " targetConnectionFactory " >
< ref bean = " atomikosConnectionFactory " />
</ property >
</ bean >
-->
<!--< bean id = " dataSource " class = " com.atomikos.jdbc.SimpleDataSourceBean "
init - method = " init " destroy - method = " close " >
< property name = " uniqueResourceName " >
< value > oracle </ value >
</ property >
< property name = " xaDataSourceClassName " >
< value > oracle.jdbc.xa.client.OracleXADataSource </ value >
</ property >
< property name = " xaDataSourceProperties " >
< value > user = cdh_dev;password = cdh_dev;URL = jdbc:oracle:thin:@ 10.0 . 24.130 : 1521 :mixdb98 </ value >
</ property >
< property name = " exclusiveConnectionMode " >
< value > true </ value >
</ property >
< property name = " connectionPoolSize " value = " 3 " />
</ bean >
-->
<!--< bean id = " atomikosTransactionManager "
class = " com.atomikos.icatch.jta.UserTransactionManager "
init - method = " init " destroy - method = " close " >
< property name = " forceShutdown " >
< value > false </ value >
</ property >
</ bean >
< bean id = " atomikosUserTransaction "
class = " com.atomikos.icatch.jta.UserTransactionImp " >
< property name = " transactionTimeout " value = " 300 " />
</ bean >
< bean id = " transactionManager "
class = " org.springframework.transaction.jta.JtaTransactionManager " >
< property name = " transactionManager " >
< ref bean = " atomikosTransactionManager " />
</ property >
< property name = " userTransaction " >
< ref bean = " atomikosUserTransaction " />
</ property >
</ bean >
-->
< bean id = " messageDao " class = " com.sfexpress.mes_c2.dao.MessageDAO " >
< property name = " dataSource " >
< ref bean = " dataSource " />
</ property >
</ bean >
< bean id = " dataSourceNoTx "
class = " org.springframework.jdbc.datasource.DriverManagerDataSource " >
< property name = " driverClassName " >
< value > oracle.jdbc.driver.OracleDriver </ value >
</ property >
< property name = " url " >
< value > jdbc:oracle:thin:@ 10.0 . 24.130 : 1521 :mixdb98 </ value >
</ property >
< property name = " username " >
< value > cdh_dev </ value >
</ property >
< property name = " password " >
< value > cdh_dev </ value >
</ property >
</ bean >
< bean id = " updateMessageto " class = " com.sfexpress.mes_c2.dao.UpdateMessageto " >
< property name = " dataSource " ref = " dataSourceNoTx " ></ property >
</ bean >
< bean id = " converter "
class = " com.sf.framework.integration.converter.JiBXConverter " />
< bean id = " messageHandler " class = " com.sfexpress.mes_c2.message.MessageHandler " >
< property name = " process " ref = " messagetoProcess " />
< property name = " converter " ref = " converter " />
</ bean >
< bean id = " listenerContainer "
class = " org.springframework.jms.listener.DefaultMessageListenerContainer " >
< property name = " concurrentConsumers " value = " 10 " />
< property name = " connectionFactory " ref = " connectionFactory " />
< property name = " destination " ref = " des " />
< property name = " messageListener " ref = " messageHandler " />
< property name = " transactionManager " ref = " transactionManager " />
< property name = " sessionTransacted " value = " false " />
< property name = " receiveTimeout " value = " 3000 " />
< property name = " recoveryInterval " value = " 6000 " />
</ bean >
< bean id = " messagetoProcess " class = " com.sfexpress.mes_c2.service.MessageToProcess " >
< property name = " messageDao " ref = " messageDao " ></ property >
</ bean >
< bean id = " sendSms " class = " com.sfexpress.mes_c2.send.SendSms " >
< property name = " sendNumEachTime " value = " 500 " ></ property >
< property name = " resendNumLimited " value = " 5 " ></ property >
< property name = " process " ref = " messagetoProcess " ></ property >
< property name = " updateMessageto " ref = " updateMessageto " ></ property >
</ bean >
< bean id = " methodInvokingJobDetail "
class = " org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean " >
< property name = " targetObject " >
< ref bean = " sendSms " />
</ property >
< property name = " targetMethod " >
< value > sendMsg </ value >
</ property >
</ bean >
< bean id = " cronTrigger1 "
class = " org.springframework.scheduling.quartz.CronTriggerBean " >
< property name = " jobDetail " >
< ref bean = " methodInvokingJobDetail " />
</ property >
< property name = " cronExpression " >
< value > 0 / 30 * 08 - 21 * * ?</ value >
</ property >
</ bean >
< bean id = " cronTrigger2 "
class = " org.springframework.scheduling.quartz.CronTriggerBean " >
< property name = " jobDetail " >
< ref bean = " methodInvokingJobDetail " />
</ property >
< property name = " cronExpression " >
< value > 0 5 , 10 , 15 , 20 , 25 , 30 21 * * ?</ value >
</ property >
</ bean >
< bean
class = " org.springframework.scheduling.quartz.SchedulerFactoryBean " >
< property name = " triggers " >
< list >
<!-- < ref local = " cronTrigger1 " />-->
<!-- < ref local = " cronTrigger2 " />-->
<!-- < ref local = " cronTriggerMonitorMQ " />-->
</ list >
</ property >
</ bean >
<!-- 只是测试 发送消息到MQ的队列里,实际不需要 -->
< bean id = " jmsQueueConnectionFactory "
class = " org.springframework.jms.connection.SingleConnectionFactory " >
< property name = " targetConnectionFactory " >
< ref bean = " queueConnectionFactory " />
</ property >
</ bean >
< bean id = " jmsDestinationResolver "
class = " org.springframework.jms.support.destination.JndiDestinationResolver " >
< property name = " jndiTemplate " >
< ref bean = " jndiTemplate " />
</ property >
< property name = " cache " >
< value > true </ value >
</ property >
</ bean >
< bean id = " jmsQueueTemplate "
class = " org.springframework.jms.core.JmsTemplate " >
< property name = " connectionFactory " >
< ref bean = " jmsQueueConnectionFactory " />
</ property >
< property name = " destinationResolver " >
< ref bean = " jmsDestinationResolver " />
</ property >
< property name = " pubSubDomain " >
< value > false </ value >
</ property >
</ bean >
< bean id = " jmsSender " class = " com.sfexpress.mes_c2.test.SendMsgToMQ " >
< property name = " jmsTemplate " >
< ref bean = " jmsQueueTemplate " />
</ property >
< property name = " topicNames " >
< value > JMSDEMOQueue </ value >
</ property >
</ bean >
<!-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -->
< bean id = " monitorMQ "
class = " com.sfexpress.mes_c2.monitorMQ.MonitorMQ " >
< property name = " jmsTemplate " ref = " jmsQueueTemplate " ></ property >
< property name = " destinations " >
< list >
< ref local = " des " />
</ list >
</ property >
</ bean >
< bean id = " c2LogDao " class = " com.sfexpress.mes_c2.dao.C2LogDAO " >
< property name = " dataSource " ref = " dataSourceNoTx " ></ property >
</ bean >
<!-- 发邮件 -->
< bean id = " mailSender " class = " org.springframework.mail.javamail.JavaMailSenderImpl " >
< property name = " host " value = " 10.0.15.22 " /><!-- 邮件服务器地址 -->
< property name = " username " value = " 089244 " ></ property ><!-- 用户名 -->
< property name = " password " value = " 089244 " ></ property ><!-- 密码 -->
<!--< property name = " javaMailProperties " >
< props >
< prop key = " mail.smtp.auth " > true </ prop >
< prop key = " mail.smtp.timeout " > 25000 </ prop >
</ props >
</ property >
--></ bean >
< bean id = " mailMessage " class = " org.springframework.mail.SimpleMailMessage " >
< property name = " from " value = " [email protected] " /><!-- 设置发件人 -->
< property name = " subject " value = " MQ 不行了 " /><!-- 设置主题 -->
< property name = " to " ><!-- 设置收件人 -->
< list >
< value > zhongzhenyang@sf - express.com </ value >
</ list >
</ property >
</ bean >
< bean id = " monitorMqMailImpl " class = " com.sfexpress.mes_c2.monitorMQ.MonitorMqMailTextImpl " >
< property name = " mailSender " ref = " mailSender " />
< property name = " message " ref = " mailMessage " />
</ bean >
< bean id = " monitorMQService "
class = " com.sfexpress.mes_c2.monitorMQ.MonitorMQService " >
< property name = " monitor " ref = " monitorMQ " ></ property >
< property name = " mail " ref = " monitorMqMailImpl " ></ property >
< property name = " logDao " ref = " c2LogDao " ></ property >
</ bean >
< bean id = " jobMonitorMQ "
class = " org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean " >
< property name = " targetObject " >
< ref bean = " monitorMQService " />
</ property >
< property name = " targetMethod " >
< value > service </ value >
</ property >
</ bean >
<!-- 设置监控mq的时间间隔 -->
< bean id = " cronTriggerMonitorMQ "
class = " org.springframework.scheduling.quartz.CronTriggerBean " >
< property name = " jobDetail " >
< ref bean = " jobMonitorMQ " />
</ property >
< property name = " cronExpression " >
< value > 0 / 30 * * * * ?</ value >
</ property >
</ bean >
</ beans >