All Projects → rabbitmq → rabbitmq-rtopic-exchange

rabbitmq / rabbitmq-rtopic-exchange

Licence: Unknown, MPL-2.0 licenses found Licenses found Unknown LICENSE MPL-2.0 LICENSE-MPL-RabbitMQ
RabbitMQ Reverse Topic Exchange

Programming Languages

erlang
1774 projects
Makefile
30231 projects

Projects that are alternatives of or similar to rabbitmq-rtopic-exchange

rabbitmq-auth-backend-cache
Authorisation result caching plugin (backend) for RabbitMQ
Stars: ✭ 17 (-32%)
Mutual labels:  rabbitmq, plugins
Nestjs
A collection of badass modules and utilities to help you level up your NestJS applications 🚀
Stars: ✭ 475 (+1800%)
Mutual labels:  rabbitmq, plugins
slackotron
A plugin extensible Slack bot.
Stars: ✭ 13 (-48%)
Mutual labels:  rabbitmq, plugins
dinivas
AWS, GCP alternative on premise. Dinivas manage your private Cloud (OpenStack) infrastructure by providing many features based on popular Open Source projects
Stars: ✭ 15 (-40%)
Mutual labels:  rabbitmq
pan
Pan is a high performance mq proxy,support kafka,rabbit-mq,rocketmq,nsq and other mq
Stars: ✭ 27 (+8%)
Mutual labels:  rabbitmq
xiaomi-vue-store
基于Vue + SpringBoot实现的前后端分离的仿小米商城项目,包含秒杀模块。
Stars: ✭ 58 (+132%)
Mutual labels:  rabbitmq
critical-plugin
⚙️ Critical plugin for webpack (https://webpack.js.org/)
Stars: ✭ 17 (-32%)
Mutual labels:  plugins
nest-rabbit-tasks
nest-rabbit-worker is a TaskQueue based upon RabbitMQ for NestJS
Stars: ✭ 29 (+16%)
Mutual labels:  rabbitmq
microservice-email
Microservice for send emails
Stars: ✭ 25 (+0%)
Mutual labels:  rabbitmq
java-toolkit
【Released】🛠Java常用的插件API整理以及基于JDK的一些方法封装库,能在不依赖大型框架下快速进行开发(亦可快速用于测试或者脚本类代码编写 - 含数据库相关)。
Stars: ✭ 13 (-48%)
Mutual labels:  plugins
Liquid-Application-Framework
Liquid Application Framework documentation, useful links and sample project
Stars: ✭ 467 (+1768%)
Mutual labels:  rabbitmq
RDCManPlugins
Remote Desktop Connection Manager has undocumented plugin support
Stars: ✭ 25 (+0%)
Mutual labels:  plugins
dis-seckill-test
⭐⭐⭐SpringBoot+Zookeeper+Dubbo打造分布式高并发商品秒杀系统
Stars: ✭ 20 (-20%)
Mutual labels:  rabbitmq
waspy
WASP framework for Python
Stars: ✭ 43 (+72%)
Mutual labels:  rabbitmq
tacc stats
TACC Stats is an automated resource-usage monitoring and analysis package.
Stars: ✭ 36 (+44%)
Mutual labels:  rabbitmq
Haredo
Node.js library for RabbitMQ
Stars: ✭ 76 (+204%)
Mutual labels:  rabbitmq
marketplace-feedback
This repository is for feedback regarding NativeScript Marketplace. Use the issues system here to submit feature requests, vote for existing ones or report bugs.
Stars: ✭ 16 (-36%)
Mutual labels:  plugins
spring-cloud-stream-outbox-extension
Spring Cloud Stream Transactional Messaging Extension
Stars: ✭ 18 (-28%)
Mutual labels:  rabbitmq
RabbitMQDemo
🌵 基于EasyNetQ操作RabbitMQ的Demo项目
Stars: ✭ 75 (+200%)
Mutual labels:  rabbitmq
rust-ts3plugin
Rust bindings to easily create a TeamSpeak3 plugin
Stars: ✭ 13 (-48%)
Mutual labels:  plugins

RabbitMQ Reverse Topic Exchange Type

This plugin adds a reverse topic exchange type to RabbitMQ. The exchange type is x-rtopic.

The idea is to be able to specify routing patterns when publishing messages. With the default topic exchange patterns are only accepted when binding queues to exchanges.

With this plugin you can decide which queues receive the message at publishing time. With the default topic exchange the decision is made during queue binding.

With this exchange your routing keys will be words separated by dots, and the binding keys will be words separated by dots as well, with the difference that on the routing keys you can provide special characters like the # or the *. The hash # will match zero or more words. The star * will match one word.

Usage

If we have the following setup, (we assume the exchange is of type rtopic):

  • Queue A bound to exchange rtopic with routing key "server1.app1.mod1.info".
  • Queue B bound to exchange rtopic with routing key "server1.app1.mod1.error".
  • Queue C bound to exchange rtopic with routing key "server1.app2.mod1.info".
  • Queue D bound to exchange rtopic with routing key "server2.app2.mod1.warning".
  • Queue E bound to exchange rtopic with routing key "server1.app1.mod2.info".
  • Queue F bound to exchange rtopic with routing key "server2.app1.mod1.info".

Then we execute the following message publish actions.

%% Parameter order is: message, exchange name and routing key.

basic_publish(Msg, "rtopic", "server1.app1.mod1.info").
%% message is only received by queue A.

basic_publish(Msg, "rtopic", "*.app1.mod1.info").
%% message is received by queue A and F.

basic_publish(Msg, "rtopic", "#.info").
%% message is received by queue A, C, E and F.

basic_publish(Msg, "rtopic", "#.mod1.info").
%% message is received by queue A, C, and F.

basic_publish(Msg, "rtopic", "#").
%% message is received by every queue bound to the exchange.

basic_publish(Msg, "rtopic", "server1.app1.mod1.*").
%% message is received by queues A and B.

basic_publish(Msg, "rtopic", "server1.app1.#").
%% message is received by queues A, B and E.

The exchange type used when declaring an exchange is x-rtopic.

Installation and Binary Builds

This plugin is now available from the RabbitMQ community plugins page. Please consult the docs on how to install RabbitMQ plugins.

Then enable the plugin:

rabbitmq-plugins enable rabbitmq_rtopic_exchange

Building from Source

See Plugin Development guide.

TL;DR: running

make dist

will build the plugin and put build artifacts under the ./plugins directory.

Examples and Tests

To run the tests use make tests.

The test suite can also be used for code examples.

Performance

Internally the plugin uses a trie like data structure, so the following has to be taken into account when binding either queues or exchanges to it.

The following applies if you have thousands of queues. After some benchmarks I could see that performance degraded for +1000 bindings. So if you have say, 100 bindings to this exchange, then performance should be acceptable in most cases. In any case, running your own benchmarks wont hurt. The file rabbit_rtopic_perf.erl has some precarious tools to run benchmarks that I ought to document at some point.

A trie performs better when doing prefix searches than suffix searches. For example we have the following bindings:

a0.b0.c0.d0
a0.b0.c1.d0
a0.b1.c0.d0
a0.b1.c1.d0
a0.b0.c2.d1
a0.b0.c2.d0
a0.b0.c2.d1
a0.b0.c3.d0
a1.b0.c0.d0
a1.b1.c0.d0

If we publish a message with the following routing key: "a0.#", it's the same as asking "find me all the routing keys that start with "a0". After the algorithm descended on level in the trie, then it needs to visit every node in the trie. So the longer the prefix, the faster the routing will behave. That is, queries of the kind "find all string with prefix", will go faster, the longer the prefix is.

On the other hand if we publish a message with the routing key "#.d0", it's the same as asking "find me all the bindings with suffix "d0". That would be terribly slow to do with a trie, but there's a trick. If you need to use this exchange for this kind of routing, then you can build your bindings in reverse, therefore you could do a "all prefixes" query instead of a "all suffixes" query.

If you have the needs for routing "a0.#.c0.d0.#.f0.#" then again, with a small amount of binding keys it should be a problem, but keep in mind that the longer the gaps represented by the # character, the slower the algorithm will run. AFAIK there's no easy solution for this problem.

License

See LICENSE.

Copyright

(c) 2007-2022 VMware, Inc. or its affiliates.

Originally developed by Álvaro Videla.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].