[rabbitmq-discuss] Creating an auth plugin (Kerberos)

Simon Lundström simlu at su.se
Wed Nov 21 10:01:27 GMT 2012


On Thu, 2012-11-15 at 11:09:39 +0000, Simon MacMullen wrote:
> I wouldn't loop, because you know you are going to receive exactly
> two messages. Looping obscures that.

Yes, but in the future I will also receive data so let's call this a
premature optimisation ; )

> (Also your loop is not tail recursive, see
> http://www1.erlang.org/doc/reference_manual/functions.html#id74170.
> Although that's not the most important thing.)

I see and understand why tail recursion is imporant but not really
relevant in this case (since we will only go down one stack level).

As far as I can tell from the Erlang reference manual and
<http://learnyousomeerlang.com/recursion> this will make loop/1 tail
recursive?:
<https://github.com/simmel/rabbitmq-auth-backend-kerberos/commit/0b41137a656c2d456c7e415063aade76564f59dd>

> Your supervisor isn't involved - it's just there so that the
> application has something to launch. You could convert your plugin
> to a library application by removing {mod, ...} from the app
> descriptior, and remove the _app.erl, and have no supervisor.
> 
> (search for "library application" in:
> http://www.erlang.org/doc/design_principles/applications.html)
> 
> The rabbit_auth_backend is a callback, invoked by rabbit_reader, so
> it's that process's supervisor that matters.

I see! I removed the supervisor.

Many thanks!
- Simon


More information about the rabbitmq-discuss mailing list