Actor Framework Discussions

Showing results for 
Search instead for 
Did you mean: 


Hi all, Can some brief regarding the use case and functionality of "Receive" override in actor framework...

0 Kudos
Message 1 of 21

Receive Message is called every time a message is received by an Actor.

When you call the parent method, the message is handled normally.


You can use an override to filter or adjust messages, for example like this:


Here I override Receive Message to check if the message is one of 4 different types: Last Ack, Stop, Report Error or "Stop Relauncher Msg". The first 3 are built-in to Actor Framework, and the last is a specific message for this class.


Here the Actor behaves somewhat similarly to the Linked Endpoint Actors. This actor generally forwards messages to a nested actor, but some messages (the 4 mentioned) need to be handled normally by this Actor.


If the message is a different one, then it is forwarded in the error case (taking care not to connect the error wire!)



Message 2 of 21

Here is an example project. Root Actor Recieve is overridden in order to exchange messages between parallel nested actors without need to define forwarding messages in Root Actor.

0 Kudos
Message 3 of 21

The primary use case for Receive Msg is to create network proxies for distributed actor systems. Most actors receive a message and then act on it. But network proxies say, “Actually, this actor isn’t really here, it’s across the network.”

0 Kudos
Message 4 of 21

I have tried to redirect a message to a Grandchild actor which was sent from Parent actor to Child Actor. For which, I have overrided Receive in the Child actor. But Once i have overrided it, no msgs are getting communicated from Parent to Child, but when I checked after removing the override, the messages are getting communicated. I have attached the Project zip file. Can someone guide me with the issue....

0 Kudos
Message 5 of 21

I didn't exhaustively check your project, it's not immediately clear that you have the correct set of messages to forward vs handle (in Child1, right?) but the problem is here:




You can't use Equals to compare these effectively, instead you want to know if they're the same class. To do that, use the To More Specific node and check for an error.



Note that this won't work still, because some messages are almost certainly meant to be handled by the receiving actor here, rather than being forwarded - for example Stop Msg.

However, this structure should now work in terms of filtering - you just need to check what you're filtering and what you're receiving (note you could do both, if you wanted...)


0 Kudos
Message 6 of 21

Hi cbutcher, Thanks a lot for your prompt reply. I did changes as you suggested, now Stop msg is communicated and actor specific msg is also received but the msg i need to divert is not working properly. When I send that msg, the concerned actors get abruptly stopped. I have attached the screenshot for your ref. Thanks in advance.

Download All
0 Kudos
Message 7 of 21

@mahalakshmi05 wrote:

 I did changes as you suggested

You misses the "Not".  cbutcher's code looks for any not-error; yours looks for any error (and there will always be an error)

0 Kudos
Message 8 of 21

Error code- 1

Generate User Event in Child 1.lvlib:Child 1.lvclass:Message>Child 1.lvlib:Message Child>Actor Framework.lvlib:Actor.lvclass:Receive>Child 1.lvlib:Child 1.lvclass:Receive>Actor Framework.lvlib:Actor.lvclass:Actor>Child 1.lvlib:Child 1.lvclass:Actor>Actor>Actor

Getting this error in the error out of Receive

0 Kudos
Message 9 of 21

Error will come only when "Message in" is not in the specified class, right? 

0 Kudos
Message 10 of 21