Flow:-
MQInput Node Properties:-
Email Ouput Node Properties
ParseExceptionMessage:-
CREATE COMPUTE MODULE ExceptionHandling_ComputeCREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
-- CALL CopyEntireMessage();
DECLARE ptrException REFERENCE TO InputExceptionList.*[1];
DECLARE messageNumber,eText,description,Loc,flowname CHARACTER;
WHILE LASTMOVE(ptrException) DO
-- store the current values for the error number and text
IF ptrException.Number IS NOT NULL THEN
SET messageNumber = ptrException.Number;
IF ptrException.Text <> '' THEN
IF description<> '' THEN
SET description = description || ',' || ' '||ptrException.Text;
ELSE
SET description = ptrException.Text;
END IF;
END IF;
IF LENGTH(ptrException.Label)>0 THEN
SET Loc=ptrException.Label;
END IF;
END IF;
-- now move to the last child which should be the next exceptionlist
MOVE ptrException LASTCHILD;
END WHILE;
SET description = description ||': ' ||ptrException;
set eText = ptrException;
if CONTAINS(description,'Failed to open Queue') then
set eText = 'Failed to open Output queue';
END if;
If CONTAINS(description,'WTX exception') then
DECLARE CRLF CHARACTER CAST(X'0D0A09' AS CHAR CCSID 1208);
set eText = REPLACE(eText, CRLF, '');
END IF;
SET flowname=SUBSTRING(Loc FROM 0 FOR POSITION('.' IN Loc REPEAT-1));
SET OutputRoot.XMLNSC = NULL;
SET OutputRoot.XMLNSC.ERRORLOG.TimeStamp = CURRENT_TIMESTAMP;
SET OutputRoot.XMLNSC.ERRORLOG.FlowName = flowname;
SET OutputRoot.XMLNSC.ERRORLOG.ErrorCode = messageNumber;
SET OutputRoot.XMLNSC.ERRORLOG.ErrorText = eText;
SET OutputRoot.XMLNSC.ERRORLOG.ErrorDescription = description;
--Uncomment the below code to Override Email Configuration
-- Add recipient information to the EmailOutputHeader
--SET OutputRoot.EmailOutputHeader.To = 'bhanu7miralce@gmail.com';
--SET OutputRoot.EmailOutputHeader.Cc = 'kota.bhanumurty@gmail.com';
--SET OutputRoot.EmailOutputHeader.Bcc = '<recipient email address>';
-- Add sender information to EmailOutputHeader
--SET OutputRoot.EmailOutputHeader.From = 'kota.bhanumurty@gmail.com';
--SET OutputRoot.EmailOutputHeader."Reply-To" = '<reply email address>';
-- Add subject to EmailOutputHeader
--SET OutputRoot.EmailOutputHeader.Subject = 'Replaced by ESQL compute node.';
-- Add SMTP server information to the LocalEnvironment
--SET OutputLocalEnvironment.Destination.Email.SMTPServer ='';
-- Create a new message body, which will be sent as the main text of the email.
--SET OutputRoot.BLOB.BLOB = CAST('This is the new text for the body of the email.' AS BLOB CCSID 1208);
RETURN TRUE;
END;
CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER 1;
DECLARE J INTEGER;
SET J = CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
END;
CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
END;
END MODULE;
Exception from Try that will be caught in Catch:-
After ParseExceptionMessage:-
Make Below Configurations at
C:\Program Files\IBM\MQSI\9.0.0.0>mqsicreateconfigurableservice IB9NODE -c SMTP-o MYEMAILSERVER
BIP8071I: Successful command completion.
C:\Program Files\IBM\MQSI\9.0.0.0>mqsichangeproperties IB9NODE -c SMTP -o MYEMAI
LSERVER -n serverName -v <<serverName>>
BIP8071I: Successful command completion.
C:\Program Files\IBM\MQSI\9.0.0.0>mqsisetdbparms IB9NODE -n smtp::EmailIdentity
-u <<EmailId>> -p <<Password>>
BIP8071I: Successful command completion.
C:\Program Files\IBM\MQSI\9.0.0.0>mqsichangeproperties IB9NODE -c SMTP -o MYEMAI
LSERVER -n securityIdentity -v EmailIdentity
BIP8071I: Successful command completion.
No comments:
Post a Comment