sql server - Transaction between SQL Azure and Azure Table Storage -


at current project working on distributed cloud application store state of entity , associated events. when message recieved queue update state of entity in sql azure , save events associated update in table storage.

it looks this:

  • start unitofwork
    • update entity in sql azure
    • save events table storage
    • commit transaction
  • end unitofwork

the problem encountering here can't submit changes in sql azure , table storage within 1 transaction. when saving of entity in sql azure fails, want rollback saving of events in table storage.

any appreciated.

if understand objectives trying cover following 2 scenarios:

  • if db insert fails, rollback azure table
  • if azure table insert fails, rollback sql azure

assuming performing both requests inside same thread, did try approach (pseudo-code)? note using transactional capability of database engine; not same msdtc because doing single connection - supported.

dbconnection.begintransaction;  try {       // add record in database - in transaction can rolled      insert_into_sqlazure;      } catch {      // automatic rollack - exist error     exit_with_error; }  try {      insert_into_azure_table;      dbconnection.committransaction; } catch {     dbconnection.rollback;     exit_with_error; } 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -