code formating

Friday, October 30, 2009

Supervising Mochiweb

Mochiweb is a lightweight Erlang library for building Web servers. It takes a very elegant approach using Erlang's built in OTP.It has also an MIT license and although, the project lacks documentation, you can always look at the source code.

I have been developing a little project on Erlang and decided to use Mochiweb for it. Mochiweb has it´s on Erlang application but I didn´t want to use this. However, I still wanted to create a supervision tree and have the web server supervised. Because Mochiweb is built using OTP principles, it´s pretty easy to do this. The image below shows an approximate illustration of mine. Note that the illustration is not precise but it helps to get an idea.
When you get to code it, the key element is the supervisor. It starts the Mochiweb server and passes your callback module to the server´s initialisation call.

No comments:

Post a Comment

Programatically walk a CATIA tree in .NET

One of the most basic tasks when automating anything in CATIA, it's usually to walk the whole tree and apply some changes to objects in ...