ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » exceptions list and error handling

Post new topic  Reply to topic
 exceptions list and error handling « View previous topic :: View next topic » 
Author Message
gopiv
PostPosted: Sun Sep 29, 2002 8:20 am    Post subject: exceptions list and error handling Reply with quote

Newbie

Joined: 29 Sep 2002
Posts: 8

I have message flow which receives the XML message and send it to the receiving application by constructing the new message.
I have mainly three nodes INPUT -----> COMPUTE NODE ---> OUTPUT NODE.

If there is any exceptions in compute node i have to catch those exceptions with message ID and exception text and roll back the message towards INPUT node and put into the some error queue and stop the message flow by disabling the INPUT QUEUE/INPUT NODE.
I am not sure what i have to do with the message which causes the error, whether to put that message some error queue or backout queue.
Please some one suggest me the best way to handle this.
I heard that there is one plug in node to disable the input queue if there is any exceptions.
Can some one help me to design appropriate logic in comute node to throw any exceptions if i need to, and what are all the nodes i have to include to handle the exceptions.

Thanks,
Gopi
Back to top
View user's profile Send private message
kirani
PostPosted: Sun Sep 29, 2002 7:48 pm    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

If an exception occurs in your compute node, message will be rolledback to your MQInput node automatically. In the catch terminal of MQInput node you could get exception info using ExceptionList, you could also use MQOutput node to write your message to some failure queue. You could use Neil Kolban's MQDisable node to disable input queue. This node can be downloaded from url ..
http://www.kolban.com/mq/wmqi/wmqi_mqdisable_node.htm
_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
gopiv
PostPosted: Mon Sep 30, 2002 3:26 am    Post subject: Reply with quote

Newbie

Joined: 29 Sep 2002
Posts: 8

This what i understand from your reply to my question.
I can connect Out termianl of input node to IN termianl of compute node
and catch terminal of INPUT node to trace, in the trace i have to give ${ExceptionList} but i am not sure where this exceptionlist will be stored if i give file in Destination in the trace node(Brpoker is on AIX).
Do i have to code any thing in compute node to throw exceptions or if there are any exceptions it will get rolled back automatically to catch terminal of input node.
How i can store my message in some failure queue in this process, please explain to me in detail.
Thanks,
Gopi.
Back to top
View user's profile Send private message
gopiv
PostPosted: Mon Sep 30, 2002 3:49 am    Post subject: Reply with quote

Newbie

Joined: 29 Sep 2002
Posts: 8

Kiran,
When i run the message flow withn one of my sample message with trace
activated on debug level i wm getting the following trace, it's not making any sense to me. If you ever come across this problem, help me out.
One more if i run the msg flow with some other sample data with instance of each segment iam getting the output but i want trace with the message which is not going to the ouput queue but i am getting the below trace.


Timestamps are formatted in local time, 240 minutes before GMT.

2002-09-27 08:19:32.291091 2314 UserTrace BIP7082I: Node '': Publishing to destination HAM_TM01:SYSTEM.BROKER.ADMIN.REPLY:4366674d677253756233 for user mqsi_adm.
A publication destination is being added to the list of destinations to HAM_TM01:SYSTEM.BROKER.ADMIN.REPLY:4366674d677253756233 for user mqsi_adm.
No user action required.
Thanks,
Gopi.
Back to top
View user's profile Send private message
gopiv
PostPosted: Mon Sep 30, 2002 5:19 am    Post subject: Reply with quote

Newbie

Joined: 29 Sep 2002
Posts: 8

Kiran,
I have tried by connecting the INPUT node catch terminal to the trace node, in the trace i have specified ${ExceptionList} trace output terminal to the output node(which i used for error queue). My message is getting routed tot he error queue in output node thru trace node but i am unable to see any trace. If i specify ${Exceptionlist} and destination file where exactly i can see the exceptions related to hat partuclar message.
I have one more trace between INPUT node Out Terminal and COMPUTE NODE in terminal but i am not getting any trace bcos me message is directly going thru catch terminal of input node.
I am not sure whether we can coonect directly the catch terminal fo input node to trace to trap the exceptions or trycatch node between INPUT node and COMPUTE node.
I am trying to get the errors or exceptions stored some where and the oringinal message to error queue, can you help me to get this in my message flow.
Thanks,
Gopi.
Back to top
View user's profile Send private message
marko
PostPosted: Mon Sep 30, 2002 5:58 am    Post subject: Reply with quote

