0

In One major difference - ZeroMQ and Erlang author mentions briefly "request as a process" idea. I'm new to Erlang and I'd like to see an example or an article how to do it.

Any resource or hint will be highly appreciated.

user2624443
  • 60
  • 1
  • 6

1 Answers1

1

I am a newbie too but to me the idea seems simple. For each request, whatever it is, spawn a new process and let it handle the request. That is all. This guy talks about that too: http://vimeo.com/19806728

So my understanding is that when you receive a request, you spawn a process by calling spawn(Module, Name, Args), or another variant of this function (see http://www.erlang.org/doc/reference_manual/processes.html) and pass the request data in the Args list. Module and Name identify a function that is executed when the process starts and that deals with the Args.

akonsu
  • 28,824
  • 33
  • 119
  • 194
  • Hmmm what you are saying can be seen in a classic erlang example of tcp server. I still think I'm missing something evident. thank you – user2624443 Aug 23 '13 at 12:52
  • what do you think you are missing? – akonsu Aug 23 '13 at 14:41
  • @akonsu Right on. For what it's worth, you almost always want to use `spawn_link/3` rather than `spawn/3`. It's a real shame when a worker process dies and you've no idea. – troutwine Aug 26 '13 at 06:33