Author |
Message
|
phaniIIB |
Posted: Tue Apr 19, 2016 4:18 pm Post subject: Transactional commit in java compute node |
|
|
Acolyte
Joined: 28 Jul 2015 Posts: 51
|
Hi all,
I have a use case where there is an infinite loop running in Java compute node. My application : MQInput node --> Java Compute --> MQOutput node.
So the Java compute here runs an infinite loop. The problem here is that the messages are uncommited while they are pushed to MQOutput, since the JCN runs an infinite loop. How to make every iteration in the infinite loop transactional. The message output generated in every transaction needs to be commited.
Thanks in advance, |
|
Back to top |
|
 |
smdavies99 |
Posted: Tue Apr 19, 2016 9:21 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
A JCN (or any IIB Compute node for that matter) must not run in an infinite loop.
Sooner or later you will crash the Execution group.
Don't do it. Refactor your code to avoid this. It is possible...
Then you won't have this problem. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Apr 20, 2016 4:11 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Why would it possibly run in an infinite loop? _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
maurito |
Posted: Wed Apr 20, 2016 4:58 am Post subject: |
|
|
Partisan
Joined: 17 Apr 2014 Posts: 358
|
mqjeff wrote: |
Why would it possibly run in an infinite loop? |
I don't think the OP means an infinite loop, unless he/she has made a coding error. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Apr 20, 2016 5:08 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
maurito wrote: |
mqjeff wrote: |
Why would it possibly run in an infinite loop? |
I don't think the OP means an infinite loop, unless he/she has made a coding error. |
Ok. But then, what does
Quote: |
So the Java compute here runs an infinite loop |
mean ? _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
maurito |
Posted: Wed Apr 20, 2016 5:13 am Post subject: |
|
|
Partisan
Joined: 17 Apr 2014 Posts: 358
|
mqjeff wrote: |
maurito wrote: |
mqjeff wrote: |
Why would it possibly run in an infinite loop? |
I don't think the OP means an infinite loop, unless he/she has made a coding error. |
Ok. But then, what does
Quote: |
So the Java compute here runs an infinite loop |
mean ? |
Probably it runs a loop. That loop should have a condition to stop sometime. Otherwise he/she will have to kill the process in order to stop (hmm.. you never know...). |
|
Back to top |
|
 |
Vitor |
Posted: Wed Apr 20, 2016 5:23 am Post subject: Re: Transactional commit in java compute node |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
phaniIIB wrote: |
I have a use case where there is an infinite loop running in Java compute node. My application : MQInput node --> Java Compute --> MQOutput node. |
As others have said, that's a horrible design.
phaniIIB wrote: |
How to make every iteration in the infinite loop transactional. The message output generated in every transaction needs to be commited. |
How about using IIB's inbuilt transactional model, where each flow execution is a transaction, rather than writing a JCN like it's a long running Java app hosted in WAS? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Apr 20, 2016 5:23 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
maurito wrote: |
Probably it runs a loop. That loop should have a condition to stop sometime. Otherwise he/she will have to kill the process in order to stop (hmm.. you never know...). |
I find the wording not as ambiguous as that. _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
Vitor |
Posted: Wed Apr 20, 2016 5:24 am Post subject: Re: Transactional commit in java compute node |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
phaniIIB wrote: |
I have a use case where there is an infinite loop running in Java compute node. My application : MQInput node --> Java Compute --> MQOutput node. |
Also that's not a use case - that's a technical solution.
What's the actual, original, design requirement that this is supposed to fulfill? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
inMo |
Posted: Wed Apr 20, 2016 7:57 am Post subject: |
|
|
 Master
Joined: 27 Jun 2009 Posts: 216 Location: NY
|
An infinite loop is not a design, it is an accident. I'll assume you are using the term loosely to mean you perform 1 to n iterations determined dynamically based on incoming message contents. If you really want each iteration's output from the JCN to be written to the queue regardless of subsequent processing, check how you are writing the message to the queue. It really doesn't have anything to do with the JCN. |
|
Back to top |
|
 |
timber |
Posted: Wed Apr 20, 2016 11:27 pm Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
@phaniIIB: Please explain your design in more detail. We are confused!
After that, feel free to explain your problem again. |
|
Back to top |
|
 |
pmasters |
Posted: Thu Apr 21, 2016 12:36 am Post subject: |
|
|
Novice
Joined: 19 Jul 2011 Posts: 14
|
Aside from the "infiniteness" of the loop (as discussed above and which I agree with) to emit MQ messages from inside a flow that are not associated with the overall flow transaction (i.e. immediately available on the output queue) you should just set the MQOutput node transaction mode to "no" on its property panel.
This means that when it updates MQ, it will not participate in the flow transaction. However, the point about overall flow design that others have raised is absolutely valid - by causing an infinite loop in the flow, you're circumventing the architected framework the flow provides, which means memory cleanup, stats, transactions etc will not work the way you want, so would recommend revisiting the design. _________________ ===========
Peter Masters |
|
Back to top |
|
 |
|