Forum Post: Re: Asynchronous app server call, won't fires EVENT-PROCEDURE

Status
Not open for further replies.
M

mopfer

Guest
The code for disconnecting should go in the event procedure if you're going to disconnect after the call is done. Because the call is asynchronous, the client won't wait for it to finish before executing the next line of code in the client program. In this case, the next line of client code is disconnecting from the appserver immediately after calling the .p. The connection is the path back to the client from the appserver when the .p is done running - without the connection the event that the event procedure is waiting for will never happen. Disconnecting while the .p is running will also cause the .p to be interrupted. From: Frank Meulblok bounce-fmeulblo@community.progress.com Sent: Monday, March 9, 2015 5:21 AM To: TU.OE.Development@community.progress.com Subject: RE: [Technical Users - OE Development] Asynchronous app server call, won't fires EVENT-PROCEDURE RE: Asynchronous app server call, won't fires EVENT-PROCEDURE Reply by Frank Meulblok One thing that does stand out: in this part of the code you're disconnecting the AppServer without checking if the async requests completed or not. ... CREATE SERVER hServer. hServer:CONNECT("-H myservre.com -DirectConnect -S 3090 -AppService schAS1 -sessionModel Session-free"). IF tASync THEN DO: RUN test.p ON SERVER hServer ASYNCHRONOUS SET hAsync EVENT-PROCEDURE "AsyncProcessor" IN this-procedure (rtipo, fEcho, fPausa, OUTPUT pStatus ) . END. ELSE DO: ... END. hServer:DISCONNECT (). DELETE OBJECT hServer. That's not a good idea. Try moving the code that connects to and disconnect from the appserver outside of that trigger block, and into a wider scope - I don't see any reason not to persist the connection in between requests in this case. Stop receiving emails on this subject. Flag this post as spam/abuse.

Continue reading...
 
Status
Not open for further replies.
Top