Actor Framework Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Send Self-Address Message and Address Message?

Hi, I'm a beginner to the ActorFramework,I can't find example using  Send Self-Address Message VI and Address Message VI,who can tell me when should use these two vi。Thank you very much, I will consider any suggestions you may have。

 

yanzhanglin_0-1652341098881.png

 

0 Kudos
Message 1 of 8
(2,599 Views)

If you're getting started with AF, I would actually recommend not using them at all (at least at first). Instead, get comfortable with asynchronous messaging and the idea of announcements without shortcutting the AF message tree and I think you'll find these VIs largely unnecessary. 

 

There are always exceptions, but figure those out later once you're more comfortable with the fundamentals. 

CLA CLED AF Guild
0 Kudos
Message 2 of 8
(2,573 Views)

The self-addressed message allows you to bundle a pre-defined message with the enqueuer of the actor that will ultimately receive it.  You can then pass this bundle to another entity to send whenever it wants.  Use Address Message.vi to prepare the bundle, and Send Self Addressed Message.vi to send it.

 

Note that the data payload of the message is set when you bundle it, so the sending entity is unable to change it once it's been bundled.

 

Self Addressed Messages allow Actor A to send a message to Actor B without Actor A having to know anything about the message or its payload.  That's useful in a few corner cases.  I've used them as a replacement for abstract messages for simple triggers (messages with no data), but now that we have interfaces, I doubt I'll keep using them for that purpose.  Other folks may have found other uses for them.

0 Kudos
Message 3 of 8
(2,562 Views)

@justACS wrote:

Self Addressed Messages allow Actor A to send a message to Actor B without Actor A having to know anything about the message or its payload.  That's useful in a few corner cases.  I've used them as a replacement for abstract messages for simple triggers (messages with no data)


I used Self Addressed Messages (SAMs) exactly as you described in a recent implementation. My use case was to prompt the user with a specific message and provide two options (1 & 2). Based on the user's selection, the corresponding message would be sent.

 

Actor A is a User Interface Actor. Actor B is an abstract test sequence that needs to keep receiving messages from other Actors C (compactRIO in my case). Actor B's subclasses have different follow-up action requirements for each of Option 1 and Option 2. (Each of Actor B's subclasses is a small test sequence. In some cases, a test step required the user to perform a manual task or cancel.)

 


@justACS wrote:

, but now that we have interfaces, I doubt I'll keep using them for that purpose.


For the above, I did use interfaces to convey the user prompt message along with the SAMs. However, I do not understand how the SAMs themselves can be replaced with interfaces. Could you elaborate on this?

0 Kudos
Message 4 of 8
(2,555 Views)

@Dhakkan wrote:

For the above, I did use interfaces to convey the user prompt message along with the SAMs. However, I do not understand how the SAMs themselves can be replaced with interfaces. Could you elaborate on this

 In your use case, as designed, you probably still need SAMs.  My case is a straight-up replacement for abstract messages in the case where the message has no data.  A launches B. B will send a message to A, of an arbitrary type to be specified by A when B is launched.

0 Kudos
Message 5 of 8
(2,546 Views)

could you show me a simple example

0 Kudos
Message 6 of 8
(2,533 Views)

I don't have time to work up an example in code at the moment, but I do talk about the concept in this video (at the 41:46 mark):

 

https://vimeo.com/276563224

0 Kudos
Message 7 of 8
(2,521 Views)

thank you!

0 Kudos
Message 8 of 8
(2,495 Views)