|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Java compute node execution |
« View previous topic :: View next topic » |
Author |
Message
|
gappodi |
Posted: Thu Mar 30, 2017 6:17 am Post subject: Java compute node execution |
|
|
 Voyager
Joined: 05 Sep 2014 Posts: 76
|
I have a simple message flow consisting of 1 FileInput node, followed by 2 Java compute nodes and ends with a FileOutput node. I have put a TryCatch node at the beginning of the flow (right after the FileInput node) and added one ESQL compute node attached to the catch terminal of the TryCatch node.
While developing the flow, Unintentionally I wrapped out.propagate(outAssembly); inside a try catch block in the first java compute node. Later, an exception was being thrown from the 2nd java compute node. While debugging I found that this exception was caught by the catch block inside the first Java compute node. I was under the impression that once the message has propagated from the first java compute node, it finishes the first java compute node and any exception that is being thrown by the second java compute node (or anywhere down the flow) will be caught by the Catch block residing at the beginning of the flow.
Please provide some valuable inputs on it to make me understand how it works.
Thanks and Regards,
Maneesh Sharma |
|
Back to top |
|
 |
timber |
Posted: Thu Mar 30, 2017 6:53 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
Quote: |
I was under the impression that once the message has propagated from the first java compute node, it finishes the first java compute node and any exception that is being thrown by the second java compute node (or anywhere down the flow) will be caught by the Catch block residing at the beginning of the flow. |
Not always. You could put a TryCatch node anywhere in your flow, and it would catch any exceptions that occur downstream of it. Similarly, you can catch exceptions in a try...catch block in Java if you want to.
Java exception handling is under your control. If you don't want to catch certain kinds of exception in your catch block then change the catch block to list only those exceptions that you want to catch. |
|
Back to top |
|
 |
gappodi |
Posted: Fri Mar 31, 2017 7:43 pm Post subject: |
|
|
 Voyager
Joined: 05 Sep 2014 Posts: 76
|
That's right Timber. I understand that exception handling in java is under our control and we can always choose to catch/skip the kind of exceptions we want to inside our java compute node.
But in my case what actually happened was that I wrapped out.propagate() in the first java compute node with in a try catch block (And it was purely unintentional OR accidental). What I thought that once the out.propagate() has propagated the message to the subsequent terminal, the evaluate() method should get popped off from the stack. And any exception being thrown from some where down the flow should be caught by the catch node sitting at the beginning of the message flow. But with my observation, it looked as if the exception traveled all the way back from the point where it was thrown in the 2nd java compute node and caught by the catch block defined in the first java compute node's evaluate() method.
So this gives me an impression that the first java compute node's evaluate() method really did not get popped off the stack and remained in the stack until the flow completed.
Can you please provide your valuable comments on this ? |
|
Back to top |
|
 |
mgk |
Posted: Sat Apr 01, 2017 3:57 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Quote: |
the first java compute node's evaluate() method really did not get popped off the stack and remained in the stack. |
This is exactly what happens. The call remains on the stack until control has passed back up to the node before the JCN. This allows you to continue processing after the call to propagate if you need to, for example to propagate another message (same or different) or, catch and handle downstream exceptions.
Kind 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 |
|
 |
gappodi |
Posted: Sat Apr 01, 2017 4:32 pm Post subject: |
|
|
 Voyager
Joined: 05 Sep 2014 Posts: 76
|
@{MGK, Timber}.. Thank you guys for making me realize and learn an easy BUT important concept which one MUST be aware of while developing the message flows.
In my case, it was the catch node sitting at the beginning of the message flow that was supposed to do a lot of things if there was an exception down the flow and caught by this node. But the way I wrote the JCN, it was getting caught at that very level and nothing was happening.
Regards,
Gappodi |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|