#Communicate from spawned to parent on completion

1 messages · Page 1 of 1 (latest)

real bobcat
#

What is the best way to send info/messages back to the parent actor from a spawned actor?

Thanks!!

crimson summit
# real bobcat What is the best way to send info/messages back to the parent actor from a spawn...

I'm assuming it's sendParent, although I never use it. 😁 https://stately.ai/docs/actions#send-parent-action

Actions are fire-and-forget effects. When a state machine transitions, it may execute actions. Actions occur in response to events, and are typically defined on transitions in the actions [...] property, or for any transition that exits a state in the state's exit: [...] property.

real bobcat
#

If I was specifically trying to let the parent machine know that the spawned actor has entered a final state? This seems fairly simple if using an invoked ator, but not clear with a spawned actor

frank saddle
#

you could probably use onDone.actions to sendParent

iirc getSnapshot() has an output property to get the value of the output as well

topaz raven
real bobcat
#

onDone in the child actor/machine? It looks like onDone on the parent only works if the actor is spawned, not invoked

topaz raven
real bobcat
#

in the parent onDone you mean? interesting, doesn't seem to be firing.... Would a brief code example be too much to ask for (meant seriously, not sarcastically - code samples can be a lot of work)