Uploaded by blushmaqq

Email-Output-Node

advertisement
Introduction :
The EmailOutput node is a highly configurable node that allows e-mail messages to be sent
over the SMTP protocol. EmailInput allows e-mails to be received from POP3 or IMAP servers
Scenario :
This scenario is about whenever we are not mentioned the Output Queue name then
automatically the Error message will send to the Email.
Local Queues used in this Scenario are:
1) IN
Step 1:
Creating Integration Project :
Step 2:
Project Name As : EmailOutputNodeEX.
Page: 1 of 8
Step 3:
Creating Message Flow Name as : EMAILOUTPUTNODE_MESSAGEFLOW
After Creating Message Flow Click Finish.
Required Nodes for EMAILOUTPUTNODE_MESSAGEFLOW are
1) MQINPUT Node
2) Try Catch Node
3) Compute Node
4) MQOUT Node
5) Email Output Node.
Step : 4
Under Web Sphere MQ drag MQ Input node and give Queue Name as IN.
Page: 2 of 8
Step 5:
Drag Try catch node which is present in construction nodes,as show in below screen.
Step 6:
Drag MQ Output node from Websphere MQ,here no need to mention Queue name. Then only
catch block will execute and Exception message will send to Email Output node.
Page: 3 of 8
Step 7:
Drag Compute Node from Transformation nodes as shown in below.
Step 8:
Double Click on the Compute node and write the code between Begin and End; block.
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;
Page: 4 of 8
exceptionlist
-- now move to the last child which should be the next
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 = 'shivaganesh.prof@gmail.com';
--SET OutputRoot.EmailOutputHeader.Cc = 'lsontenam@miraclesoft.com';
--SET OutputRoot.EmailOutputHeader.Bcc = '<recipient email address>';
address>';
node.';
-- Add sender information to EmailOutputHeader
--SET OutputRoot.EmailOutputHeader.From = 'lsontenam@miraclesoft.com';
--SET OutputRoot.EmailOutputHeader."Reply-To" = '<reply email
-- Add subject to EmailOutputHeader
--SET OutputRoot.EmailOutputHeader.Subject = 'Replaced by ESQL compute
-- Add SMTP server information to the LocalEnvironment
--SET OutputLocalEnvironment.Destination.Email.SMTPServer
='smtpout.secureserver.net:25';
-- 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);
END;
RETURN TRUE;
Page: 5 of 8
Step 9 :
Drag Email Output node from Email Nodes and set SMTP server and Port values which is
present in Basic Properties.
Step 10:
In the Email Output Node under Email properties set To Address,From Address and
Subject of Email Values as shown in below.
Page: 6 of 8
Step 11:
In the Email Output Node under Security properties set Security Identity as shown in
below.
Step 12:
Create Configurable service using MQSI Commands in the IBM Integration Console
9.0.0.0.
Page: 7 of 8
Step 13:
Apply Break points and deploy the flow and test the code.
Step 14:
Give input as “We are belong to Miracle Family” to the Local Queue “IN” in the
Websphere MQ as shown in below.
Step 15:
The final message send to the email as shown in below.
Page: 8 of 8
Download