[rabbitmq-discuss] Calls to management functions

Ben Hood 0x6e6562 at gmail.com
Mon Jul 9 16:46:12 BST 2007


> This is really an Erlang question, so perhaps we should move over to
> erlang-questions. ...
>
> Anyway, say you want to delegate all handle_call() invocations of a
> particular gen_server instance to a particular function. You'd make that
> function part of the gen_server's state, initialised as part of init(),
> and call it in handle_call(). If the process is part of a supervision
> tree then the function needs to be passed in as part of the child_spec.

Thanks for your patience Matthias, as this is actually a schoolboy
question about Erlang and a case of me not RTFM of gen_server. The
manual actually says, the init method returns the internal state of
the server which is passed to the handle_* callbacks. So I just passed
the module that implements the business logic via the supervisor to
the init method and the whole thing is *much* simpler. I'll consult
erlang-questions next time.

Ben




More information about the rabbitmq-discuss mailing list