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 IndexWebSphere Message Broker SupportJava compute node execution

Post new topicReply to topic
Java compute node execution View previous topic :: View next topic
Author Message
gappodi
PostPosted: Thu Mar 30, 2017 6:17 am Post subject: Java compute node execution Reply with quote

Apprentice

Joined: 05 Sep 2014
Posts: 41

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
View user's profile Send private message
timber
PostPosted: Thu Mar 30, 2017 6:53 am Post subject: Reply with quote

Yatiri

Joined: 25 Aug 2015
Posts: 654

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
View user's profile Send private message
gappodi
PostPosted: Fri Mar 31, 2017 7:43 pm Post subject: Reply with quote

Apprentice

Joined: 05 Sep 2014
Posts: 41

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
View user's profile Send private message
mgk
PostPosted: Sat Apr 01, 2017 3:57 am Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1583
Location: IBM Hursley, UK

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
IBM Global Blockchain Enablement
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
gappodi
PostPosted: Sat Apr 01, 2017 4:32 pm Post subject: Reply with quote

Apprentice

Joined: 05 Sep 2014
Posts: 41

@{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
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexWebSphere Message Broker SupportJava compute node execution
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.