[erlang-questions] Erlang - supervised gen_server to drain off a queue

hyperboreean <>
Sat Dec 29 08:35:35 CET 2012


Hi guys,

I'm just trying to bring Erlang into my company - it's a hard road, but
we might eventually use it for at least some of our projects. I want to
get started by changing a small piece of code that reads an AMQP queue
and appends the contents of each message to a file. To be more specific,
there are multiple producers for that queue (which produce error
messages, if any) and there's this consumer which gets the error
messages from the queue and updates a file with them. Now, this piece of
software has always been problematic for us, for one reason or another -
it's not reliable and when it fails it might bring the AMQP broker to
its knees because of the number of messages that are not consumed.

I'd like to change this code with some Erlang code - maybe with a
supervision tree so that if/when the server fails, it gets automatically
restarted. I was thinking of trying a gen_server, but then I figured out
that there's no client of the server, the code just has to constantly
pull data out of that queue.

Any good hints on how to get started on this ? What's the OTP way of
doing this kind of things?

Thank you!




More information about the erlang-questions mailing list