Kbase P50430: 4GL adapter waitForMessages blocks the AppServer startup procedure
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  18/04/2006 |
|
Status: Unverified
FACT(s) (Environment):
Progress 9.1D
SonicMQ 4.x
SYMPTOM(s):
4GL adapter waitForMessages blocks the AppServer startup procedure
CAUSE:
Expected behavior: As long as the startup procedure is listening for messages the AppServer process is in a starting state.
FIX:
Code example to be able to let the AppServer startup procedure complete when sending a JMS message with the text "exit" to the listening message handler:
/*Start of 4GL Code example for running a SonicMQ listener
as AppServer startup procedure:*/
DEFINE INPUT PARAMETER startup-data AS CHARACTER NO-UNDO.
/* Subscribes and receives a Text message. */
DEFINE VARIABLE pubsubsession AS HANDLE.
DEFINE VARIABLE consumerH AS HANDLE.
DEF VAR mtext AS CHAR.
DEF VAR vCOUNT AS INT INITIAL 0.
DEFINE VARIABLE stillWaiting AS LOGICAL INIT yes.
/* Creates a session object. */
RUN jms/pubsubsession.p PERSISTENT SET pubsubsession ("-H localhost -S 5162 ").
RUN setBrokerURL IN pubsubsession ("localhost:2506").
RUN SETUSER IN pubsubsession ("Administrator").
RUN setPassword IN pubsubsession ("Administrator").
RUN beginSession IN pubsubsession.
/* Subscribe to the GolfTopic topic. Messages are handled by the
"golfHandler" internal procedure.
*/
RUN createMessageConsumer IN pubsubsession (
THIS-PROCEDURE, /* This proc will handle it */
"golfHandler", /* name of internal procedure */
OUTPUT consumerH).
RUN subscribe IN pubsubsession ("GolfTopic", /* name of topic */
?, /* Subscription is not durable */
?, /* No message selector */
no, /* Want my own messages too */
consumerH). /* Handles the incoming messages*/
/* Start receiving messages */
RUN startReceiveMessages IN pubsubsession.
/* Wait to receive the messages. Any other IO-blocked statements can be used
for receiving messages.
*/
RUN waitForMessages IN pubsubsession ("inWait", THIS-PROCEDURE, ?).
RUN deleteSession IN pubsubsession.
PROCEDURE golfHandler:
DEFINE INPUT PARAMETER messageH AS HANDLE.
DEFINE INPUT PARAMETER msgConsumerH AS HANDLE.
DEFINE OUTPUT PARAMETER replyH AS HANDLE.
mtext = DYNAMIC-FUNCTION('getText':U IN messageH).
RUN deleteMessage IN messageH.
IF mtext = "exit" THEN stillWaiting = FALSE.
END.
FUNCTION inWait RETURNS LOGICAL.
RETURN stillWaiting .
END.