This plugin adds a features exchange type to RabbitMQ. The exchange type is x-features
, much like default rabbitMQ headers exchange but with different behaviour. See question on SO.
Shortly: consumers when bind to exchange, list their features as bind arguments (for instance, f1=true
, country=US
). Arguments starting with x- are ignored (are not used for routing). Publisher should list required features to process the message in headers. At least one header is required. Like in bindings, headers starting with x- are also ignored. In order message to be routed, ALL its headers (except those start with x-) should exactly match binding arguments. Given binding may have more arguments (available features) are not listed in message headers.
Additionally is available exchange argument pick_random
which if is set to true
will choose random binding if more than one binding fits conditions (otherwise if false or ommitted message will be routed to all bindings).
Build from source:
make rabbitmq-components-mk && make dist
then copy compiled plugin from directory plugins
into rabbit plugins directory (by default is /usr/lib/rabbitmq/lib/rabbitmq_server-VERSION/plugins/
).
More details about plugin building see in RabbitMQ Plugin Development Guide.
I am not expert in erlang (this was my first experience with the plugin). I took sources from headers exchange and random exchange plugin and managed implement this one. Would be glad for help, critic and pull requests.
See LICENSE.
Serge - [email protected]