-
Hi, Is there any way a service can obtain a reference to itself from inside the service? I was going to pass it in as an event and store it on the context after the service was started but was wondering if there was a more elegant solution. I'm sure there are anti-pattern alarms ringing loudly but this solution would be ideal for my particular problem and passing the reference in as an event after the service has started feels unnecesarily janky... ideally i would like to be able to do something like....
where context.self is a reference to the service running the action and someOtherMachineReference will use the passed in reference (self.send) to send future updates. (note: for the avoidance of doubt I'm aware of onTransition) "No" is both a complete sentence and welcome reponse if correct. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
😅 No. |
Beta Was this translation helpful? Give feedback.
-
In version 5, there will be. Being able to reference actions: assign((ctx, e, { spawn, self }) => {
// `self` refers to the ActorRef instance of this machine
}) We just need to make that |
Beta Was this translation helpful? Give feedback.
😅
No.