customer:
<?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:rabbit="http://www.springframework.org/schema/rabbit"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/rabbit http://www.springframework.org/schema/rabbit/spring-rabbit-1.3.xsd">
<bean id="rabbitConnectionFactory" class="org.springframework.amqp.rabbit.connection.CachingConnectionFactory">
<property name="username" value="${base-mq.username}" />
<property name="password" value="${base-mq.password}" />
<property name="addresses" value="${base-mq.addresses}" />
<property name="virtualHost" value="${base-mq.vhost}" />
</bean>
<rabbit:admin connection-factory="rabbitConnectionFactory" />
<rabbit:queue id="SPPARKINGVCQueue.NotifiCall" name="SPPARKINGVCQueue.NotifiCall" durable="true" auto-delete="false"/>
<!-- Rabbit MQ customer begin -->
<bean id="jsonConverterWithDefaultType" class="org.springframework.amqp.support.converter.Jackson2JsonMessageConverter">
<property name="classMapper">
<bean class="org.springframework.amqp.support.converter.DefaultClassMapper">
<property name="defaultType" value="com.zxq.iov.cloud.sp.parking.entity.TbPkInterVc"/>
</bean>
</property>
</bean>
<rabbit:listener-container connection-factory="rabbitConnectionFactory" concurrency="5" max-concurrency="10" message-converter="jsonConverterWithDefaultType">
<rabbit:listener ref="notificationServiceCallListener" method="listenInterfaceVc" queue-names="SPPARKINGVCQueue.NotifiCall" />
</rabbit:listener-container>
<bean id="notificationServiceCallListener" class="com.zxq.iov.cloud.sp.parking.mq.listener.NotificationServiceCallListener" />
</beans>
provider:
<?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:rabbit="http://www.springframework.org/schema/rabbit"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/rabbit http://www.springframework.org/schema/rabbit/spring-rabbit-1.3.xsd">
<bean id="rabbitConnectionFactory"
class="org.springframework.amqp.rabbit.connection.CachingConnectionFactory">
<property name="username" value="${base-mq.username}" />
<property name="password" value="${base-mq.password}" />
<property name="addresses" value="${base-mq.addresses}" />
<property name="virtualHost" value="${base-mq.vhost}" />
</bean>
<rabbit:admin connection-factory="rabbitConnectionFactory" />
<bean id="jsonConverterWithDefaultType"
class="org.springframework.amqp.support.converter.Jackson2JsonMessageConverter">
<property name="classMapper">
<bean class="org.springframework.amqp.support.converter.DefaultClassMapper">
<property name="defaultType"
value="com.zxq.iov.cloud.sp.parking.entity.TbPkInterVc" />
</bean>
</property>
</bean>
<rabbit:queue id="SPPARKINGVCQueue.NotifiCall" name="SPPARKINGVCQueue.NotifiCall"
durable="true" auto-delete="false" />
<!-- exchange queue binging key 绑定 -->
<rabbit:direct-exchange id="PARKING_VC_MQ_exchange"
name="PARKING_VC_MQ_exchange" durable="true" auto-delete="false">
<rabbit:bindings>
<rabbit:binding queue="SPPARKINGVCQueue.NotifiCall"
key="SPPARKINGVCQueue.NotifiCall" />
</rabbit:bindings>
</rabbit:direct-exchange>
<!-- spring template声明 -->
<rabbit:template id="spParkingVcTemp" exchange="PARKING_VC_MQ_exchange"
connection-factory="rabbitConnectionFactory" message-converter="jsonConverterWithDefaultType" />
</beans>
分享到:
相关推荐
spring boot 集成rabbit mq 成功demo,spring boot 集成rabbit mq 成功demo
本实例主要介绍如何在Spring应用中集成RabbitMQ,构建一个完整的消息传递系统。首先,你需要确保已经安装了RabbitMQ服务器,并且能够正常运行。RabbitMQ通常通过AMQP(Advanced Message Queuing Protocol)协议进行...
RabbitMQ是一个广泛使用的开源MQ服务器,而Spring框架则是一个Java领域的全功能开发框架。本文将深入探讨如何将RabbitMQ与Spring进行整合,实现一个实战项目。 首先,我们需要了解RabbitMQ的基本概念。RabbitMQ基于...
Spring框架提供了对RabbitMQ的集成,使得开发者可以方便地在Java应用中使用MQ功能。本篇文章将围绕"简单封装spring-rabbit实现mq组件化"这一主题,探讨如何通过Spring框架和RabbitMQ来构建可复用的MQ组件。 首先,...
介绍Spring Cloud Stream与RabbitMQ集成的代码示例。Spring Cloud Stream是一个建立在Spring Boot和Spring Integration之上的框架,有助于创建事件驱动或消息驱动的微服务。
**RabbitMQ与SpringMVC集成** RabbitMQ是一个开源的消息代理和队列服务器,它基于AMQP(Advanced Message Queuing Protocol)协议实现,广泛应用于分布式系统中的消息传递。RabbitMQ是由Erlang OTP平台构建的,因此...
在这个场景中,"java rabbitmq动态注册,监听实现"涉及到的主要知识点是利用Spring Boot框架与RabbitMQ集成,动态配置消费者,并实现实时监听消息。 1. **Spring Boot与RabbitMQ集成**: Spring Boot简化了...
6. **测试验证**:完成以上步骤后,进行充分的单元测试和集成测试,确保读写分离功能的正确性和性能。 通过这种方式,我们可以在不改动大量业务代码的情况下,利用Spring AOP实现MySQL的读写分离,有效地提升了系统...
spring-boot-plus集成Spring Boot 2.1.6,Mybatis,Mybatis Plus,Druid,FastJson,Redis,Rabbit MQ,Kafka等,可使用代码生成器快速开发项目
import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.beans.factory.annotation.Autowired; import org....
Spring RabbitMQ 是 Spring 框架的一部分,它提供了一种在 Java 应用程序中集成 RabbitMQ 消息代理的简单方式。RabbitMQ 是一个开源的消息队列系统,遵循 Advanced Message Queuing Protocol (AMQP) 标准,用于在...
2. spring-rabbit-1.7.5.RELEASE.jar:Spring Rabbit是Spring框架的一个模块,它提供了一种更高级别的API来简化与RabbitMQ的集成。它利用了Spring的依赖注入和配置模型,使得开发者可以方便地声明RabbitMQ组件,如...
在本文中,我们将深入探讨如何使用RabbitMQ和Spring Boot集成来实现消息队列系统,以便在Producer和Consumer之间高效地传递数据。首先,我们来理解RabbitMQ和Spring Boot的基本概念。 **RabbitMQ** 是一个开源的...
<artifactId>spring-rabbit <version>2.3.7 <groupId>com.rabbitmq</groupId> <artifactId>amqp-client <version>5.13.0 ``` 接下来,配置Spring的RabbitMQ连接。在Spring Boot的application.yml或...
对于Spring Boot应用,集成RabbitMQ变得更加简单。只需要在`pom.xml`中添加Spring Boot的RabbitMQ Starter依赖,然后在`application.properties`或`application.yml`中配置RabbitMQ服务器的连接信息。Spring Boot会...
SSM(Spring、SpringMVC、MyBatis)框架与RabbitMQ的集成是企业级应用中常见的一种技术组合,用于实现高效的消息通信。RabbitMQ是一个开源的消息代理和队列服务器,它允许应用程序之间通过异步处理进行解耦。在本...
Spring框架和Spring Boot提供了与RabbitMQ集成的便利。主要涉及以下组件: 1. **RabbitTemplate**: Spring提供的一个模板类,简化了发送和接收消息的操作。 2. **AmqpAdmin**: 用于创建、删除交换机、队列和绑定的...
Nacos 可以方便地集成到Spring Cloud框架中,为微服务提供动态配置和服务发现能力。 3. **Zipkin**:是一款流行的分布式追踪系统,用于收集微服务架构中的服务调用链数据,帮助开发者分析和优化系统的延迟问题。...
solr-rabbitmq-spring 该项目是 Rabbit MQ 和 Apache Solr 与 Spring-Data 的集成。 先决条件: 安装 RabbitMQ 3.4.4 : 这将安装 reLang 作为依赖为 Eclipse 安装 Jetty 插件将 Jetty 配置为在 8983 端口上运行并将...
import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory; import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; import org.springframework.amqp.rabbit....