• 消费者


    <?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:context="http://www.springframework.org/schema/context"

    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd

    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

        <!-- 真正可以产生Connection的ConnectionFactory,由对应的 JMS服务厂商提供-->  

    <bean id="targetConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">  

        <property name="brokerURL" value="tcp://192.168.188.128:61616"/>  

    </bean>    

        <!-- Spring用于管理真正的ConnectionFactory的ConnectionFactory -->  

    <bean id="connectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">  

    <!-- 目标ConnectionFactory对应真实的可以产生JMS Connection的ConnectionFactory -->  

        <property name="targetConnectionFactory" ref="targetConnectionFactory"/>  

    </bean>  

        <!--这个是队列目的地,点对点的  文本信息-->  

    <bean id="queueTextDestination" class="org.apache.activemq.command.ActiveMQQueue">  

        <constructor-arg value="queue_text"/>  

    </bean>    

    <!-- 我的监听类 -->

    <bean id="myMessageListener" class="com.offcn.demo.MyMessageListener"></bean>

    <!-- 消息监听容器 -->

    <bean class="org.springframework.jms.listener.DefaultMessageListenerContainer">

    <property name="connectionFactory" ref="connectionFactory" />

    <property name="destination" ref="queueTextDestination" />

    <property name="messageListener" ref="myMessageListener" />

    </bean>     

    </beans>

  • 相关阅读:
    路飞学城-Python开发集训-第1章
    Python制作的射击游戏
    使用百度地图API自动获取地址和经纬度
    使用高德地图JS获取当前位置和经纬度
    thinkphp5 使用PHPExcel 导入导出
    MySQL优化
    ABAP 新语法-实例讲解
    ASP.NET Core
    ASP.NET Core
    ASP.NET Core
  • 原文地址:https://www.cnblogs.com/lijun6/p/12578095.html
Copyright © 2020-2023  润新知