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.  How to commit or roll back all local transactions at the same time?

    Posted Tue March 14, 2006 05:55 PM

    Hi,
    I’m building a few adapter services using one db connection with local_transactions type. These services will update the data in a few different tables. If any one of update fails, I want to roll back all transactions, so it means all transactions commit or roll back must be completed at the same time. I did not see any hint in the Adapter User’s Guide. How can I solve this issue?
    Your help is really appreciated!

    Thanks,


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


  • 2.  RE: How to commit or roll back all local transactions at the same time?

    Posted Wed March 15, 2006 01:00 AM

    Use explicit transactions. The JDBC guide has info on doing that.


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


  • 3.  RE: How to commit or roll back all local transactions at the same time?

    Posted Wed March 15, 2006 03:20 PM

    Hi Rob,
    Thanks for your help. I used the explicit transactions, but you can not put multiple insert/update services under one local transaction. The pseudo-code below is invalid, but I want to know is there any way I can implement this function? I want to commit after all insert or update services completed sucessfully and rollback all transactions if anyone of them fails.

    start transaction
    sequence (exit on sucess)
    sequence (exit on failure)
    –insert service 1
    –insert service 2
    –update service 1
    –commit
    sequence (exit on done)
    –rollback

    Regards,
    Mike


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


  • 4.  RE: How to commit or roll back all local transactions at the same time?

    Posted Wed March 15, 2006 04:54 PM

    Have you run into an error when doing this? My understanding is that as long as all the inserts/updates/deletes are for the same connection, it will work. It’s when multiple connections, which are configured with LOCAL_TRANSACTION, are used that it won’t work. In that case, only one of the connections can be LOCAL_TRANSACTION and the others need to be XA.


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


  • 5.  RE: How to commit or roll back all local transactions at the same time?

    Posted Wed March 15, 2006 05:18 PM

    Hi Rob,
    Thanks. It does work when using one connection with local transaction type, but I found a minor trick. Please see the following code.

    Scenario #1 - WORK:
    start transaction
    sequence (exit on sucess)
    sequence (exit on failure)
    –insert service 1
    –insert service 2
    –update service 1
    –commit
    sequence (exit on done)
    –rollback

    Scenario #2 - NOT Work:
    start transaction
    sequence (exit on sucess)
    sequence (exit on failure)
    –insert service
    –call a flow service which includes a select service using same connection with local transaction type
    –update service
    –commit
    sequence (exit on done)
    –rollback

    Anyway, it solves my problem.

    Thanks again,


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


  • 6.  RE: How to commit or roll back all local transactions at the same time?

    Posted Wed March 15, 2006 06:08 PM

    You should be able to make the second scenario work as well. The key is to make sure the transaction ID is available to the flow service. If the ID isn’t available, it will try to start another tx, which you’ve seen causes trouble.


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


  • 7.  RE: How to commit or roll back all local transactions at the same time?

    Posted Wed March 15, 2006 07:47 PM

    You are right. That’s the way to solve the issue in the Scenario #2.
    Appreciate your help.


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