Connect and restrict more mailboxes to a specific process

Is there a way to restrict more than one mailbox to a specific process in Elixir ?

I.e. there is a mailbox named u and v that are associated to process 1, and then process 1 could choose whether to read a message from mailbox u or mailbox v.

A process has one (in numbers 1) mailbox. This is part of how a process is defined on the BEAM.

A common approach is to “tag” values and selectively receive them:

receive
  {:u, data} -> process(data)
end
2 Likes

Thanks a lot.

If you need to decouple processes and mailboxes then it’s likely the time to reach for other technologies like Kafka or ZeroMQ, or many others.