Re: Programming Informix 4GL: wait for event
Posted in 2009
A developer using plain Informix 4GL 7.32 wanted a program, after firing off an external web-service call via RUN, to wait (up to ~30 seconds) for another process to update a column, without resorting to a polling loop. Suggestions included an update trigger on the table, and having the trigger invoke a system call to release an external semaphore that the 4GL program sleeps on. The poster ultimately chose the simple route: a 4GL while loop that re-selects with a 1-second sleep, which also let him MESSAGE progress to the user. The rest of the thread discusses whether IBM should add event signalling with timeout to the server.
Auto-generated by DrWatson from the posts below — may be imperfect; read the full thread.
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL, Triggers, Constraints & Referential Integrity, Platform-Specific Issues
On 13 feb, 12:04, Madison Pruet <mpru...@verizon.net> wrote: > eferreyra wrote: > > Hi, i have a I4gl program that makes a RUN call and then he needs to > > wait for a field in a record to change is value, for a period of 30 > > seconds. Of course i can do a loop with a SELECT and checking the > > CURRENT value for timeout. > > > There is a better way ? > > > Restriction: is plain Informix 4GL 7.32xxx no Aubit4gl or Datablade > > Modules or other extras. > > > Thanks ! > > Why can't you create an update trigger on the table to perform the > necessary work? RUN (sync or async is irrelevant, could be any) calls a c++ program that makes a web-service call of kind fire and forget, so it returns inmediatly, while in the server an orchestation of services start doing his job, at some point of the services logic some record is updated by some service (.net libraries running in windows server 2003) then i need the Informix 4GL program continue his logic. Thanks!
eferreyra wrote: > On 13 feb, 12:04, Madison Pruet <mpru...@verizon.net> wrote: >> eferreyra wrote: >>> Hi, i have a I4gl program that makes a RUN call and then he needs to >>> wait for a field in a record to change is value, for a period of 30 >>> seconds. Of course i can do a loop with a SELECT and checking the >>> CURRENT value for timeout. >>> There is a better way ? >>> Restriction: is plain Informix 4GL 7.32xxx no Aubit4gl or Datablade >>> Modules or other extras. >>> Thanks ! >> Why can't you create an update trigger on the table to perform the >> necessary work? > > RUN (sync or async is irrelevant, could be any) calls a c++ program > that makes a web-service call of kind fire and forget, so it returns > inmediatly, while in the server an orchestation of services start > doing his job, at some point of the services logic some record is > updated by some service (.net libraries running in windows server > 2003) then i need the Informix 4GL program continue his logic. > > Thanks! OK - I suspect that the best way to do what you're trying to do is to use a semaphore outside of the server, have the 4GL sleep on the semaphore and then use an update trigger on the table to fire a system call which would unlock the semaphore.
Madison Pruet wrote: > eferreyra wrote: >> On 13 feb, 12:04, Madison Pruet <mpru...@verizon.net> wrote: >>> eferreyra wrote: >>>> Hi, i have a I4gl program that makes a RUN call and then he needs to >>>> wait for a field in a record to change is value, for a period of 30 >>>> seconds. Of course i can do a loop with a SELECT and checking the >>>> CURRENT value for timeout. >>>> There is a better way ? >>>> Restriction: is plain Informix 4GL 7.32xxx no Aubit4gl or Datablade >>>> Modules or other extras. >>>> Thanks ! >>> Why can't you create an update trigger on the table to perform the >>> necessary work? >> RUN (sync or async is irrelevant, could be any) calls a c++ program >> that makes a web-service call of kind fire and forget, so it returns >> inmediatly, while in the server an orchestation of services start >> doing his job, at some point of the services logic some record is >> updated by some service (.net libraries running in windows server >> 2003) then i need the Informix 4GL program continue his logic. >> >> Thanks! > > OK - I suspect that the best way to do what you're trying to do is to > use a semaphore outside of the server, have the 4GL sleep on the > semaphore and then use an update trigger on the table to fire a system > call which would unlock the semaphore. And I think that this functionality should be in 4GL and have thought so for 20 years. :o) -- Cheers, Obnoxio The Clown http://obotheclown.blogspot.com -- This message has been scanned for viruses and dangerous content by OpenProtect(http://www.openprotect.com), and is believed to be clean.
Thanks to all, i decide to keep it simple, stay with only 4GL and do a while loop with a sleep of 1 sec. PLUS i get a chance to DISPLAY (MESSAGE) "progress" of the wait to the end-user in each loop so its see "movement" this is very important. -- On 13 feb, 12:26, eferreyra <eferre...@gmail.com> wrote: > On 13 feb, 12:04, Madison Pruet <mpru...@verizon.net> wrote: > > > eferreyra wrote: > > > Hi, i have a I4gl program that makes a RUN call and then he needs to > > > wait for a field in a record to change is value, for a period of 30 > > > seconds. Of course i can do a loop with a SELECT and checking the > > > CURRENT value for timeout. > > > > There is a better way ? > > > > Restriction: is plain Informix 4GL 7.32xxx no Aubit4gl or Datablade > > > Modules or other extras. > > > > Thanks ! > > > Why can't you create an update trigger on the table to perform the > > necessary work? > > RUN (sync or async is irrelevant, could be any) calls a c++ program > that makes a web-service call of kind fire and forget, so it returns > inmediatly, while in the server an orchestation of services start > doing his job, at some point of the services logic some record is > updated by some service (.net libraries running in windows server > 2003) then i need the Informix 4GL program continue his logic. > > Thanks!
Obnoxio The Clown wrote: >>>> Why can't you create an update trigger on the table to perform the >>>> necessary work? >>> RUN (sync or async is irrelevant, could be any) calls a c++ program >>> that makes a web-service call of kind fire and forget, so it returns >>> inmediatly, while in the server an orchestation of services start >>> doing his job, at some point of the services logic some record is >>> updated by some service (.net libraries running in windows server >>> 2003) then i need the Informix 4GL program continue his logic. >>> >>> Thanks! >> >> OK - I suspect that the best way to do what you're trying to do is to >> use a semaphore outside of the server, have the 4GL sleep on the >> semaphore and then use an update trigger on the table to fire a system >> call which would unlock the semaphore. > > And I think that this functionality should be in 4GL and have thought so > for 20 years. :o) > I'm not sure that it belongs in 4GL because your're trying to coordinate multiple processes and 4GL is not really multi-processor/multi-threaded. However, I think that providing some form of event signaling in the server might make some sense. Maybe event signaling with a timeout... This way, the app could wait on an event and then resume processing when the event fired. Also, if this event was in the server as a built-in function, then you could use the update trigger to fire the event. I think that this makes sense and would make it easier to coordinate multiple apps which need to work together. That also, since it is event driven, it would be much more efficient than most other solutions. Care to contact us and make a request of it?
Madison Pruet wrote: > > Care to contact us and make a request of it? What's in it for me? ;o) -- Cheers, Obnoxio The Clown http://obotheclown.blogspot.com -- This message has been scanned for viruses and dangerous content by OpenProtect(http://www.openprotect.com), and is believed to be clean.
Obnoxio The Clown wrote: > Madison Pruet wrote: >> >> Care to contact us and make a request of it? > > What's in it for me? ;o) > Getting the feature implemented. If I say that we need to implement it, then I'm going to be asked "Who's wanting this". If a customer asks for something, then that's not the case.
Madison Pruet wrote: > Obnoxio The Clown wrote: >> Madison Pruet wrote: >>> Care to contact us and make a request of it? >> What's in it for me? ;o) >> > > Getting the feature implemented. If I say that we need to implement it, > then I'm going to be asked "Who's wanting this". If a customer asks for > something, then that's not the case. Tell them "Obnoxio is asking." ;o) -- Cheers, Obnoxio The Clown http://obotheclown.blogspot.com -- This message has been scanned for viruses and dangerous content by OpenProtect(http://www.openprotect.com), and is believed to be clean.