Actor Framework Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Should Event Source Actor example be included in Actor Oriented Design training?

I have made this example some time ago and I am always teaching it as an additional lesson during the AOD training. Would anyone like to see this example be part of the standard materials? Is this an approach to communication that you find appealing? Please comment.

 

https://forums.ni.com/t5/Actor-Framework-Documents/Event-Source-Actor-Package/ta-p/3538542

 

Thanks,

Piotr Kruczkowski
Certified TestStand Architect
Certified LabVIEW Architect
0 Kudos
Message 1 of 5
(3,452 Views)

Hi Piotr,

 

I've just started to evaluate the package, so my views might change moving forward.  That said, I'd be disinclined to add this to the formal course material, for a few reasons.

 

First, I'm not sure we're ready to declare a "standard" approach to publish/subscribe, and your solution looks a bit more complex than I'd like.  For one thing, it looks like you're using wrapper message classes to help decouple publisher and subscriber, which is a bit funky, and requires custom work in every subscriber Do VI.  (Please correct me if I'm reading the code incorrectly here, or anywhere else.)  I think we need to see some more ideas in the community, and see what gels.

 

Second, the course is very full as it is.  I can manage (barely) to get all the material out in a three day session, and I know many of the other instructors leave the last lesson on the floor.  We'd have to take something out to squeeze this in.  We might do that, but we'd have to take something out to do it.  We can have that discussion, of course, but that's where we are.

 

That said, publish/subscribe is a high-demand feature, so it might be time to start getting all of our ideas together, and see what clicks with the community.


0 Kudos
Message 2 of 5
(3,430 Views)

Thanks. I find that my approach is the easiest possible approach to achieve sub/pub using zero coupling. Thee is nothing less you can do without removing features.

Piotr Kruczkowski
Certified TestStand Architect
Certified LabVIEW Architect
0 Kudos
Message 3 of 5
(3,406 Views)

@PrimaryKey wrote:

Thanks. I find that my approach is the easiest possible approach to achieve sub/pub using zero coupling. Thee is nothing less you can do without removing features.


Is the reason for the wrapper messages to allow for zero coupling in both directions, so the subscriber doesn't have to depend on a member of the publisher's library?

 

I'm currently experimenting with a different approach:

1.  Create an abstract class as normal.  Add an enqueuer to the class data.

2.  Create a write accessor for the enqueuer.  Modify the Send VI to use this enqueuer to send the message.

3.  Pull this class out of the publisher's library.

4.  Write the publisher as normal, but note that the publisher no longer needs or has access to the subscriber's enqueuer.

5.  Create children of the message class that target subscriber's methods, as normal.  Note that the scripting tools work as expected with this different abstract parent.

6.  At run time, register the subscriber with the publisher.  Subscriber writes its enqueuer to the child message, and hands off the message to the publisher.

 

Publisher does not have subscriber's enqueuer, and you have a couple of methods that you can use to set this up so that subscriber doesn't have publisher's enqueuer either.  Publisher and subscriber both depend on an abstract message class, but not on each other (equivalent to your current arrangement).  No custom work is required on the subscriber's child messages, and it would be a simple task to roll code so script the abstract parent as well.  If I were still at NI, I would pitch creating a pub/sub abstract message that included the custom work in 1 and 2, and options to let the user pick the abstract message type (standard zero coupling or pub/sub) and whether the abstract message was attached to an actor library or not.

 

I may post something after I get clear of the CLA Summit next week.

 

By the way, as I type this, I am remembering that CaseyLamers1 proposed another zero coupling pub/sub scheme not too long ago that has some features in common with your solution.  I'll point him this way, and maybe after the CLA Summit, we can start a longer dialog.

 

I like the idea of using the variant database for managing the subscriber lookup, and I could see fracturing that out as a simple LabVIEW class.  I don't think you have to flatten the enqueuers to strings, though.  Variant to Data works on classes.

0 Kudos
Message 4 of 5
(3,398 Views)

Hejka, since its quite some time after CLA summit in US do you want to continue the discussion 🙂

Piotr Kruczkowski
Certified TestStand Architect
Certified LabVIEW Architect
0 Kudos
Message 5 of 5
(3,275 Views)