LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How does the actor send a message to the invoked actor?

How do I do the operation ② in the picture, X sends a message to Y?

And,when X call two actors,for example Y and Z,how can i distinguish Y and Z when i send messages?

0 Kudos
Message 1 of 4
(2,011 Views)

I don't understand exactly what's going on in the image you posted, so I'm not sure if this is what you are asking, but do you mean:

If X launches Y and Z as nested actors, how does it send messages to each of them?

After launching each one, you have to store its enqueuer (it will be returned from the launch nested actor method) and you have to keep track of which one is Y's enqueuer and which one is Z's enqueuer yourself, I don't think there is a way to know after the fact. You could put them in a cluster and label one Y and one Z and then store that in X's private data. Then you can send a message to either one using its enqueuer.

Message 2 of 4
(1,993 Views)

How can i define the label for the Y, Z queue?Just using their names?Can you give me an example?

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

Here's an image from a VI I have as a member of an Actor that uses Launch Nested Actor to create nested actors.

These are like the Y and Z in your example.

 

Here I use Maps and Sets (and the Registration Map code from the Collections palette) from LabVIEW 2019 to store a set of enqueuers (because these are launched dynamically).

launchNested.png

 

If you don't need dynamic launching, then you could instead use something like Bundle by Name and just store the enqueuers with a specific name in the private data of the X.lvclass, as prettypwnie already described. Then, unbundle when you need to send it a message using "Send Do This.vi" or whatever.

distribute.png

Here I look in the Map for the specific data source's enqueuers, and then send the "Result" object to each of the enqueuers that are registered for that source. Again, I used the Map because I don't know ahead of time how many things might care about this specific source, given here by "Source Name".


GCentral
0 Kudos
Message 4 of 4
(1,959 Views)