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 » How to use try/catch node?

Post new topic  Reply to topic
 How to use try/catch node? « View previous topic :: View next topic » 
Author Message
Yash
PostPosted: Wed Oct 02, 2002 3:40 am    Post subject: How to use try/catch node? Reply with quote

Novice

Joined: 26 Sep 2002
Posts: 24

Hai,
I have a simple message flow which contains inputnode-->compute-->outputnode. I want to use try/catch node or throw node in my messageflow , which keeps both the message and exception description in the error queue. Can anyone help me doing this.

Thanks,
_________________
Yash
Back to top
View user's profile Send private message
amar
PostPosted: Wed Oct 02, 2002 4:11 am    Post subject: Reply with quote

Apprentice

Joined: 27 Jun 2002
Posts: 45

Hi,
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 information using ExceptionList,

Inside Trace Node

Destination :File
FilePath:Path
Pattern:${Exception}

cheers
Back to top
View user's profile Send private message
Yash
PostPosted: Wed Oct 02, 2002 4:28 am    Post subject: Reply with quote

Novice

Joined: 26 Sep 2002
Posts: 24

Thanks Amar. But I don't want my message to be rolled back to Input Node . I want both Exception List and message to be placed on error queue.

Thanks,
_________________
Yash
Back to top
View user's profile Send private message
AlexeiSkate
PostPosted: Wed Oct 02, 2002 8:43 am    Post subject: Reply with quote

Centurion

Joined: 10 Apr 2002
Posts: 123

Yash,

You can connect your nodes like this:

inputNode -> tryCatch -> computeNode -> outputNode.

You'll then hook the catch terminal of the tryCatch node to your error queue. If the Compute node throws an exception then the tryCatch node will route the message and attached exception the the catch terminal.
Back to top
View user's profile Send private message
ernest-ter.kuile
PostPosted: Thu Oct 03, 2002 1:00 am    Post subject: Reply with quote

Apprentice

Joined: 13 May 2002
Posts: 49
Location: KLM Holland

Quote:
... I don't want my message to be rolled back to Input Node . I want both Exception List and message to be placed on error queue.


Using the try-catch mechanism, your message is always rolled back on exception. There is no way to prevent this, unless you can prevent the error which generated the exception in the first place.

But then, why would you not want this ?
Back to top
View user's profile Send private message Visit poster's website
Yash
PostPosted: Thu Oct 03, 2002 3:41 am    Post subject: Reply with quote

Novice

Joined: 26 Sep 2002
Posts: 24

If an error occurs then I want it to go to error queue. Maintains people will look into both error and message and then they want to correct the error and then send the message manually. So I don't want it to roll back to input queue.

Thanks,
_________________
Yash
Back to top
View user's profile Send private message
kirani
PostPosted: Thu Oct 03, 2002 7:54 am    Post subject: Reply with quote

Jedi Knight

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

If you design your message flow like this ..

MQInput(out)->your different processing nodes->MQOutput1
MQInput(catch)->MQOutput2

Here MQOutput1 is your output queue and MQOutput2 is your failure queue. If an error occurs during normal processing message will be sent to the failure queue, it will NOT rollback to your input queue. Does this design meet your requirement?
_________________
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
Yash
PostPosted: Thu Oct 17, 2002 5:44 am    Post subject: Reply with quote

Novice

Joined: 26 Sep 2002
Posts: 24

Kiran,

I am doing the below design to get both message and exceptionlist into the MQOutput2.But I am only getting the message in the MQOutput2 queue.Can you help in getting both the message and exception list on to the queue with the time stamp when the error has occured.

MQInput(out)->Try/Catch(try)- > Comput node->MQOutput1
MQInput(out)->Try/Catch(catch)- > MQOutput2

Thanks,
_________________
Yash
Back to top
View user's profile Send private message
lung
PostPosted: Thu Oct 17, 2002 5:00 pm    Post subject: Reply with quote

Master

Joined: 27 Aug 2002
Posts: 291
Location: Malaysia

Yash,

In that case, you may need to wire a compute node between your mqinput-catch and your mqoutput2. In the compute node, you can alter your message to include the exceptionlist before sending it to mqoutput2. If you do not include a compute node, only the original rollbacked message will be put into the mqoutput2 node (exceptionlist will no longer be present once it leaves wmqi, which is why u have to extract whatever info u need from it BEFORE it goes into an output node)


_________________
lung
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
Yash
PostPosted: Wed Oct 23, 2002 3:42 am    Post subject: Reply with quote

Novice

Joined: 26 Sep 2002
Posts: 24

Lung,

When I include a compute node in between catch node and MQoutput2 and wrote the following code inside compute node.

DECLARE I INTEGER;
SET I = 1;
WHILE I < CARDINALITY(InputRoot.*[]) DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I=I+1;
END WHILE;
-- Enter SQL below this line. SQL above this line might be regenerated, causing any modifications to be lost.
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;



This time I am only getting the exception message not the rolled back message. Can you help getting both the exception list and message into MQoutput2.

Thanks,
_________________
Yash
Back to top
View user's profile Send private message
kirani
PostPosted: Wed Oct 23, 2002 7:43 pm    Post subject: Reply with quote

Jedi Knight

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

Yash,

How exactly do you want your message to be displayed in the error queue? Lets say your input message is ..
<Data>
<Tag1>
some data
</Tag1>
</Data>

Now do you want two different messages on error queue, one with ExceptionList and another one is your original message? Or do you want to create an Error message with some error info from ExceptionList (which you are doing currently in your code)?

Please note that one of the reason for your message failure could be invalid message format, so you may get an error if you try to reparse your failed message in catch terminal.

There are few good threads about Error handling in this forum, please go thru them and I am sure you will get more ideas!!
_________________
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
Yash
PostPosted: Thu Oct 24, 2002 4:00 am    Post subject: Reply with quote

Novice

Joined: 26 Sep 2002
Posts: 24

Kirani,

I want to send two messages into the error queue.One is the original message from Input node and the other is exception values.Can you help in doing so.

Thanks,
_________________
Yash
Back to top
View user's profile Send private message
kirani
PostPosted: Thu Oct 24, 2002 7:44 am    Post subject: Reply with quote

Jedi Knight

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

Yash,

Use Floworder node to do this. Your existing compute node will be attached to the first terminal of Floworder node, which creates error message and the second terminal will be connected directly to the MQOutput node. This will give you 2 output messages on failure 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
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » How to use try/catch node?
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.