Hi : )
I'm learning statefun and have a question:
*How to implement the functionality of waiting for completion of multiple
asynchronous messages.*
For example, if Function A needs to send message b to multiple instances
(B1, B2, B3) of Function B after A receiving message a. Each instance of B
returns message c to A after processing message b. A can proceed only when
it receives message c from all instances of B (B1, B2, B3). How should I
handle this in statefun?
My current idea is to use a state variable in A to track the received
message list (e.g., {"B1": "not received", "B2": "received", "B3": "not
received"}). A can proceed when all values in the message list are marked
as "received". However, I'm concerned about efficiency, especially if A may
receives new messages a while waiting. Does StateFun provide support for
handling the completion of multiple asynchronous messages efficiently in
*Java*, or do you have any suggestions?
Thank you for your assistance!
Best,
Zhang