Actor Framework Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Quick question on sending an enqueuer to another actor

Solved!
Go to solution

Okay, so I'm trying to do something that I thought was standard, but I've run into an issue so just want a sanity check. I assumed that I could send an enqueuer to another actor via a Send message, and that other actor would then be able to use the enqueuer. The attached JPG shows what I'm trying to do (in the red box). To elaborate, this is the Actor Core for a "CalcAirspeed" actor, and I want to send the enqueuer to a "FlightSim UI" actor. I use the Read Self Enqueuer to obtain the enqueuer and then send it using a message I created (using a standard static accessor). The problem is, when I run the code, messages I send from the FlightSim UI actor don't seem to be getting to this actor. Messages in the other direction are working though (i.e. from this actor back to FlightSim UI).

So my first question is (before I upload any code) - am I doing something invalid here?

Send Enqueuer as Message.jpg

0 Kudos
Message 1 of 23
(8,578 Views)

Can you please post the code for the Message definiton and the receiving actor?

Cheers

Oli

0 Kudos
Message 2 of 23
(4,350 Views)

Hi,

It seems like that you don't send the enqueuer to the "FlightSim UI" actor, but you send the message (apparently with no data, or with no data wire connected) to the "CalcAirspeed" actor. So you send it to the same actor that wants to send it, and with no data in it.

If you want to send a message to the "FlightSim UI" actor, you should use the enqueuer of the "FlightSim UI" as the "address" and the enqueuer of the "FlightSim UI" actor as the content of the message.

However I only guess it from the image you shared, it would be more informative to have the files shared.

0 Kudos
Message 3 of 23
(4,350 Views)

Code attached... thanks for the interest.

0 Kudos
Message 4 of 23
(4,350 Views)

Can you also post a 2013 Version? Haven't upgraded on this computer yet...

0 Kudos
Message 5 of 23
(4,350 Views)

It is as I thought. If you want  to send the enqueuer to the "FlightSim UI" actor, you should have a message for the "FlightSim UI" actor. Use an enqueuer as the input for the VI you use to create message. In that VI use that incoming enqueuer to send a message back to the Actor that sent this Enqueuer.

I hope it's clear, but if you have any questions just ask.

0 Kudos
Message 6 of 23
(4,350 Views)

Hi komorbela, I thought that's what I was doing? I still don't see what you mean....

So the situation I have is as follows:

1. An actor called "FlightSim App" launches two other actors: "FlightSim UI" and "CalcAirspeed".

2. Before "CalcAirspeed" is launched, its private data is initialized with the enqueuer of "FlightSim UI". So "CalcAirspeed" knows about the FlightSim UI actor, and can send messages to it. (I've verified that messaging works in that direction.)

3. So my problem now is - how do I let "FlightSim UI" know about "CalcAirspeed"? I thought I was doing it correctly, but you seem to be describing something different.

I could of course change how actors are launched so that FlightSim UI launches the CalAirspeed actor, and then the messaging is simpler, but this case is of more interest to me.

Edit to add: Just to generalise the question: If actors aren't created with knowledge of each other (either by initializing private data before launch or by being launched by a caller actor), what methods exist to let other actors know of your existence?

0 Kudos
Message 7 of 23
(4,350 Views)

I seem to have misunderstood you I see now that you send the correct Enqueuer. I will get back to you if I notice any other problem.

0 Kudos
Message 8 of 23
(4,350 Views)

The point is that you can not send the Enqueuer directly. You have to send a message object, which contains the enqueuer in its private data.

The Do.vi of this message class can extract the enqueuer from the message and use it elsewhere.

Regarding your last question: you have to make shure within your application, that actors how have to communicate directly also "know" each other, so you keep track in an Actor, which other Actors have to be sent messages.

Haven't seen the code yet, so this note might be out of date.

0 Kudos
Message 9 of 23
(4,350 Views)

Thanks guys. Here's the version in LV2013 as well.

0 Kudos
Message 10 of 23
(4,350 Views)