Try OpenEdge Now
skip to main content
Messaging and ESB
Implementing Messaging : Consuming messages : Message-reception issues : OpenEdge run-time message-processing states
 
OpenEdge run-time message-processing states
An OpenEdge application receives and processes messages when it is in an I/O-blocking state. The same rules that determine when asynchronous completion procedures are fired also determine when message handlers are called. The OpenEdge application should typically use the WAIT–FOR statement or the waitForMessages procedure API session call for processing messages as well as for other events.
The waitForMessages procedure is a convenient way to write message-handling code that is independent of the environment in which the OpenEdge application is executed (GUI, CHUI, batch, AppServer, or WebSpeed). It processes all events that occur while the application is waiting, including user-interface events and asynchronous call events, and it allows the application to specify when to stop waiting.
The waitForMessages procedure takes three input parameters: a procedure handle, the name of a user-defined function in the procedure that returns a LOGICAL value, and a timeOut parameter of type INTEGER (specifying an interval in seconds). The waitForMessages procedure waits and processes events as long as: a) the user-defined function returns TRUE; and b) the interval specified by the timeOut value elapses without any messages being received.
The user-defined function is evaluated by the ABL–JMS API after the message handler is executed. Typically, the OpenEdge application should have logic for changing the return value of the function in the message handler.