Permalink
Please sign in to comment.
Showing
with
128 additions
and 0 deletions.
- +4 −0 .gitignore
- +21 −0 LICENSE.md
- +37 −0 Makefile
- +18 −0 README.md
- 0 include/.gitignore
- +5 −0 rebar.config
- +26 −0 src/rabbit_exchange_type_global_fanout.erl
- +7 −0 src/rabbit_global_fanout_plugin.erl
- +10 −0 src/rabbitmq_global_fanout_exchange.app.src
@@ -0,0 +1,4 @@ | ||
+.DS_Store | ||
+deps | ||
+dist | ||
+ebin |
21
LICENSE.md
@@ -0,0 +1,21 @@ | ||
+The MIT License | ||
+ | ||
+Copyright (c) 2011 Alvaro Videla | ||
+ | ||
+Permission is hereby granted, free of charge, to any person obtaining a copy | ||
+of this software and associated documentation files (the "Software"), to deal | ||
+in the Software without restriction, including without limitation the rights | ||
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
+copies of the Software, and to permit persons to whom the Software is | ||
+furnished to do so, subject to the following conditions: | ||
+ | ||
+The above copyright notice and this permission notice shall be included in | ||
+all copies or substantial portions of the Software. | ||
+ | ||
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
+THE SOFTWARE. |
37
Makefile
@@ -0,0 +1,37 @@ | ||
+PACKAGE=global-fanout-exchange | ||
+DIST_DIR=dist | ||
+EBIN_DIR=ebin | ||
+INCLUDE_DIRS=include | ||
+DEPS_DIR=deps | ||
+DEPS ?= | ||
+DEPS_EZ=$(foreach DEP, $(DEPS), $(DEPS_DIR)/$(DEP).ez) | ||
+RABBITMQ_HOME ?= . | ||
+ | ||
+all: compile | ||
+ | ||
+clean: | ||
+ rm -rf $(DIST_DIR) | ||
+ rm -rf $(EBIN_DIR) | ||
+ | ||
+distclean: clean | ||
+ rm -rf $(DEPS_DIR) | ||
+ | ||
+package: compile $(DEPS_EZ) | ||
+ rm -f $(DIST_DIR)/$(PACKAGE).ez | ||
+ mkdir -p $(DIST_DIR)/$(PACKAGE) | ||
+ cp -r $(EBIN_DIR) $(DIST_DIR)/$(PACKAGE) | ||
+ $(foreach EXTRA_DIR, $(INCLUDE_DIRS), cp -r $(EXTRA_DIR) $(DIST_DIR)/$(PACKAGE);) | ||
+ (cd $(DIST_DIR); zip -r $(PACKAGE).ez $(PACKAGE)) | ||
+ | ||
+install: package | ||
+ $(foreach DEP, $(DEPS_EZ), cp $(DEP) $(RABBITMQ_HOME)/plugins;) | ||
+ cp $(DIST_DIR)/$(PACKAGE).ez $(RABBITMQ_HOME)/plugins | ||
+ | ||
+$(DEPS_DIR): | ||
+ ./rebar get-deps | ||
+ | ||
+$(DEPS_EZ): | ||
+ cd $(DEPS_DIR); $(foreach DEP, $(DEPS), zip -r $(DEP).ez $(DEP);) | ||
+ | ||
+compile: $(DEPS_DIR) | ||
+ rebar compile |
18
README.md
@@ -0,0 +1,18 @@ | ||
+# RabbitMQ Global Fanout Exchange # | ||
+ | ||
+Fanouts a message to **every queue in the broker** no matter the bindings. Created upon request from [@michaelklishin](http://twitter.com/#!/michaelklishin) during a fun chat at #rabbitmq on Freenode. | ||
+ | ||
+**Use with care!** It was deveoped in under 30 minutes. | ||
+ | ||
+Exchange Type: `x-global-fanout` | ||
+ | ||
+## Installation ## | ||
+ | ||
+ git clone git://github.com/videlalvaro/rabbitmq-global-fanout-exchange.git | ||
+ cd rabbitmq-global-fanout-exchange | ||
+ make package | ||
+ cp dist/*.ez $RABBITMQ_HOME/plugins | ||
+ | ||
+## License ## | ||
+ | ||
+See LICENSE.md |
No changes.
@@ -0,0 +1,5 @@ | ||
+{ | ||
+ deps, [ | ||
+ {rabbit_common, ".*", {git, "https://github.com/jbrisbin/rabbit_common.git", "HEAD"}} | ||
+ ] | ||
+}. |
@@ -0,0 +1,26 @@ | ||
+-module(rabbit_exchange_type_global_fanout). | ||
+-include_lib("rabbit_common/include/rabbit.hrl"). | ||
+ | ||
+-behaviour(rabbit_exchange_type). | ||
+ | ||
+-export([description/0, route/2]). | ||
+-export([validate/1, create/2, recover/2, delete/3, | ||
+ add_binding/3, remove_bindings/3, assert_args_equivalence/2]). | ||
+ | ||
+-include_lib("rabbit_common/include/rabbit_exchange_type_spec.hrl"). | ||
+ | ||
+description() -> | ||
+ [{name, <<"global-fanout">>}, | ||
+ {description, <<"Fanouts messages to every queue in the broker.">>}]. | ||
+ | ||
+route(_, _) -> | ||
+ rabbit_router:match_routing_key('_', ['_']). | ||
+ | ||
+validate(_X) -> ok. | ||
+create(_Tx, _X) -> ok. | ||
+recover(_X, _Bs) -> ok. | ||
+delete(_Tx, _X, _Bs) -> ok. | ||
+add_binding(_Tx, _X, _B) -> ok. | ||
+remove_bindings(_Tx, _X, _Bs) -> ok. | ||
+assert_args_equivalence(X, Args) -> | ||
+ rabbit_exchange:assert_args_equivalence(X, Args). |
@@ -0,0 +1,7 @@ | ||
+-module(rabbit_global_fanout_plugin). | ||
+ | ||
+-rabbit_boot_step({?MODULE, | ||
+ [{description, "global fanout exchange type"}, | ||
+ {mfa, {rabbit_registry, register, [exchange, <<"x-global-fanout">>, rabbit_exchange_type_global_fanout]}}, | ||
+ {requires, rabbit_registry}, | ||
+ {enables, exchange_recovery}]}). |
@@ -0,0 +1,10 @@ | ||
+{application, rabbitmq_global_fanout_exchange, | ||
+ [ | ||
+ {description, "RabbitMQ Global Fanout Exchange"}, | ||
+ {vsn, "0.1.0"}, | ||
+ {modules, []}, | ||
+ {registered, []}, | ||
+ {env, []}, | ||
+ {applications, [kernel, stdlib, rabbit, mnesia]} | ||
+ ] | ||
+}. |
0 comments on commit
68ab94d