Apprentice

Joined: 28 Feb 2002
Posts: 27

gopiv.

If you want to put the exception list on a queue, you will have to create a message that includes the exception list.

In most of my flows I will catch off of the input queue, then I will have a compute node that creates a message that includes the input message plus the exception list. The following example assumes that the input message is an XML msg.

SET OutputRoot = InputRoot;

-- Place Exception List into Root of XML message
Set OutputRoot.XML.Error = InputExceptionList;

The output of the compute node can then be placed on the error queue.
My flows are running as trasactions, so I want the trasaction to rollback on error. To enable this make sure that the error queue is runing outside of the transaction (Advanced->Transaction Mode->No). Then after the error output queue you can connect a Throw node to throw an exception that will cause the flow to rollback. The error message will not rollback since it is running outside of the trasaction. The rolled back message will then be placed on the DLQ, or you can configure a backout queue, or you can configure a backout count > 1 if you wish to retry the failed message.
Back to top
View user's profile Send private message
jgooch
PostPosted: Mon Sep 30, 2002 6:12 am    Post subject: Reply with quote

Acolyte

Joined: 29 May 2002
Posts: 63
Location: UK

Gopi,

To get the trace node to output to a file, you have to set the "Destination" property to "File" as well as put the filename into the "File Path" property - the default is "Usertrace" which is why you can only see the trace information whilst running under debug mode. NB the file will be on your AIX machine.

One of the troubles with this is that if you put a large number of messages through, it will not be instantly obvious which ExceptionList relates to which message.

So, I suggest you also add ${CURRENT_TIMESTAMP} and ${Root.MQMD.MsgId} to your trace node.

An alternative is to add the exception details to your message before putting them out to the error queue. This probably works better if your message is XML. We use a compute node between the catch/failure terminal and the error queue MQOutput node with the following code (most of which is in the manual!). This is also quite good if your exception is coming from a Throw node as it will populate the errorDescription from there.

DECLARE ErrorNum INTEGER;
DECLARE ErrText CHARACTER;
DECLARE Path CHARACTER;

SET Path = 'InputExceptionList.*[1]';

WHILE EVAL('FIELDNAME(' || Path || ') IS NOT NULL')
DO
IF EVAL('FIELDNAME(' || Path || '.Number) IS NOT NULL')
THEN SET ErrorNum =EVAL(Path ||'.Number');
IF ErrorNum > 3000 AND ErrorNum < 3020
THEN Set ErrText = EVAL(Path || '.Insert[1].Text');
ELSE Set ErrText = EVAL(Path || '.Text');
END IF;
END IF;
SET Path = Path || '.*[LAST]';
END WHILE;

Set OutputRoot.XML.whatever.errorCode = ErrorNum;
Set OutputRoot.XML.whatever.errorDescription = ErrText;
Set OutputRoot.XML.whatever.sourceQueue = InputRoot.MQMD.SourceQueue;
Set OutputRoot.XML.whatever.failureTimestamp = CURRENT_TIMESTAMP;

Finally, I think that your suggestion of using a TryCatch node is a red herring. It won't help if you want to keep the original message.

Hope it helps - you seem to have several different queries!

J.
Back to top
View user's profile Send private message
gopiv
PostPosted: Mon Sep 30, 2002 10:11 am    Post subject: Reply with quote

Newbie

Joined: 29 Sep 2002
Posts: 8

I have tried with compute node between Inpu node catch terminal and output node(error queue) the below code but i am getting just message into the error queue.
what is the comput mode for main compute node and error handling compute node in advanced tab i have to set to get the exception and message into the error queue.

DECLARE ErrorNum INTEGER;
DECLARE ErrText CHARACTER;
DECLARE Path CHARACTER;

SET Path = 'InputExceptionList.*[1]';

WHILE EVAL('FIELDNAME(' || Path || ') IS NOT NULL')
DO
IF EVAL('FIELDNAME(' || Path || '.Number) IS NOT NULL')
THEN SET ErrorNum =EVAL(Path ||'.Number');
IF ErrorNum > 3000 AND ErrorNum < 3020
THEN Set ErrText = EVAL(Path || '.Insert[1].Text');
ELSE Set ErrText = EVAL(Path || '.Text');
END IF;
END IF;
SET Path = Path || '.*[LAST]';
END WHILE;

