11-20-2012 02:39 AM
I am looking for some info about the 'Send Message And Wait For Response' (Reply Msg). I am using AF 4.1 for LabVIEW 2011 and the help explains mainly why this type of messages should be avoided.
Thanks, Nick
Solved! Go to Solution.
11-20-2012 07:43 AM
This message is a synchronous message which means that it:
- sends the message to the receiver actor
- the actor executes the associated method and creates a return value in the form of a variant
- returns the return value
So this VI will wait for the return value of the message.
11-20-2012 07:50 AM
What sort of information are you looking for? Do you want to know how to use it, how to create one, how to debug it, ...?
11-20-2012 10:00 AM
They should avoided because they are locking the actor, since it is waiting for the response.
11-20-2012 10:54 AM
I want to know how to use it. I need to get some information back from an actor right after it was launched. It will be just one time message during the initialization phase of the program. Well, I could create my own queue, wait for reply and destroy it, but the 'wait for reply' message already exist, so I was trying to use it.
The only information I was able to find until now is in the LabVIEW Classes: The State of the Art posting. There is a 'Introduction to the Actor Framework.docx' file which mentions this type of messages, but I guess it is for some previous version of the AF. For example, the document mentions a Reply to Message method, which I cannot find at all in the Reply Msg class. I am just guessing that things changed and now we have the Do Core method instead,
Anyway, is seems that I am missing something here. Any additional info will be very helpful.
Thanks,
Nick
11-20-2012 11:47 AM
What kind of information do you need from the actor? I just ask because I am working on some add-on and message making for the Actor Framework. I have already created an add-on which launches the actors in a way that it stores it's Actor core's clone number. I use it for identifying the actors that send messages. for this purpose I use exactly the "Send Message And Wait For Response" after the actor is launched, and get back the clone number in the reply variant. So if you need it for identifying the actors I suggest you to wait for me to post this add-on. I am at the very end of it, it will be ready in approx one week.
If you need different kind of information I still can help in sharing some snapshots of my special launcher.
11-20-2012 01:00 PM
chembo wrote:
I want to know how to use it.
...
For example, the document mentions a Reply to Message method, which I cannot find at all in the Reply Msg class. I am just guessing that things changed and now we have the Do Core method instead,
Anyway, is seems that I am missing something here. Any additional info will be very helpful.
Thanks,
Nick
See a quick video here on how to create a reply message. It is not very intuitive. I believe komorbela was working on an advanced message maker to automate this process.
One valid use case of reply messages is for non-Actor to Actor communication. For Actor to Actor, it is suggested to use Async messages aka "Message.lvclass" to avoid deadlock.
Only the Do Core should be overriden by the Reply Msg. Data is returned via the variant terminal. The Do vi handles the logic of the reply message and should not be overridden. This has not changed since the original AF.
11-20-2012 02:58 PM
I want to send back to the caller, let's call it C, a reference to an user event which was generated by an actor, for example actor A. C will then launch another actor, B, and pass the user event to it. B fires from time to time an event in order to pass some small piece of data to A.
Basically I am trying to break the rules and send sporadically piece of information from one actor to another, without going through the caller C. This representation is very simplified. In real it looks a little bit different, but it seemed to me that using an event will be the easiest way to accomplish this.
11-20-2012 03:04 PM
Thanks LVB. The quick video was very good. I have it working now
Well, after all I may try to avoid it if possible, but it is always good to know how things work.
11-20-2012 03:15 PM
chembo wrote:
I want to send back to the caller, let's call it C, a reference to an user event which was generated by an actor, for example actor A. C will then launch another actor, B, and pass the user event to it. B fires from time to time an event in order to pass some small piece of data to A.
Basically I am trying to break the rules and send sporadically piece of information from one actor to another, without going through the caller C. This representation is very simplified. In real it looks a little bit different, but it seemed to me that using an event will be the easiest way to accomplish this.
You shouldn't have to break any rules to send event triggered/sporadic data. The Actor Framework is designed based upon events: state changes triggered by sending messages.
I would suggest reading this thread about "short circuiting the actor tree". What you want is the "registed listener" (named by Daklu and described by Allen). Since C launched A, you can store the Message Enqueuer in the private data of C. Before B is launched, have C bundle Actor A's Message Enqueuer into the private class data. You can then have B transmit data through standard Async messages (not user events).