Spring Boot integrated RABBITMQ is also very handy. Now let's take a simple example to integrate RABBITMQ. Getting Started demo.Key concepts:Among the more important concepts are 4: Virtual hosts, switches, queues, and bindings.Virtual Host: A virtual host holds a set of switches, queues, and bindings. Why do you need multiple virtual hosts? Very simple,
1, first introduce the configuration file Org.springframework.amqp, as follows:Dependency> groupId>Org.springframework.amqpgroupId> Artifactid>Spring-rabbitArtifactid> version>1.7.1.RELEASEversion> Dependency>2, Preparation: Install the RABBITMQ, and add the configuration file rabbit.properties content in the project as follows:rmq.ip=192.188.113.114 Rmq.port=5672rm
1.RabbitMQ IntroductionRABBITMQ is a popular open source Message Queuing system, developed in Erlang language. RABBITMQ is the standard implementation of the AMQP (Advanced Message Queuing protocol).Official website: http://www.rabbitmq.com/2.Spring Integrated RabbitMQ2.1 maven Configuration// pom.xml2.2 RABBMITMQ configuration file//
after placing the orders.Import dependencyAdding SPRING-BOOT-STARTER-AMQP dependencies in Pom.xmlProperty configurationConfigure the RABBITMQ information in Application.yml, where the manual ACK switch is configuredSpring: rabbitmq: username:david 123456 host:localhost 5672 Virtual -host:/ listener: Simple : acknowledge-mode:manua
ProblemQuick start with spring boot SPRING-BOOT-STARTER-AMQP rabbitMq is in a hole.Not available to consumers: Correlationid or correlationidstringWhy the problem arisesCorrelationid in Spring RABBITMQ 2.0 after the byte mode will be discarded, so there are some places in th
How to install RABBITMQ under Windows. This question has been explained clearly in my last article, the students who are not clear can look at my last article.
Install and configure RABBITMQ under Windows.
Next, I'll explain how to work with spring in a Web project to use RABBITMQ.
If MAVEN works, add dependencie
The code samples in this article are written in the spring integration environment and are tested.The pom file needs to be joined by the spring integrated RABBITMQ dependency:
first, the RABBITMQ topic mode:
Graphic:
Usage scenario: The sending side does not just send a message by a fixed routing key, but instead
This article mainly records Spring boot integration rabbitmq, divided into two parts, the first part is to create a normal message queue, the second part of the delay message Queue implementation:
Spring boot provides support for AMQP-related packets for MQ Message Queuing, which can be introduced:
Property Profile Application.properties:
#
the key that corresponds to the queue in the configuration file, indicating which queue to send to. Amqptemplate.convertandsend ("guilfyyyy", Message);}}Spring.xmlMq-config.xml rabbitmqtest.java Import Org.junit.test;import Org.junit.before;import Org.springframework.context.applicationcontext;import Org.springframework.context.support.classpathxmlapplicationcontext;import Com.rabbitmq.producer.service.rabbitmqproducerservice;public class Rabbitmqtest{private RabbitMQProducerService Rab
Spring Boot Consolidation RABBITMQ (topic mode)Reproduced September 07, 2017 14:33:46 259
Introduction to 1.Topic Converter
Topic Exchange forwarding messages are based primarily on wildcard characters. Under this switch, the binding of queues and switches defines a routing pattern, and the wildcard will have to be matched between this routing mode and the routing key before the switch can forward messages.
The Fanout configuration based on the spring AMQP RABBITMQ is as follows:Publishing side /*** @Title: Mqproducerimpl.java* @Package COM.CYL.RABBITMQ* @Description: TODO (describe what the file does in a sentence)* @author [email protected]* @date April 25, 2016 1:12:46* @version V1.0*/Package COM.CYL.RABBITMQ;Import Org.springframework.amqp.core.AmqpTemplate;Import org.springframework.beans.factory.annotat
RABBITMQ Integration with Spring1. Introduction of Spring-rabbit Dependency
2. Version 4.2.8.RELEASE corresponding to spring3. Configuring the Sping-mq.xml configuration file
At this point, you can use test-template to push messages to exchange, and exchange receives messages after they are bound to the queue for message delivery.There are two types of exchange:A. Fanout type of exchange, which broadcas
The consolidates RABBITMQ in spring-boot using pure annotations, as follows
@Configuration public class Rabbitmqconfig {@Bean (value = "pmsmqconnectionfactory") public connectionfactory PmsM
Qconnectionfactory () {cachingconnectionfactory connectionfactory=new cachingconnectionfactory ();
Connectionfactory.setaddresses (pmsmqserveraddress);
Connectionfactory.setvirtualhost (Pmsmqs
: non-persisted tag (undurable), delay queue (delay), priority queue (precedence)#@ Routing Features: direct, topic, fanout, headersPlatform name used by #@: Xiangshang, Xiangqian ...#@ role: What to do?#eg: Message Queuing (queue.xiangshang.message), deferred Message Queuing (queue.delay.xiangshang.message), Normal routing (Exchange.direct.xiangshang.common), Universal routing (Exchange.direct.xiangshang.common)
integrating spring outlinesTest the
operation, but also cannot get sender feedback.TIPS:RABBITMQ is useful to the ACK mechanism, which is turned on by default. When the consumer obtains the message and then processes it correctly, it returns a confirmation message to the RABBITMQ server, which deletes the message from the queue by receiving a confirmation. And if the consumer handles the times incorrectly and does not return a confirmation message, the message will be sent again (perha
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.