spring结合activemq消息过期配置

包括queue和topic的消息过期配置。发送消息使用的spring-jms提供的JmsTemplate。

queue的配置
设置pubSubDomain为false,默认即为false。需要将explicitQosEnabled设置为true,过期时间要生效依赖它。timeToLive即为过期时间,本例中设置的是10秒过期。

topic的配置
设置pubSubDomain为true,表示是发布订阅模式。explicitQosEnabled设置为true,timeToLive设置过期时间。

spring结合ActiveMQ过期消息

完整的spring配置文件

<?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:jms="http://www.springframework.org/schema/jms"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms.xsd" >
    <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="fileEncoding" value="UTF-8" />
        <property name="locations">
            <list>
                <value>classpath:mq.properties</value>
            </list>
        </property>
    </bean>
    <bean id="connectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
        <description>JMS连接工厂</description>
        <property name="targetConnectionFactory">
            <bean class="org.apache.activemq.spring.ActiveMQConnectionFactor
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值