erlang - how to limit message queue or emulate it? -


I'm processing now! Message, but as I made a little mistake, a message queue size is limited to memory only. I have a tree of procedures where the cards produce messages and feed up to the root and I have to limit the queue or any other way Need to switch from

More than this, sometimes the process receives messages from one leaf and sometimes two leaves. In the second case, I need different finite queues for Eva stones.

There is no built-in mechanism to limit the message queue size for a process.

A common solution to this problem in Erling is to present a flow control protocol between the producer and the consumer, it can be as simple as the sender is waiting for a continue , Before sending the next message. You can invent more complex flow control protocol (windowing, ...), but will often send / wait-answer. The gen_server: call / 2 protocol is a good request-response protocol and can be used by looking at the code for gen_server and gen: call - This probably takes care of shore matters.

Another way is to draw a message through the system instead of pushing them - in this case the receiver asks the sender for a message when it is ready. Although your external producers are not able to rate or buffer adequately, you may not have this option.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -