There are no built-in mechanisms to limit the size of the message queue for a process.
A common solution to this problem in erlang is to introduce a flow control protocol between producer and consumer. It can be as simple as a sender waiting for a continue response before sending the next message. You can come up with more complex flow control protocols (windowing, ...), but often send / wait-response. The gen_server:call/2 protocol is a good request-response protocol and can be reused by looking at the code for gen_server and gen:call - it takes care of the many extreme cases that are possible.
Another approach is to pull messages through the system, rather than push them - in this case, the recipient asks the sender of the message when it is ready. Although, if you have external manufacturers that you cannot limit or limit enough, then you may not have this option.
archaelus Jan 22 '10 at 23:28 2010-01-22 23:28
source share