Author |
Message
|
trongbx |
Posted: Thu Dec 24, 2009 11:18 pm Post subject: Using EmailOutput node to notify when the error happens |
|
|
Novice
Joined: 23 Nov 2008 Posts: 21
|
I am using an EmailOutput node to notify when the error happens on my message flow. However, the current Email event flow has very little information. It sends only the failed message as the attachment to my email.
I have to figure out how to enhance th is flow to show more information as why did it fail, error code or error message in the email content.
Could you please give me some suggestion on this?
Thanks!  |
|
Back to top |
|
 |
mgk |
Posted: Fri Dec 25, 2009 12:35 pm Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Have you looked at the syslog or event log or taken a usertrace? Can you post your flow so we can see what you are doing?
Regards, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
smdavies99 |
Posted: Fri Dec 25, 2009 9:59 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
I've already described here one solution where I use the EmailOutputNode plus the ZipNode support pack so that in the case of an error, you get
- A text description of the error ( ie DB/SQL Error, WMQ Error, Other Error) including the BIP Error Number.
- A Zipped attachment that contains
- The Full ExceptionList
- The original Message that caused the exception
How about that?
A nice little sub-flow for you to design that is also re-usable. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
trongbx |
Posted: Sun Dec 27, 2009 7:27 pm Post subject: |
|
|
Novice
Joined: 23 Nov 2008 Posts: 21
|
Your description is exactly what i am doing. I have developed a subflow which is named EmailFailure and connected to the Failure terminal of all nodes in the main flow. So that in the case of an error, i would receipt an email to notify me the error. And the content of the notification should contain some items as below:
1)A text description of the error ( ie DB/SQL Error, WMQ Error, Other Error) including the BIP Error Number.
2)The Full ExceptionList.
3)The original Message that caused the exception.
I figured out how to get the original message in subflow. Now, i am trying to find the way to handle item #1 and #2. Any idea on those?
Here is the code to get the original mesage that caused the exception.
Code: |
SET OutputRoot.Properties = InputRoot.Properties;
SET OutputRoot.MQMD = InputRoot.MQMD;
CREATE LASTCHILD OF OutputRoot TYPE Name NAME 'EmailOutputHeader';
SET OutputRoot.EmailOutputHeader.To = 'trongbx@gmail.com';
SET OutputRoot.EmailOutputHeader.From = 'trongbx@gmail.com';
SET OutputRoot.EmailOutputHeader.Subject = 'WMB Failure: ' || BrokerName;
SET OutputLocalEnvironment.Destination.Email.BodyContentType = 'text/plain';
SET OutputLocalEnvironment.Destination.Email.SMTPServer = 'na.relay.ibm.com:25';
SET OutputLocalEnvironment.Destination.Email.Attachment.ContentType = 'text/plain';
SET OutputLocalEnvironment.Destination.Email.Attachment.Content = InputRoot.BLOB.BLOB;
SET OutputLocalEnvironment.Destination.Email.Attachment.ContentName = 'message.xml';
DECLARE now CHARACTER;
SET now = CAST(CURRENT_TIMESTAMP AS CHARACTER FORMAT 'yyyyMMddHHmmssSSSSSS');
DECLARE MailText CHARACTER;
SET MailText = 'Timestamp=' || now || '::' ||
'MessageFlow=' || MessageFlowLabel || '--> ';
CREATE LASTCHILD OF OutputRoot DOMAIN 'BLOB';
SET OutputRoot.BLOB.BLOB = CAST(MailText AS BLOB CCSID InputRoot.Properties.CodedCharSetId) ;
|
@mgk: of course i use the trace node and turn on the debug level for the main flow. I always check the syslog and event log and based on the trace to debug. However, the error happens sometimes but i don't know. So that this subflow is very useful and save the time.
Please help!  |
|
Back to top |
|
 |
smdavies99 |
Posted: Mon Dec 28, 2009 12:02 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Quote: |
Your description is exactly what i am doing. I have developed a subflow which is named EmailFailure and connected to the Failure terminal of all nodes in the main flow. So that in the case of an error, i would receipt an email to notify me the error. And the content of the notification should contain some items as below: |
Please take a look at how the CATCH & FAILURE terminals differ in their operation.
Generally, an error in say a DB operation will trigger something that can be picked up via a catch terminal. Ask yourself what happens if I get a failure while processing my code which is connected to the failure terminal?
Also, as a rule of thumb, I use a Try/Catch node to collect errors rather than wiring up every node.
finally, please think about preserving your original message in its entirety including the Properties & MQMD folder. You will be surprised how many errors & problems that are discussed here can't be resolved by examining the message contents only. for example, a message sent with a CCSID of 437 when the contents are in CCSID 500.
So to re-iterate.
- Preserve the originial message in a form that can lake it possible to replay.
- Include the MQMD & any other folders (eg RFH2)
- Think about what happens if you get characters in a different character set than you are using? If you include the message body as 'plain text' you may not see the message in all its unadulterated glory in your Email Client.
- What happens if the hard coded email recipient goes on holiday or leaves the company and their email is deleted?
If you resolve these you will (hopefully) end up with a general catch-all errors subflow. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
bhaski |
Posted: Mon Dec 28, 2009 5:55 am Post subject: use your error notification code like this... |
|
|
 Voyager
Joined: 13 Sep 2006 Posts: 78 Location: USA
|
DECLARE Path REFERENCE TO InputExceptionList.*[I1];
-- Check whether the Width of the Exception Tree is more and Proceed.
While LastMove(Path) do
SET Diagnostics = '';
SET DiagnosticsInfo = '';
While FieldName(Path) = 'RecoverableException' or FieldName(Path) =
'DatabaseException' or
FieldName(Path) = 'ConversionException' or FieldName(Path) =
'ParserException' or FieldName(Path) = 'UserException' do
IF Length(Path.Label) > 0 THEN
SET Location = Path.Label;
End if;
IF Length(Path.Text) > 0 THEN
SET Diagnostics = Diagnostics || Path.Text || '. ';
End if;
IF FieldName(Path) = 'UserException' THEN
SET ERRORLOC = ERRORLOC || ( Path.Insert[1].Text );
SET ERRORELEMENT1 = ERRORELEMENT1 || NULLVALIDATE(Path.Insert[2].Text );
SET ERRORELEMENT2 = ERRORELEMENT2 || NULLVALIDATE(Path.Insert[4].Text);
SET ERRORELEMENT1REASON = ERRORELEMENT1REASON || NULLVALIDATE(Path.Insert[3].Text);
SET ERRORELEMENT2REASON = NULLVALIDATE( Path.Insert[5].Text );
END IF;
IF LastMove(Path) THEN
SET I = CARDINALITY(Path.Insert[] );
END IF;
MOVE Path Lastchild;
End while;
SET Width = Width +1;
MOVE Path TO InputRoot.XMLNS.Exception.Data[I1].ExceptionMessage.*[Width];
end WHILE;
_________________ Thanks and Regards
Bhaski
Websphere MQ Admin Certified
Websphere WMB Admin certified |
|
Back to top |
|
 |
napier |
Posted: Mon Dec 28, 2009 7:15 am Post subject: |
|
|
 Apprentice
Joined: 09 Oct 2007 Posts: 48 Location: USA
|
|
Back to top |
|
 |
|