[Progress Communities] [Progress OpenEdge ABL] Forum Post: RE: Asynchronous UI with stateless appserver

Status
Not open for further replies.
P

Patrick Tingen

Guest
To avoid the wait-for, as mentioned in the docs, I used a temp-table. I had a situation where I needed to do some calculation for a lot of products. I used an async stateless appserver for this, along this lines (more or less pseudo-code) DEFINE TEMP-TABLE ttTodo NO-UNDO FIELD cItemNr AS CHARACTER FIELD hRequest AS HANDLE. /* Create a to-do list of all items */ FOR EACH bItem NO-LOCK: CREATE bTodo. ASSIGN bTodo.cItemNr = bItem.itemNr. END. CREATE SERVER hServer. hServer:CONNECT("-URL slater:OuterLimits64@zeus:8810/.../apsv") . /* Start all processes */ FOR EACH bTodo: RUN getItemData.p ON hServer ASYNCHRONOUS SET ttTodo.hRequest EVENT-PROCEDURE "RequestComplete" IN THIS-PROCEDURE (INPUT ttTodo.cItemNr, OUTPUT TABLE ttItemData APPEND). END. /* Wait for all processes to complete */ DO WHILE TEMP-TABLE ttTodo:HAS-RECORDS: FOR EACH bTodo: IF bTodo.hAsync:COMPLETE THEN DELETE bTodo. END. PROCESS EVENTS. END. hServer:DISCONNECT(). PROCEDURE RequestComplete: DEFINE INPUT PARAMETER TABLE FOR ttItemData. /* do some interesting stuff */ END PROCEDURE.

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