IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Roll Back Issue

    Posted Tue October 12, 2010 07:32 PM

    Hi.

    I have several services that insert/update records on tables.

    Each of these services (A,B,C) have the following structure:

    1.StartTransaction (store in localVariable)
    2.Try
    2.1 Logic
    2.2 CommitTransaction (localVariable)
    3.Catch
    3.1 Logic
    3.2 RollbackTransaction (localVariable)

    The services work ok, so far so good… :smiley:

    But now I need another service that needs to call several of these services

    Main Service
    1.StartTransaction (store in lVariable)
    2.Try
    2.1 call service A
    2.2 call service B
    2.3 call service C
    2.4 CommitTransaction (lVariable)
    3.Catch
    3.1 Error Logic
    3.2 RollbackTransaction (lVariable)

    My issue here is that if any of the services A, B or C fails, the main service should rollback without commiting anything to the DB.

    What is actually happening is that when service B fails, the main service rollbacks but changes made by A are already commited and do not rollback! :angry:


    #Integration-Server-and-ESB
    #webMethods
    #Adapters-and-E-Standards


  • 2.  RE: Roll Back Issue

    Posted Tue October 12, 2010 09:49 PM

    That’s correct because a commit is being done in A.


    #Integration-Server-and-ESB
    #webMethods
    #Adapters-and-E-Standards


  • 3.  RE: Roll Back Issue

    Posted Wed October 13, 2010 08:56 AM

    Don’t do start, commit and Rollback in services A,B and C.

    In your parent/Main service do start, commit and rollback.
    Thus if service B fails the insertion/updation done by service A will be rollbacked.

    Commit your transaction in Parent service after the completion of service A,B and C.


    #Adapters-and-E-Standards
    #Integration-Server-and-ESB
    #webMethods


  • 4.  RE: Roll Back Issue

    Posted Wed October 13, 2010 09:34 AM

    The issue is that services A, B and C can be called from CAF and require that either all logic is done or everything is rolled back. So I need commit and rollback in services A, B and C…

    :confused:

    What I have done is to add an input variable to the A, B and C services that enable the transactions or not. This will allow the services to be called independently with transactions or by the Main service without using transactions inside.

    The flow runs trough all A, B and C and the main commit returns the error:

    AuditLogManager Exception: java.lang.NullPointerException
    commit failed: more than 1 local trans enlisted. xid = [FormatId=45744, GlobalId=/1286811217265, BranchQual=1] rxid = {2}
    delisted transaction commit failed: java.lang.IllegalStateException: commit failed. more than one local transaction enlisted. xid = /1286811217265
    Adapter Runtime: Error Logged. See Error log for details. Error: [ART.114.303] Adapter Runtime (Transaction): Unable to commit transaction.
    Adapter Runtime (Adapter Service): Error(s) occurred while closing adapter connections.

    :eek:

    The rollback runs ok. :lame:


    #Integration-Server-and-ESB
    #webMethods
    #Adapters-and-E-Standards


  • 5.  RE: Roll Back Issue

    Posted Wed October 13, 2010 06:29 PM

    Are A, B and C all using the same connection pool? If not, then that’s the issue. Only one connection in a transaction can be LOCAL_TRANSACTION. The others need to be XA_TRANSACTION.


    #Integration-Server-and-ESB
    #Adapters-and-E-Standards
    #webMethods


  • 6.  RE: Roll Back Issue

    Posted Fri October 15, 2010 01:38 PM

    Thanks!!!

    XA Transactions do solve the nested transaction issue.


    #Integration-Server-and-ESB
    #Adapters-and-E-Standards
    #webMethods