[rabbitmq-discuss] Message validation plugin
Simon MacMullen
simon at rabbitmq.com
Wed Dec 4 17:52:31 GMT 2013
On 04/12/2013 16:53, Dmitry Andrianov wrote:
> Hi, guys.
> If we need to create a Ravvit plugin doing some custom message
> validation (like rejecting a message if particular header is missing or
> another header is present) - what would be the best starting point?
> Which existing plugin should we be looking at?
An exchange decorator could do that as long as "rejecting the message"
could take the form of closing the channel with an error.
A decorator gets attached to all exchanges, whereas an exchange tpye
plugin obviously only applies to exchanges of a certain type.
The only exchange decorator at the moment is
http://hg.rabbitmq.com/rabbitmq-federation/file/85a819bbc3cc/src/rabbit_federation_exchange.erl
although note that its route/2 callback doesn't get invoked as it
returns noroute from active_for/1.
You could do this with an exchange type also, delegating to the "actual"
exchnage type you want and refusing to route if whatever validation fails.
> Also, while we are there - is it possible (and is it ok) to do things
> like creation of an exchange and setting up exchange-to-exchange binding
> in auth backend plugin? If it is not - what would be the best approach
> to perform couple of these actions each time new client connects?
It's not awful; it's not what it's designed for but it would work. You
could write a plugin which subscribes to the rabbit_event handler, like
the mgmt db does, but that's async.
Cheers, Simon
> Many thanks!
> This email is for the use of the intended recipient(s) only.
> If you have received this email in error, please notify the sender
> immediately and then delete it.
> If you are not the intended recipient, you must not use, disclose or
> distribute this email without the
> author's prior permission. AlertMe.com Ltd. is not responsible for any
> personal views expressed
> in this message or any attachments that are those of the individual sender.
>
> AlertMe.com Ltd, 30 Station Road, Cambridge, CB1 2RE, UK.
> Registered in England, Company number 578 2908, VAT registration number
> GB 895 9914 42.
>
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
More information about the rabbitmq-discuss
mailing list