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 » try catch implementation by esql POSSIBLE ??

Post new topic  Reply to topic
 try catch implementation by esql POSSIBLE ?? « View previous topic :: View next topic » 
Author Message
5zan
PostPosted: Fri Jul 18, 2008 8:25 am    Post subject: try catch implementation by esql POSSIBLE ?? Reply with quote

Novice

Joined: 08 Jul 2008
Posts: 24

I AM CALLING A JAVA METHOD FOR AUDITING IN MY MESSAGE FLOWS .

the requiremnt is that even if i encounter an error in this call or the java method fails , i want to ignore the exception and the flow shouldnt roll back ..

it just like what we do with the try catch block ..

can i hold the exception and ignore it , therby continuing with the flow processing even if the auditing fails or exception list generated ??

Any tricks ?

Back to top
View user's profile Send private message
sridhsri
PostPosted: Fri Jul 18, 2008 8:29 am    Post subject: Reply with quote

Master

Joined: 19 Jun 2008
Posts: 297

While this may not be the recommended approach, you could catch all your exceptions in the java code and do nothing no it. This way, the compute wont realize something went wrong with the java call.
Back to top
View user's profile Send private message
5zan
PostPosted: Fri Jul 18, 2008 8:36 am    Post subject: Reply with quote

Novice

Joined: 08 Jul 2008
Posts: 24

Appreciate yr response , but what if the whole thing is in ESQL only , what can be done in such a case ?
Back to top
View user's profile Send private message
sridhsri
PostPosted: Fri Jul 18, 2008 8:40 am    Post subject: Reply with quote

Master

Joined: 19 Jun 2008
Posts: 297

Then I'm afraid the only solution I can think of is using the trycatch node before the compute. You may choose not to use a throw node in the catch terminal of that node. That way broker wont think anything went wrong. You could wire the catch terminal the next processing node in your flow.
Back to top
View user's profile Send private message
kimbert
PostPosted: Sat Jul 19, 2008 2:34 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

How about catching the exception in your ESQL? http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/topic/com.ibm.etools.mft.doc/ak20700_.htm
Back to top
View user's profile Send private message
sridhsri
PostPosted: Sat Jul 19, 2008 7:04 am    Post subject: Reply with quote

Master

Joined: 19 Jun 2008
Posts: 297

Quote:
How about catching the exception in your ESQL? http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/topic/com.ibm.etools.mft.doc/ak20700_.htm


That is great info!
But I was wondering if those handlers are only applicable to SQL Statements to trap SQL Errors. If that is indeed the case, then I don't know if this solution would work 5zan because 5zan was invoking Java from ESQL.
Back to top
View user's profile Send private message
kimbert
PostPosted: Sat Jul 19, 2008 9:14 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
I was wondering if those handlers are only applicable to SQL Statements to trap SQL Errors
No, they can catch any exception at all. The page which I linked talks about SQL rather than ESQL. I may put a comment on it and suggest that the wording is improved.
Back to top
View user's profile Send private message
sridhsri
PostPosted: Sat Jul 19, 2008 9:30 am    Post subject: Reply with quote

Master

Joined: 19 Jun 2008
Posts: 297

This is great!

You are right, the wordings are a little misleading - esp. the following wordings:

Quote:
If there are no exceptions, the presence of handlers has no effect on the behavior or performance of an SQL program. If an exception occurs, WebSphere® Message Broker compares the SQL state of the exception with the SQL states associated with any relevant handlers, until either the exception leaves the node (just as it would if there were no handlers) or a matching handler is found.


If i may also suggest, perhaps we can add an example showing non-SQL and have SQLSTATE as optional param in the syntax.
Back to top
View user's profile Send private message
sridhsri
PostPosted: Sat Jul 19, 2008 11:37 am    Post subject: Reply with quote

Master

Joined: 19 Jun 2008
Posts: 297

I was also wondering if these exception handlers would work for calling java from ESQL.
Back to top
View user's profile Send private message
5zan
PostPosted: Sun Jul 20, 2008 10:10 pm    Post subject: Reply with quote

Novice

Joined: 08 Jul 2008
Posts: 24

Thanx kimbert ,

Even i was wondering if it can work for any ESQL ?

Can i encapsulate a Java method call b/w the handler .. if yes can u tell me how ? i can only see SQL states being referred in the link !
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon Jul 21, 2008 4:37 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Here are the facts:
- DECLARE HANDLER can catch any and all broker exceptions. You control which ones you want to catch using the LIKE clause.
- When the docs talk about 'SQL state' they mean one of the states returned by SQLSTATE, as listed here http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/topic/com.ibm.etools.mft.doc/ak17990_.htm.
- You *can* catch java errors using DECLARE HANDLER...but there are special rules to remember...
- You cannot call ( direct from ESQL ) any Java method which throws a non-fatal exception. The JVM might still throw an out-of-memory exception, or something like that. So you should not expect to be able to catch your own java exceptions.
- You can PROPAGATE from ESQL to a named terminal. If that terminal is connected to a JavaCompute node, then you can throw a Java exception from that JavaCompute node, and catch it with an ESQL handler. You might need to examine the SQLSTATE in the handler code to work out what sort of exception you have caught.

Hope that helps.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » try catch implementation by esql POSSIBLE ??
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.