[erlang-questions] gen_server:cast/call and {via, Module, ViaName}
T Ty
tty.erlang@REDACTED
Tue Jul 17 10:53:05 CEST 2018
Simply put what I was trying to achieve is the following: By using {via,
ViaModule, Name} I was trying to trap the cast/calls to a gen_server and
manipulate the outgoing message. If the message is "large" (based on the
message tuple structure) I can push the message via a separate TCP socket
mimicking a separation between data and command channel to avoid saturating
the disterl pipe.
In any case I'll look at a different setup.
On Mon, Jul 16, 2018 at 4:38 PM, 黃耀賢 (Yau-Hsien Huang) <
g9414002.pccu.edu.tw@REDACTED> wrote:
> gen_server:call/2 performs synchronous approach, while gen_server:cast/2,
> asynchronous approach.
>
> On Mon, Jul 16, 2018 at 11:18 PM, T Ty <tty.erlang@REDACTED> wrote:
>
>> gen:call uses erlang:send/2 after finding the pid() using the via tuple.
>>
>> Where else for gen_server:cast (line 224) it uses the ViaModule:send/2
>> function instead of erlang:send/2
>>
>>
>> On Mon, Jul 16, 2018 at 3:43 PM, Loïc Hoguin <essen@REDACTED> wrote:
>>
>>> gen_server:call/2 calls gen:call which handles the via tuple.
>>>
>>>
>>> On 07/16/2018 04:38 PM, T Ty wrote:
>>>
>>>> Hello,
>>>>
>>>> Looking a the code I notice that a gen_server:cast({via, M, N}, Msg)
>>>> would use M:send/2 but there does not seem to be a similar functionality
>>>> for gen_server:call/2.
>>>>
>>>> Was this intentional ?
>>>>
>>>> Thanks
>>>>
>>>>
>>>> _______________________________________________
>>>> erlang-questions mailing list
>>>> erlang-questions@REDACTED
>>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>>
>>>>
>>> --
>>> Loïc Hoguin
>>> https://ninenines.eu
>>>
>>
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>>
>
>
> --
>
> Best Regards.
>
> --- Y-H. H.
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180717/326eebac/attachment.htm>
More information about the erlang-questions
mailing list