Author |
Message
|
kwelch |
Posted: Mon May 17, 2004 6:34 am Post subject: opinion on error handling routine |
|
|
 Master
Joined: 16 May 2001 Posts: 255
|
Hi,
Our error handling routines to date tend to be very simple. We want to save off the original message so that after we see the error message in the event viewer we can replay it after we think the problem is resolved. We typically wire the fail node to a fail queue to capture the original message.
On my latest project I have had a request for a specialized error routine where I have to put some information on the message and then put the original message at the end. My understanding is that error routines such as this are better coded off of the catch terminal of the input node. If it were wired to the failure terminal there would be potential to get in an endless loop if the error logic failed. When we wire routines to the catch terminal of the input node we lose our event viewer messages. We like these messages as they usually point us directly to the problem. I thought about writing the original message to a fail q and then also to an exception queue that would go to another flow that would format the special error message. This would allow me to keep my event viewer messages and not put the original flow at risk for looping. Is there a better way? Is there a way to have the routine off the catch terminal and still get event viewer messages? Thanks for any input.
Karen |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon May 17, 2004 6:55 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Add a throw node at the end of the catch flow.
It will propogate the error back to the input node, and you will retain rollback, retry, and eventual propogation to the failure terminal (and subsequent behavior there).
It will also give you your error messages back in your system log (event viewer) ... _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
kwelch |
Posted: Mon May 17, 2004 7:03 am Post subject: |
|
|
 Master
Joined: 16 May 2001 Posts: 255
|
Hi Jeff,
So you are saying to code the error routine off of the failure terminal? I thought that was bad practice as it could cause potential looping should that routine fail.
Karen |
|
Back to top |
|
 |
fschofer |
Posted: Mon May 17, 2004 7:09 am Post subject: |
|
|
 Knight
Joined: 02 Jul 2001 Posts: 524 Location: Mainz, Germany
|
Hi Karen,
connect a trycatch node directly to the catch terminal of your mqinput node.
This way you can put your original message to your event viewer and also do some error handling stuff.
At the end of your error handling raise a exception with a special exception number like 2950,
this way the original message appears at the catch terminal of your trycatch node.
If an errror occcurs within you errror handling it get also catched at the try catch node, but with a different exception number.
Using the exception number you can route the original message to differrent queues, you can also throw another exception for rollback, ...
Within your errror handling you can put messages with error informations to other queues by setting the output node to put outside the transanction.
This at least is the way i do my error handling.
Greetings
Frank |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon May 17, 2004 7:10 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
No.
I'm saying, code the error routine off the catch terminal.
As the very last node in the error routine, connect a Throw node.
So
MQInput --out-->main flow logic
MQInput --catch--> error routine --> Throw
MQInput --failure --> (nothing, unconnected) _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
kwelch |
Posted: Mon May 17, 2004 7:13 am Post subject: |
|
|
 Master
Joined: 16 May 2001 Posts: 255
|
Thanks Frank and Jeff! Now I think I get it!
Karen |
|
Back to top |
|
 |
kwelch |
Posted: Mon May 17, 2004 11:06 am Post subject: |
|
|
 Master
Joined: 16 May 2001 Posts: 255
|
Well, I thought I got it anyway. I can't seem to get either of the two methods mentioned to work. I can either process the error routine and get no event messages or get event viewer messages but not wire the catch terminal. By wiring the throw at the end of the error routine everything is rolled back. Using TryCatch didn't allow me to see event viewer messages either. Am I misunderstanding something?
I really want 3 things to happen in the event of an error:
1. preserve the original message
2. format a special message to go to an exception queue back to the requestor
3. be able to see event viewer messages to determine the nature of the error.
I can get two of the above to happen or all 3 if I do the error routine from the fail terminal but that leaves me open to looping should the error routine fail.
Karen |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon May 17, 2004 11:11 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You have to set the transaction mode on your exception queue to ensure that it will commit the message regardless of whether or not the message flow fails. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
kwelch |
Posted: Mon May 17, 2004 11:23 am Post subject: |
|
|
 Master
Joined: 16 May 2001 Posts: 255
|
Jeff,
Thank you! I can't believe I didn't think of that myself! I turned transaction mode to No and it worked!
Thanks again!
Karen |
|
Back to top |
|
 |
|