Advertisement
rfmonk

message_router.erl

Nov 29th, 2012
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Erlang 0.34 KB | None | 0 0
  1. -module(message_router).
  2.  
  3. -compile(export_all).
  4.  
  5. route_messages() ->
  6.     receive
  7.         {send_chat_msg, Addressee, MessageBody} ->
  8.             Addressee ! {recv_chat_msg, MessageBody};
  9.         {recv_chat_msg, MessageBody} ->
  10.             io:format("Received: ~p~n", [MessageBody]);
  11.         Oops ->
  12.             io:format("Warning! Received: ~p~n", [Oops])
  13.     end,
  14.     route_messages().
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement