proxy? behaviour pattern implementation

chandru <>
Tue Sep 27 19:08:19 CEST 2005


Hi,

On 23/09/05, Gaspar Chilingarov <> wrote:
> hi there!
>
> I have some problems with properly implementing
> proxy pattern - i.e. I have one process which can emit messages to
> another process, and I wish to have another running process to
> retranslate them to subscribed processes.
>
> So I need to implement process which can handle registering/
> unregistering subscribers, and broadcasting messages got from another
> process.
>
> This can be implemented without any problems, but how should I handle
> crashes and restarts of receiving processes?

You can monitor the receiving processes. Checkout erlang:monitor/1

> And how emitting process
> should know and handle restarts of proxy process -- I mean how it should
> get new pid after restart?

Register a name for your proxy and you can always refer to it by name.

cheers
Chandru



More information about the erlang-questions mailing list