-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Discussion] Asynchronous Messaging #26
Comments
|
Request-Reply Request-Response |
I was using the two terms differently (and quite possibly poorly, but here they are): Request-Response: In response to receiving a message, I send another message, to someone that is previously specified. Request-Reply: On receiving a message I reply to the message (i.e. to the reply address attached to the incoming message). The key difference is that in the second it is the original requestor that directs where the replies go. It is entirely up to the Requestor if it blocks waiting for a reply, or provides an async notification mechanism, or even provides an “address” of a third party. |
Let me rephrase to see if I get your point correctly. A depends on B and D, B depends on C. |
A, assuming A attached its address to the message. A requests info from B (attaching its address to the message). B forwards the message (with reply address still attached) to C for handling. C replies to the message, thus sending to A. If, instead, C always responds to messages of this type by always sending something to A, then that isn’t a reply. |
OK, that's what I understood from your comment. SMOs rely generally on public events for this type of (local) replies, where A subscribes to B and C's public events through a "Get Dependencies" reference. That does require that A knows about C, which is not optimal but works fine for most use cases. Complete decoupling can only be achieved through the example you describe. The reply approach also minimizes unnecessary traffic, which can be a boon for high-throughput apps. (and no need to have both A and B handle the event) I'm curious how would you handle reply messages that need to go over the network to a different target? I'm thinking of providing an interface which would be agnostic to the transport layer (TCP, websocket, streams, Modbus, CAN, etc.). Any thoughts? BTW, I'm still unclear if that should be in the base class... |
I have a youtube video on TCP with Messenger Library. TCP is handled by two actors running in them background: “TCP Connection” and “TCP client”. They alter the Reply Addresses of the messages they pass through so that the replies are routed back via them. So if A does Request-Reply to a remote B, the actual messages pass The Reply address on the message that B receives contains the address of TCPConn, along with a token that contains the address of A, which TCPClient reads when the reply gets to it. |
I'll check this out. |
This is a thread to continue two related discussions here and here on the topic of asynchronous messaging to be supported or not in SMO base.
The text was updated successfully, but these errors were encountered: