Consultor Eletrônico



Kbase P49872: How to trap for a SonicMQ Broker down situation in the smart
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   17/02/2004
Status: Unverified

GOAL:

How to trap for a SonicMQ Broker down situation in the smartConsumer object.

FIX:

If the SonicMQ Broker crashes while connected, an errorcode -5 is thrown. The smartConsumer has an internal procedure named errorHandler that is run. You must override the errorHandler procedure to trap for this errorcode and handle it accordingly.

Steps to follow.

1. Edit the master of the smartConsumer.
2. Override the errorHandler procedure.
3. Code something similar to the following.

PROCEDURE errorHandler :
/*------------------------------------------------------------------------------
Purpose: Super Override
Parameters:
Notes:
------------------------------------------------------------------------------*/

DEFINE INPUT PARAMETER phMessage AS HANDLE NO-UNDO.
DEFINE INPUT PARAMETER phMessageConsumer AS HANDLE NO-UNDO.
DEFINE OUTPUT PARAMETER phReply AS HANDLE NO-UNDO.

DEFINE VARIABLE cErrorCode AS CHARACTER NO-UNDO.
DEFINE VARIABLE cPropNames AS CHARACTER NO-UNDO.

cPropNames = DYNAMIC-FUNCTION('getPropertyNames':U IN phMessage).
IF LOOKUP("errorCode":U, cPropNames) > 0 THEN
cErrorCode = DYNAMIC-FUNCTION('getCharProperty':U IN phMessage,
INPUT 'errorCode':U).

CASE cErrorCode:
WHEN "-5":U THEN
DO:
MESSAGE "SonicMQ broker has been disconnected, quitting
application..." .
RUN stopHandler (INPUT phMessage , INPUT phMessageConsumer
,OUTPUT phReply ).
APPLY "CLOSE" TO CURRENT-WINDOW.
END.
END CASE.

END PROCEDURE.