Actor Framework Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

First AF project

Hi Oli,

I know that i must override Handle error but how to change it so it send error to caller. I create Error method and send error message to self or how to change Handle error that nested actor (zero coupling) send error to caller. Caller do specific behavior and report this error to display and logger actor.

You know what I mean?

0 Kudos
Message 11 of 20
(2,475 Views)

So the caller you want to notify is not identical to the Actor that has started nested actor?

0 Kudos
Message 12 of 20
(2,475 Views)

In this app is identical. Now I creating actor cylinder. Manipulator Actor nested 4x actor cylinder and manipulator has for command sequence. Manipulator send comman with direction to actor cylinder and wait on acknowledge (cylinder for exam lift is in desired position) manipulator send message Run to next cylinder Shift and etc.

I do not hnow how to send timeout error to caller. If i must use standard error way create user error and put into error cluster and after in Handle Error process user error and notifier operator show this error on display. It is one approach.

Second approach what I thinking is:

create update message cluster contain two flags Busy and Error, cylinder when running update manipulator about self state. I do not use standard error way and do not process user error in Handle Error. But if occured some error into actor Handle Error stop the actor core and I want to know why actor stopped.

0 Kudos
Message 13 of 20
(2,475 Views)

Well, if you don't want to use the error line to transmit the timeout error.... your Actor is somehow detecting there's a timeout present. In this case, just send your Timeout-Error object to the caller and keep your Actor running to wait for further commands from its caller.

Am I seeing things too simple?

Message 14 of 20
(2,475 Views)

I want to use error line and I do not know how to do it because I want to use this actor more time in the future. I must create zero-coupling actor. I know hot to create abstract message but I do not know if I must create two abstract message one for updating state (Busy/Ready) and other one for error which invoke in Handle Error if came there user error 5001 active case for this error and send message to caller, caller report this message to Logger actor.

0 Kudos
Message 15 of 20
(2,475 Views)

Ok... so this thread turns a bit more into a zero-coupling direction...

I guess, you have seen the examples in this group. They are a good way to get into this topic.

Especially if you plan to use this architecture with more complex Actors in the future, you should spend some time contemplating about a decent architecture.

What I describe below is restricted to a simple architecture using only a zc-Error Message, but can be transferred to more complex tasks as well

  1. Create an abstract message class ErrorMsg.lvclass (child of Message.lvclass)
  2. Create a child of Actor.lvclass -->ZC_Actor.lvclass
  3. Add an object of ErrorMsg.lvclass as new private data
  4. Implement a message Register_ErrorMessage.lvclass (child of Message.lvclass), which writes a ErrorMsg.lvclass object to ZC_Actor.lvclass private data
  5. Switch your Actors to inherit from ZC_Actor.lvclass
  6. For each Actor, implement a child of ErrorMsg.lvclass  (this time a concrete one featuring do.vi)

Actor A starts Actor B

Actor A sends an object its own implementation of ErrorMessage child using Register_ErrorMessage.lvclass to Actor B

Actor B sends an object of this class to Actor A on Error

et voila....

Hope I haven't forgotten anything important

This is a very rough description... and yeah.... a real brain twister to get into.

But it pays off!

Message 16 of 20
(2,475 Views)

Yes it is very simple architekture what you mention it up. I asked you before creta two abstract messeg clss one for state (Busy) and one for error? Or create one abstract message with cluster and inside will be flags (Running and Error). After I do not need two abstract class.

My question is. which way is better. Use error line or do not use error line? Because when I use error line, I must create two separate abstract class and when I do not error line I create only one abstract class with cluster it is contain information Busy and Error.

Which possibility is better for do this ??

Yes, it is a real brain twister to get into. But in the future it will very helpful and I will be working faster.

0 Kudos
Message 17 of 20
(2,475 Views)

Recommendations that I have received in the past are to avoid using the error wire for anything that isn't a true error (i.e. code will not function because of the error). It sounds like what you need to do is inform another actor of a state or warning. In that case, I would suggest not using the error line but instead following an architecture like Oli laid out.

0 Kudos
Message 18 of 20
(2,475 Views)

Why You mean standarn Error Line principle is not good? Because Error line is it for Error or not? And after is on the end of error line is Handle Error Who process user and system error and decide what actor do.

Yes I need inform another actor of a state and warning. And my question is when I inform another actor during abstract message "Update caller" and do not use standarn error line for error if occured some error I do not know what happen in actor because Handle Error stop actor. I do not why because actor do not send me information.

0 Kudos
Message 19 of 20
(2,475 Views)

You can report a nested actor's error to its caller in two ways.

1.  If you don't want the nested actor to stop, override the nested actor's Handle Error.vi.  Use the Report Error message to send that error to your caller.  Any actor can receive a Report Error message; the message simply injects the error in to the receiver's error stream.  The caller will now seem to have that error message, and you can handle it in an override of the caller's Handle Error.vi.

To send this message, use Send Error Report.vi, which is on the Actor Framework » Advanced palette.

2.  If you want to let the nested actdor stop on error, the caller will get the nested's error for free.  When an actor stops, it sends a Last Ack message to its caller; this message contains, among other things, the nested actor's final error state.  You can override the caller's Handle Last Ack Core.vi to handle this error. Last Ack also contains the final state of the *actor*, so you can get other state data as well.

The accessor VIs that let you get data out of a Last Ack message are on the actor Framework palette.

Message 20 of 20
(2,475 Views)