`
keren
  • 浏览: 1561405 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Spring MQ配置

阅读更多
<?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at
   
    http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->

<!-- START SNIPPET: spring -->
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>

  <!-- an embedded broker -->

  <bean id="broker" class="org.apache.activemq.xbean.BrokerFactoryBean">
    <property name="config" value="classpath:org/apache/activemq/xbean/activemq.xml" />
  </bean>

  <!-- JMS ConnectionFactory to use -->
  <bean id="jmsFactory"
    class="org.apache.activemq.ActiveMQConnectionFactory">
    <property name="brokerURL" value="tcp://localhost:61636"/>
  </bean>

  <!-- Spring JMS Template -->
  <bean id="myJmsTemplate"
    class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory">
      <!-- lets wrap in a pool to avoid creating a connection per send -->
      <bean
        class="org.springframework.jms.connection.SingleConnectionFactory">
        <property name="targetConnectionFactory" ref="jmsFactory" />
      </bean>
    </property>
  </bean>
  
  <bean id="consumerJmsTemplate"
    class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory" ref="jmsFactory"/>
  </bean>

  <!-- a sample POJO which uses a Spring JmsTemplate -->
  <bean id="producer" class="org.apache.activemq.spring.SpringProducer">
    <property name="template" ref="myJmsTemplate" />
    <property name="destination" ref="destination" />
    <property name="messageCount" value="10" />
  </bean>


  <!-- a sample POJO consumer -->
  <bean id="consumer" class="org.apache.activemq.spring.SpringConsumer">
    <property name="template" ref="consumerJmsTemplate" />
    <property name="destination" ref="destination" />
  </bean>

  <bean id="destination" class="org.apache.activemq.command.ActiveMQTopic"
    autowire="constructor">
    <constructor-arg value="org.apache.activemq.spring.Test.spring.topic" />
  </bean>

</beans>

<!-- END SNIPPET: spring -->

分享到:
评论

相关推荐

    Spring 集成 IBM MQ 监听配置

    Spring 集成 IBM MQ 监听配置,包括用户管理配置和一些基础配置信息

    ActiveMQ+spring配置方案详解

    ActiveMQ spring 配置方案详解。

    spring amqp 配置实现rabbitmq 路由

    spring amqp 配置实现rabbitmq 路由

    Spring集成ActiveMQ配置

    Spring集成ActiveMQ配置

    在spring boot中使用jms集成IBM-MQ和TLQ,包含普通队列和主题订阅两种模式,并实现按需加载

    2) 使用SPRING BOOT Conditional机制实现了两种产品按需加载,工程会根据配置文件开关动态加载 3) 实现了普通队列消息发送与监听,实现了基于TOPIC的消息发布与订阅 4) IBM-MQ无需提前创建主题,TongLink需要提前...

    springboot-集成MQ

    springboot工程集成mq业务,配置及调用,便于理解,适合新手。

    详解Spring Boot 配置多个RabbitMQ

    本篇文章主要介绍了Spring Boot 配置多个RabbitMQ,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧

    RabbitMq与Spring整合实例

    RabbitMq与Spring整合实例,整个工程采用maven,具体过程看博文: http://blog.csdn.net/evankaka/article/details/50495437

    JMS_MQ系统之Spring中嵌入ActiveMQ

    JMS_MQ系统之Spring中嵌入ActiveMQ,JMS_MQ系统之Spring中嵌入ActiveMQ

    mq-jms-spring:协助MQ JMS与Spring框架集成的组件

    IBM MQ JMS Spring组件该存储库包含有助于向Spring开发人员提供IBM MQ JMS软件包的轻松配置的代码。 该库包含: 用于应用程序的mq-jms-spring-boot-starter安装及使用该软件包的编译版本可以从Maven Central自动下载...

    mq.rar springcloud整合rabbit java工程

    mq.rar springcloud对接rabbit java工程 RabbitMQ是一种消息中间件,用于处理来自客户端的异步消息。服务端将要发送的消息放入到队列池中。接收端可以根据RabbitMQ配置的转发机制接收服务端发来的消息。 RabbitMQ...

    基于springcloud+Netty+MQ+mysql的分布式即时聊天系统.zip

    本资源中的源码已经过本地编译测试,下载后按照文档配置好环境就可以运行。资源项目的难度比较适中,内容都是经过助教老师审定过的,应该能够满足学习、使用需求,如果有需要的话可以放心下载使用。有任何问题也可以...

    spring-boot示例项目

    mq-redis|[redis之mq实现,发布订阅模式](https://github.com/smltq/spring-boot-demo/blob/master/mq-redis) email|[email实现邮件发送](https://github.com/smltq/spring-boot-demo/blob/master/email) jGit|...

    springcloud入门

    springcloud-connect:数据连接中心,包含DB、Redis、MQ、Mail等组件的配置入口,只需其他模块在pom中添加依赖并提供相关配置即可快速接入。 springcloud-producer:服务提供者,包含具体的业务逻辑实现等。 spring...

    jms-spring3-ibmmq:JMS 1.0.2 与 Spring 3.2.x 和 IBM MQ

    带有 JMS 1.0.2 和 Spring 3.2.x 的 IBM MQ 使用 IBM MQ 和 Spring 3.2.x 的 JMS 1.0.2 示例配置

    spring boot 实践学习案例,与其它组件整合

    spring boot 实践学习案例,与其它组件结合如 mybatis、jpa、dubbo、redis、mongodb、memcached、kafka、... - Spring Cloud 入门,包括 Eureka(服务注册与发现)、Config(配置中心)、Hystrix(断路器)、Bus(消息总线) 等

    CXF和Spring结合的例子

    利用CXF和Spring结合搭建的SOA例子,内容包含服务端配置和一个客户端测试配置,服务器端服务配置在beans.xml中,web.xml文件需要修改;客户端测试配置地址是demo.spring.client下的client-beans.xml,测试类为...

    SpringCloud概览_终稿.docx

    Spring Cloud是一系列框架的有序集合: 利用Spring Boot的开发便利性,简化了分布式系统基础设施的... Spring Cloud Config将配置信息中央化保存。 Spring Cloud Security对Spring Security的封装,实现服务安全等。

    springCloud

    一 服务启动 此项目集成了:Feign,Spring Cloud Bus,hystrix,swagger-ui,zuul-filter,配置中心功能 1)安装rabbitMQ 2)启动cloud—eureka :此时可访问 localhost:8761 3)启动 cloud-config 此处为配置中心 ...

Global site tag (gtag.js) - Google Analytics