I just got creative, and tryed to make the following:
made a procedure (KeepAlive.p) that posts a heartbeat for that computer (ms widows network) on the appserver. So someone on surveillance can stablish the last time a program of the system reported back. (some "phone home" behavior).
on the user program, on some recurrent point, put a
RUN func\PutHeartBeat.p ON hServer ASYNCHRONOUS SET handle2this
EVENT-PROCEDURE "GotBack" IN THIS-PROCEDURE (thiscomputer, NOW).
thinking that if for some reason the appserver is not available, the user on the program, won't stare for 2 minutes waiting his/her computer to respond.
then, later there is:
PROCEDURE GotBack:
DELETE PROCEDURE handle2this.
END PROCEDURE.
But got error 8982 (Invalid event-procedure context encountered when trying to invoke event procedure '<event-procedure-name>'. (8982)) when running it...
I guess it's beacuse the keepalive.p procedure has ended. In any case what I want is the program that calls keepalive.p to drop/send out the message,and don't worry about being received or even recorded, and keep alive to vanish graciously, as perhaps this program will call it again in very short seconds.. or perhaps some minutes.... this keepalive thing is not very tight or enforced to succed every time.
wonder if...
1) Is it too crazy, useless, doing this?
2) is this some good approach?
What Am I doing wrong?
Thanks.!!!
Sorry. I'm lost.
1. What is the relationship between KeepAlive.p and PutHeartBeat.p?
2. Why are you keeping a handle (handle2this) to PutHeartBeat.p? Do you use it somewhere?
3. If the appserver is not available, what is supposed to happen? Why wouldn't it be available? To test its availability why would you run something asynchronously?
The error 8982 means that the procedure that contains GotBack (THIS-PROCEDURE) is not running when the AppServer procedure completes. Therefore, the AVM cannot run GotBack. You don't talk about how the life of this .p is being controlled.
Sorry not to be clear... (english is not my mother lenguaje).
What I want to do is to send a signal to the appserver that this computer ir alive (doing somethihing about the app, at laeast). But want that the procedure reporting activity do it's best to inform that, but do it carelessly... if it can't do it, it doesn't care.... as the program would try to infor again in few seconds or minutes...
So I imagine this....
Program A is doing something... (that the user commanded) and at finishing it or whatever (to enter another program, or exiting this program, or any other event) it calls keepalive.p, and don't need to wait for it a long time, and don't care if it found the appserver. I just hoped it succeded, and if it didn't, I don't care...
This is where I don't want to spend 2 minutes for it to return in case there is no link to appserver. So i call keepalive.p, which collects some info and then in turn it calls putheartbeat.p on appserver and let it run for whatever amount of time it needed so, after calling this putheartbeat.p I immediatelly return, and forget about it is running on appserver... As its sole misión on life of this procedure is to update a record on heartbeat table with the process in turn and the NOW value.
Trying to explaing it, I figured aout why it won't worked on testing run.... The keepalive.p procedure is the one doing the connection to appserver and it is the one waiting 2 minutes in case the appserver is out..
So my problem is trying to make a asynchronous call to a local procedure, and forget about it, to keep doing the stuff the user needs...
But that is not available, dindn't? I wan to run a local procedure to it's best intent.... and if it won't makes its purpose, don't care, and don't want to wait for it to inform me about it's result....
So my question is about to asynchronously call a local procedure....
I'll change the calling to keepalive.p to asynchronous...
Am I in good track?
Thanks a lot!!
If I understand this correctly, there are a couple of things you seem to want: threads (to do the connection/communication with the appserver asynchronously while still processing business logic) and unreliable communication to the appserver.
The AVM does not provide threading. You cannot make an asynchronous call to a local procedure. Asynchronous appserver calls require a connection to the appserver, the connection itself cannot be handled asynchronously. If you expect your appserver to be periodically unavailable, then this possibly won't work for you.
This sound like you want to send UDP messages rather than TCP messages: connectionless and unreliable. You might want to consider alternatives. OE doesn't provide UDP, so you could wrap your own with DLL calls or .NET. You'd have to handle the server side too, probably not as an appserver, but a batch client. You also want to receive a response on the client in case the message was received, in which case you'd have to periodically check for a response (and make sure you do this in the client AVM's main thread). Another alternative might be to address the appserver's unavailability, so you don't have to deal with it. This would guarantee that every async request would get a response, which contradicts one of your stated goals, although that goal was to deal with the appserver's unavailability.
I don't really understand how "killing a persistent procedure" comes into this, so I might be missing something critical.
I'll try batching out!!!
Thanks!!!
I'll report results..
PS. About the "killing a presistent procedure" nonsense, yes, it was a misinterpretation of events that I was expecting to happen, so we should ignore... Is there a way to change the title of the question so this thread helps somehow to someone in sometime??