Set OutputRoot.XML.whatever.errorCode = ErrorNum;
Set OutputRoot.XML.whatever.errorDescription = ErrText;
Set OutputRoot.XML.whatever.sourceQueue = InputRoot.MQMD.SourceQueue;
Set OutputRoot.XML.whatever.failureTimestamp = CURRENT_TIMESTAMP;

I just need to put the message with exception generated for that particular message into error queue.
Help me with exact steps and nodes i have to include to do this.
Thanks,
Gopi.
Back to top
View user's profile Send private message
kirani
PostPosted: Mon Sep 30, 2002 6:05 pm    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

Gopi,
What is your Compute mode set to? In your compute node select "Copy Message Headers" only.
_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
gopiv
PostPosted: Tue Oct 01, 2002 3:16 am    Post subject: Reply with quote

Newbie

Joined: 29 Sep 2002
Posts: 8

Kiran,
I am getting the exception with the fallowing set up in msg flow but i am not getting the message into the error queue.

I am connecting Catch terminal of input node to Trace node , in this trace i am specifying Destination : usertrace, Pattern : ${ExceptionList};
${CURRENT_TIMESTAMP};
${Root.MQMD.MsgId}, then compute node with the fallowing code
Set OutputRoot.XML.Error = InputExceptionList; with the Copy Message Headers only selected.

I wan to have Exception with the message id and time stamp, Total input message. What i should i do get this in my error hanlding.

I have tried with different combinations in comput node advanced tab COMPUTEMODE set to.
Please Help me where exactly i am missing.
Thanks,
Gopi.
Back to top
View user's profile Send private message
AlexeiSkate
PostPosted: Wed Oct 02, 2002 8:56 am    Post subject: Reply with quote

Centurion

Joined: 10 Apr 2002
Posts: 123

gopiv,

I would put a trace node between the catch terminal and the compute node and list the entire message that is coming out of the catch node. I would then compare the detailed message structure from the trace node to the assignment statements in the compute node to make sure that the compute node is referencing the correct tag structure to extract the exception message. I would also put a trace node between the compute node and the error queue to see the message that is coming out of the compute node.
Back to top
View user's profile Send private message
kirani
PostPosted: Wed Oct 02, 2002 3:32 pm    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

Gopi,

I don't see any reason why it is not working for you.

If you want to write ExceptionList to some file, then set Destination to File in your Trace node, you will also have to enter some file name in it, this file will be created on Broker machine. So the nodes in your catch terminal of MQInput node will be ..

Trace->Compute2->MQOutput2

In your Compute2 node, you can use following code to copy ExceptionList to output message,
Code:

SET OutputRoot.XML.Data.ErrorInfo = InputExceptionList;


Make sure you select "Copy Message headers only" in your compute node and your compute mode is set to "Message" only.

Attach out terminal of this compute2 node to MQOutput2 node. Configure MQOutput2 node to write message to some Error/Fail queue.
_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
gopiv
PostPosted: Sun Oct 06, 2002 4:53 am    Post subject: Reply with quote

Newbie

Joined: 29 Sep 2002
Posts: 8

Kirani,
I have tried by doing the same as you mentioned above but i am still getting the exceptionlist only in my output node(which i configured for error queue).
I am not able to find the file(which i mentioned in trace node through catch terminal fo input node) where it is getting created on my AIX broker machine.
I don't know where i am missing the point, is there any thing specifically i have to set it in compute mode of main compute node to get the exception and message to be rolled back to catch terminal or i have to set the comput mode of compute node2 to something else. i have tried with message as in compute mode for compute node2.
Thanks,
Gopi
Back to top
View user's profile Send private message
kirani
PostPosted: Sun Oct 06, 2002 7:09 pm    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

Gopi,

You can get original input message and Exception list using following ESQL:

Code:

SET OutputRoot.XML.MQI_ERRORS.MsgBody = CAST(BITSTREAM(InputBody) AS CHAR CCSID InputRoot.Properties.CodedCharSetId);
SET OutputRoot.XML.MQI_ERRORS."ExceptionList" = InputExceptionList;


Try specifying complete file path (eg. /tmp/catch.txt)in your trace node. If you don't specify any file path in the trace node, the file will be created in the directory from where you are issuing mqsistart command.
_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » exceptions list and error handling
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.