Actor Framework Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Scripting a reply message?

Hi Guys

Is there an easier way to script a reply message than the following? What I do today seems a bit tedious (using LabVIEW 2015).

What I do is the following:

1) Script a normal message to a method using the built in message maker

2) Change inheritance of the message to a reply message

3) Create a new VI for overwrite (Do Core)

4) Copy content of Do into Do Core.

5) Delete Do

6) Add output terminal to the send message VI and add the variant to data node with data type that match the method

Best Regards

Anders Rohde

0 Kudos
Message 1 of 4
(3,918 Views)

I'm still using LabVIEW 2014, but that's what I've been doing too.

I found myself reconsidering some of those reply messages, though not all of them, as I continued working. I didn't like where they might create bottlenecks in the program so I found other ways to do the same thing or at least to move the bottleneck to a better place.

I know from years working with X11 windowing system code that people don't like asynchronous code and so tend to make things synchronous not just before it's necessary, but also when they really should not. I was suprised to find myself doing the same.

A good API, language, or development environment makes doing the right thing easy and the rarely right thing hard, so I figure the developers at NI have left making reply messages tedious to discourage their use.

0 Kudos
Message 2 of 4
(3,412 Views)

auspex wrote:

A good API, language, or development environment makes doing the right thing easy and the rarely right thing hard, so I figure the developers at NI have left making reply messages tedious to discourage their use.

That is exactly right.  Reply messages lead to a number of problems in actor systems, including increased coupling between actors and dramatically increased risk of creating deadlocks.

That said, they have their place.  The very few use cases I've identified all involve integrating actors into synchronous systems.  They are pretty much required if you want to use actors as the back end for a LabVIEW web service, for example.

For those rare times you need them, I recommend just building them from scratch.  Create a class, inherit from Reply Message, create Do Core.vi manually, and create Send Manuually.  It's tedious, not difficult, and I suspect that hacking a standard message would take longer and be more error-prone.

0 Kudos
Message 3 of 4
(3,412 Views)

Hi Guys

Thanks for the responses. I agree that reply messages should only be used when really needed.

In my case I was communicating with actors through TestStand and here it makes it much simpler to work with reply messages in a synchronoius way since the system is synchronious anyway.

I'll use Alens method of doing them from scratch instead of modifying the regular send messages.

Thanks for the inputs.

Best Regards

Anders

0 Kudos
Message 4 of 4
(3,412 Views)