[erlang-questions] Hidden node and topic subscription rpc's
Matthieu Tourne
matthieu.tourne@REDACTED
Thu Jan 29 04:19:24 CET 2015
Hi,
I started using py_interface as a layer to do rpc into an Erlang system,
receive and send message, and eventually provide functionality to the that
Erlang system.
One of the functions on the Erlang side would be :
handle_call({subscribe, Channel}, From, State) ->
%% Saves From as a subscriber of this channel into the State
%% When something will arrive on the Channel From will get a message.
The problem is when I'm sending an rpc:call via py_interface (a call
message on the rex mailbox essentially). It seems that the pid associated
to that rpc essentially disappears right when the rpc is completed.
As I gathered from this example [1], an alternative way to do this would be
to rewrite my handle_call this way :
handle_call({subscribe, Channel, SubscribingPid}, _From, State) ->
%% Saves SubscribingPid instead of From.
And I would pass in the Pid of an active mailbox from my py_interface
hidden node.
My question is two fold, would there be a way to keep a live Pid in the
system (maybe [2] answers this problem as a byproduct), for longer than
getting a result to that rpc call.
Or would a proper way to do this be to have a proxy process to make the
link between rpc's and a live mailbox in my hidden node.
Also, is a hidden node the best way of achieving all of this ?
Any working example of what I'm trying to achieve would be greatly
appreciated,
Thank you!
Matthieu
[1]
https://github.com/adamtornhill/tinch_pp/blob/master/test/chat_server.erl
[2] https://github.com/cloudant/rexi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150128/57d604a7/attachment.htm>
More information about the erlang-questions
mailing list