08-22-2012 03:22 AM
I'm just getting to grasps with the Actor framework. I have implemented "similar" stuff in the past but I've approached it differently.
One thing I noticed was how easy it is to send a message to an incompatible actor core which results in a nasty run-time "to more specific class" error.
In the example project included with LV 2012, if I make the change shown below (OK, I am purposely senidng a wrong message on the given queue) I get no feedback from the IDE that an incompatible message is being sent ont he queue. I think this has to do with the Message queues being for the base actor class.
Is there no way to have the actual queues more strictly typed so that we can say that Launching Actor Beta will result in a Queue reference which is only compatible with Beta (or children) objects or does this ruin the entire concept? If possible, it would prevent the ability oto send incompatible messages completely which IMHO would be an enormous benefit.
The presentations on the Actor framework have shown huge benefits in strict typing of state machines (I'm referring to a couple of videos I've seen ont he NI website) but this element of things seems to be just a pokey as a string flatten and unflatten. Send the wrong message to the wrong receiver and >bang< run-time error.
Just thinking out loud.
Shane.
08-22-2012 03:49 AM
I've been thinking a bit more.
Should the Enqueuing and Dequeuing not actually be functions of the actor classes instead of being global? The Enqueue and Dequeue functions (Which may or may not use the standard messaging queue) will be strictly typed and thus allow for edit-time type checking on messages. Actors which have been spawned will retain a reference to the parent as a base actor class (Supporting the Ack and Stop messages) allowing child to parent signalling to remain intact. This may have issues with code copying since it would essentially mean passing an actor around instead of a messaging queue but using delegation we could perhaps only have to pass around a "part" of the actor responsible for the messaging (inherited fromt he base messager) to enable this strict typing. Basically have an actor sub-class for messaging which replaces (if an inherited message class is required) the base message handler used in the example.
Does this make any sense at all?
Shane.
08-23-2012 07:19 AM
So two days and no reply... 😞
I'm referring in essense to this part of the actor framework white paper as included with the template in LV 2012.
When a caller wants to send a message to the callee, the caller knows the type of the actor that it launched, so caller can easily choose the right type of message to send. But when an actor wants to send a message to its caller, the actor does not necessarily know what type of caller it has, so it does not know what type of message to send. Ideally, actors should be usable by many different callers. That maximizes code reuse. But making the actor truly independent of the caller requires more effort than is warranted for the situation. There are three techniques for defining messages that an actor sends to its caller
Often the callee will define an abstract Message class that it uses as the input type for Set <Type> Message.vi. Callers create their own specific child of this abstract class. This setup gives the callee a way to set data into the message through the API defined by the abstract class, and gives the message a way to deliver that data in a form the caller can consume through the various overload and extension VIs.
Would it be possible to get some examples of the three different approaches to typing of the messages? I'm aiming for the high coupling solution (with the option of slipping to option 2 through common ancestors) in order to provide the ability to detect wrong messages on wrong queues at edit time.
Shane
08-23-2012 07:36 AM - edited 08-23-2012 07:39 AM
Why dont you try posting this in Actor Framework Community so that the father of LVOOP AristosQueue could see it?
08-23-2012 02:41 PM
I did just that and got an answer already, Kudos.
10-05-2017 10:46 AM
Necroposting to link OPs mentioned post & answer in the Actor Framework forums.
https://forums.ni.com/t5/Actor-Framework-Discussions/Typing-of-actor-messages/m-p/3400216