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 » Compute node Transaction.

Post new topic  Reply to topic
 Compute node Transaction. « View previous topic :: View next topic » 
Author Message
18tillidie
PostPosted: Mon Jul 27, 2020 11:02 am    Post subject: Compute node Transaction. Reply with quote

Newbie

Joined: 04 May 2020
Posts: 9

Hi I am new to IIB and I need help to know the reason why the transaction is not being rolled back for a DB insert inside a while loop.

The compute node transaction property is set to 'Automatic'

Here is the code snippet.

WHILE LASTMOVE(reftoMessage) DO

SET A = reftoMessage.a;
SET B = reftoMessage.b;

call AddToDb(A,B);

SET C = reftoMessage.c;
SET D = reftoMessage.d;

call AddToDb2(C,D);


MOVE reftoMessage NEXTSIBLING REPEAT TYPE NAME;
END WHILE;

This loop runs for each record reftoMessage which is pointing to a DFDL.

AddToDb(A,B) and AddToDb2(C,D) are calling oracle stored procedures which insert values to the DB using EXTERNAL.
If there is any exception in SET D = reftoMessage.d; - say data type exception then the call AddToDb(A,B); should be rolled back where as I still see a new entry in the DB. even when the code comes out of the failure terminal or the Compute node.

Please help how to handle this exception.

Thank you.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Jul 27, 2020 11:56 am    Post subject: Re: Compute node Transaction. Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

18tillidie wrote:
AddToDb(A,B) and AddToDb2(C,D) are calling oracle stored procedures which insert values to the DB using EXTERNAL.
If there is any exception in SET D = reftoMessage.d; - say data type exception then the call AddToDb(A,B); should be rolled back where as I still see a new entry in the DB. even when the code comes out of the failure terminal or the Compute node.


The oracle stored procedure isn't in the same unit of work (transaction) as IIB. So the stored procedure will commit the result on completion because it's transaction is finished. This would be true for a stored procedure called from any language, not just from IIB.

18tillidie wrote:
Please help how to handle this exception.


Options:
- set up an XA transaction linking IIB & Oracle so that the stored procedure runs in the same unit of work as IIB and the commit/rollback is coordinated between the 2 products
- Use an ESQL INSERT statement to add records to the database. For a simple insert there's very little value in calling a stored procedure
- Add an equivalent RemoveFromDb(A,B) stored procedure to the IIB exception handling flow

The choice of solution is a choice you need to make based on your exact requirements. Other options are undoubtedly possible and may be better.
_________________
Honesty is the best policy.
Insanity is the best defence.
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 » Compute node Transaction.
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.