[rabbitmq-discuss] Calls to management functions
Matthias Radestock
matthias at lshift.net
Mon Jul 9 15:23:22 BST 2007
Ben,
"Ben Hood" <0x6e6562 at gmail.com> writes:
> Speaking of re-inventing the wheel, I based my RPC handler on the
> rabbit_management module, which included a fair amount of copy and
> paste. Since rabbit_management is an implementation of the gen_server
> behaviour, I was wondering if there is any merit in abstracting out
> the template callbacks (i.e. handle_management_message() and reply()
> ), so that this could be more reuseable with different (a) server
> functionality and (b) different wireformats. At the moment, this
> module can only invoke rabbitmq management calls ( point (a) ) and
> only works with JSON ( point (b) ). I don't whether you can have a
> behaviour within a behaviour or whether you can have a parameterizable
> gen_server implementation.
There two ways to do this in general:
1) make the particular gen_server implementation higher-order. In the
above case we would pass handle_management_message etc functions as
arguments on initialisation.
2) create a custom behaviour
Matthias.
More information about the rabbitmq-discuss
mailing list