In our previous blog post, we used direct exchange instead of fanout exchange, and this time we looked at topic exchange.First, Topic Exchange introductionTopic Exchange and direct Exchange are similar and are matched by routing key and binding key, but topic Exchange can set multiple standards for routing key.A direct router is similar to an exact query in an SQ
Today we are going to learn the last exchanger type: topic. Direct is placed in a queue in exchange bindings, and fanout is placed in all the queues in exchange bindings. Is there any part of the queue that is placed in the exchange bindings, or if multiple routing keys can be routed to a queue, then the topic type of exchange will be used.650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/7E/EA/wKi
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 mat
Rabbitmq topic exchange routes messages according to rules. Note that the topic expression used here is not a regular expression. In the Getting Started tutorial [click the link], we briefly describe how to write rules:
* (STAR) can substitute for exactly one word.
# (Hash) can substitute for zero or more words.
The above statement is easy to misunderstand.
all logs from the device "Kern":CD receivelogstopicdotnet Run "Kern. *”Or if you only want to hear information about the "critical" log:ReceiveLogsTopic.exe "*. Critical"You can create multiple bindings:CD receivelogstopicdotnet Run "Kern. * "*.critical"and issue the log using the "Routing key" "Kern.critical" type:CD emitlogtopicdotnet Run "kern.critical" "A critial Kernel Error"It's interesting to write these programs. Note that the code does not make any assumptions about the "routing key" o
Rabbitmq -- topic,I. Preface
As mentioned above, direct Exchange routing rules fully match binding key and routing key, but this strict matching method cannot meet actual business requirements in many cases. Exchange of the topic type is extended in the matching rules. It is similar to the Exchage of the direct type and routes messages to the Queue that matches t
("Testtopicexchange", "Key1.a.c.key2", "This is rabbitmq!");Topic is similar to direct, except that "mode" is supported on the match, and in the Routing_key form of "dot", two wildcard characters can be used:* Denotes a word.#表示零个或多个词.
As shown in the image above: This type of exchanger allows messages from different sources to reach a pair of columns, in fact, it is more clear that the meaning of the fuzz
RABBITMQ, messages submitted by all producers are accepted by Exchange, and exchange is forwarded to the queue for storage according to a specific policyRABBITMQ offers four types of Exchange:fanout,direct,topic,headerThe header pattern is less in practice, compared with the first three modes in this article.Performance sequencing: fanout > Direct >> topic. The r
RABBITMQ Five Message Queuing Learning (vi) – Wildcard mode (route type: Topic)
tags (space delimited): RabbitMQ
As the upgrade of a schema described in the previous article, if you need to listen to all the messages for a switch, you can bind them in the form of Message Queuing. Queue structure Diagram
Pattern matching through string wildcard for Message Queuin
RABBITMQ, messages submitted by all producers are accepted by Exchange, and exchange is forwarded to the queue for storage according to a specific policyRABBITMQ offers four types of Exchange:fanout,direct,topic,headerThe header pattern is less in practice, compared with the first three modes in this article.Performance sequencing: fanout > Direct >> topic. The r
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 sends it by the string "match", the same is t
with the specified topic in Routekey1. This mode is more complex, simply put, is that each queue has its own topic of interest, all messages with a "title" (Routekey), Exchange will forward the message to all the topics of interest can match the Routekey fuzzy queue.2. This mode requires Routekey, perhaps to bind exchange and queue in advance.3. When binding, to provide a
In the previous tutorial, we improved our logging system. We use the direct type forwarder to enable the receiver to perform selective receiving logs, rather than fanout, which can only be transmitted without the brain.
Although our system has been improved with the direct type, it still has some limitations-it cannot be routed based on multiple criteria.
In our logging system, we may be able to subscribe not only to the severity of the log, but also to the source that sent the log. You may unde
with the queue through binding in RABBITMQ so that RABBITMQ knows how to properly route messages to the specified queue. Binding Key
At the same time as binding (binding) Exchange and queue, a binding key is typically specified; When a consumer sends a message to exchange, a routing key is typically specified; When the binding key and the routing When the key matches, the message is routed to the correspon
section describes the actual examples in Exchange Types.When Binding multiple Queue to the same Exchange, these bindings allow the same binding key.Binding key does not take effect in all cases. It depends on Exchange Type. For example, fanout Type Exchange ignores binding key, instead, the message is routed to all the Queue bound to the Exchange.Exchange Types
RabbitMQ commonly uses four types of Exchange types: fanout, direct,
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.