Actor Framework Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

AF Send Message And Wait For Response with Interfaces not working?

Solved!
Go to solution

I have been using AF for a couple of years and read the discussions about why sync messaing is bad. So far, I was able to design everything for async messaging.

But I have an existing AF project (with async messaging by design), but due to some hardware changes a syncronus message is needed in order to avoid a massive rewrite of the messaging between actors. It's not perfect, but sometime exceptions are needed to the rules.

 

The nested actor from which a caller actor wants a sync response is made with interfaces (for both up and down the tree, like an Actor API) and then there are multiple actors implemented using this API. Which actor runs is selectable by config.

 

The problem is that the "Send Message And Wait For Response.vi" is returning an empty variant in the Reply output which causes the Variant To Data to produce an error. I suspect it has to do with interfaces, but I am not sure what the actual problem is, because the called method is executed. There is just no data in the reply.

 

It is difficult to explain perfectly in writing (english is not my native language), so I made an example project in LV2024. Just run the main.vi and you will see the problem. The message is delivered and executed (popups as proof), but there is no reply.

 

Can someone with more knowledge than me please take a look and let me know what the problem is. Thank you in advance.

Message 1 of 10
(265 Views)
Solution
Accepted by topic author approximately_whatever

Interfaces are not the issue.

 

Two other things are:

 

First, Get Letter (sync) Msg.lvclass overrides Do.vi.  The base class Reply Message:Do handles the data return.  If you override it, you *must* handle the return itself.

 

We recommend you not override this VI.  Instead, override Do Core.vi, as intended.  (In my perfect world, we'd have a way to declare that a given child class has provided the final override of a dynamic dispatch call, but we don't have that.)

 

Second, once you remove the spurious override of Do.vi, your timeout is just 1000 ms, not enough time to see the dialog pop up and respond to it.  Your test VI was timing out before it could receive the data reply.  Up the timeout to 10,000 ms.

 

I did those two things, and everything works as expected.

Message 2 of 10
(255 Views)

Hi justACS, thank you for the very fast and helpful response.

 

Simply removing the Do.vi was the solution. It was automatically made by the AF message maker and I just left it there untouched.

 

For completion I am attaching the solution, a working example of Actor Framework Send Message And Wait For Response (in case somebody else might find this helpful).

0 Kudos
Message 3 of 10
(225 Views)

@approximately_whatever wrote:

 

Simply removing the Do.vi was the solution. It was automatically made by the AF message maker and I just left it there untouched.


So you created a standard message, and then changed its inheritance?  It never occurred to me that anyone would do that, though it's rather obvious in hindsight.  The tools weren't intended to support automated reply message creation.

Message 4 of 10
(194 Views)

Yeah, thats exactly what I did. And I assumed that the Do.vi that was placed there belongs there.

 

It's funny, but to me the way I did it seems more "natural" than creating the reply message "by hand" from scratch ... that's why the tooling is there 🙂

0 Kudos
Message 5 of 10
(190 Views)

We do tell people in the AF course that reply messages have to be hand rolled.  But only a fraction of AF users take that course, because it's expensive and infrequently offered.  And there is very little outside content on them, partly to discourage their use.

 

It's a hole in the messaging, clearly.  I'll have to think about how to address that.  In the rare instances where you need a reply message, it'd be good to have clear guidance on their implementation.

0 Kudos
Message 6 of 10
(188 Views)

There is also the small matter that the course is not available outside the US...

 

I personally learned Actor Framework from Tom's LabVIEW videos on youtube, your videos on Vimeo, by reading the forums and most of all by trial and error.

Before AF I was using Messenger Library which has some very practical solutions, but once the number of actors and messages goes up, it gets messy trying to remember message names and data type.

 

Today, for me using AF is faster and easier, but I sometimes miss the practical approach and helper functions from Messenger Library.

 

In my opinion, the perfect framework would be AF mixed with some practicality from Messenger Library and tooling/documentation from DQMH.

0 Kudos
Message 7 of 10
(184 Views)

Maybe post it as an issue here?

CLA CLED AF Guild
0 Kudos
Message 8 of 10
(176 Views)

@approximately_whatever wrote:

There is also the small matter that the course is not available outside the US...

 

It's available as Virtual Instructor-Led Training (i.e. a remote course), or at least it was as of a few years ago.  But it runs in the morning in Central Time (UTC -6), which is rough on European customers, and a nonstarter for APAC.  It's disappointing that you can't get a live course, but that's actually largely true Stateside as well.  The few in-person courses I've taught recently were at customer sites.

0 Kudos
Message 9 of 10
(174 Views)

@CaseyM wrote:

Maybe post it as an issue here?


To which "it" do you refer?

0 Kudos
Message 10 of 10
(172 Views)