Right now I am doing Process ! Message, but as i googled a bit, a message queue size is only limited to memory. I have a tree of processes where leaves generate messages and
The classical way of handling your second case is to include the Pid
of the sending process in the message. This is very common for erlang messages which usually have the structure similar to {SendingPid,Data}
. This allows the receiving to process both to see who sent the message and by using pattern matching within the receive
to select from which process it wishes to receive messages.
This is how erlang can multiplex messages from many different senders on one message queue and not be forced to handle all possible messages everywhere.