Multiple threads in the Actor Framework forum have discussed how to call actors from non-actor code. I thought this was relatively straightforward (if sometimes tedious), but in long conversations at the Certified LabVIEW Architect Summit in Europe 2013, I got a better sense of what type of guidance many people were looking for.* Here then are two completely different mechanisms of calling an actor tree from non-actor applications.
I hope this information makes it easier to refactor existing systems to use more actors.
* It's amazing that a couple in-person talks can communicate more than months of online posts. It's why we have these summits... get your CLA and join us next year!
Hi AQ, a comment on Integration By Ref Obj, based on my experience with similar "active objects":
I would suggest you use multiple notifiers in place of the DVR. This is because one quite often needs to wait on an updated value. For example, one might instruct the object to make a measurement, and then want to wait for the results of that measurement. Or issue a command and then wait for the acknowledgment of successful completion of the command (with an error message if the command was unsuccessful). With a DVR, there is no ability to wait on an updated value.
Another, possibly better, way to do this is with message replies, but that only works if the original actor is designed to support replies.
I was struggling with this for a while. The By Ref implementation seems so obvious, now that I see it.
James, I had a similar thought, except with the addition of queues - which I use to buffer/store streamed data. AQ's example is just a template, right? No reason notifiers or queues can't be used, as long as thought is given to deadlocks, right?
drjdpowell: Yes, what you're proposing would work, though if I needed a blocking message, I would just create some type of Reply Msg.lvclass that I can send to Shell Caller.lvclass. (Or use notifiers instead of queues in the reply message.)
As for the marshaling way:
If you want to use the new root-and-nested API, you don't have access to the enqueuer of "Useful actor", so you have to get it back in the launch via a queue, or a message with reply.
I did it with a queue, posted here (saved in LV2012): Actor Integration_Marshaling (4.3.1).zip
Do tell me if there was something smarter to do !