.net - Internal details of how 2 phase or 3 phase commit works over WCF -


[servicecontract] public interface iservice2 {     [operationcontract]     [transactionflow(transactionflowoption.allowed)]     void updateservice2(); }  [servicecontract] public interface iservice1 {     [operationcontract]     [transactionflow(transactionflowoption.allowed)]     void upload();  } 

client code


using (var scope = new transactionscope()) {     iserviceclient client = new iservice1client();     client.upload();      iservice2 test = new iservice2client();      test.updateservice2();      messagebox.show("all well!!!");      scope.complete(); } 

i want understand 2 phase or 3 phase commit in detail on wcf.

i understand theoretically architecture of 2 phase commit.

understanding

  1. the service1 , service2 hosted in different urls
  2. the above distributed transaction

questions

  1. when wcf configured percall, how distributed transaction happen internally in wcf - momentarily save state session can commit when actual commit called?

  2. so session of states kept alive client till transaction completed? - keep reference of db transaction ?

  3. when concurrent request wcf guarantee 2 request have 2 different transactions , not club them - if how know 2 different request?

the question may elementary, looking understand above concepts design solution project.

your question contains 6 questions. try address them 1 @ time.

i want understand 2 phase or 3 phase commit in detail on wcf.

wcf uses either ws-atomictransaction or oletransaction via msdtc orchestrate transactions, , both these standards support 2-phase commit.

when wcf configured percall, how distributed transaction happen internally in wcf

you asking question can answered developers wrote wcf.

does momentarily save state session can commit when actual commit called

a process similar describe must logically happen, internals of how works unimportant. does actually work is important. managed resource manager on machine service lives on. msdn:

for distributed transactions, each computer has local transaction manager. when transaction work @ multiple computers, transaction managers interact other transaction managers via either superior or subordinate relationship. these relationships relevant particular transaction.

so session of states kept alive client till transaction completed? - keep reference of db transaction ?

see answer above question.

when concurrent request wcf guarantee 2 request have 2 different transactions , not club them together

it better do.

if how know 2 different request?

when request comes in thread dispatched service request. if wcf couldn't distinguish 2 different incoming requests don't think microsoft have released enterprise-grade web service platform.

i looking understand above concepts design solution project

perhaps better off trying understand how distributed transactions work on windows:

from pro wcf 4: practical microsoft soa implementation nishith pathak:

the two-phase commit protocol lets nodes involved in distributed transaction participate in atomic manner...(and) has 3 stages: active, phase 1, , phase 2. in active stage transaction created. superior resource manager (the resource manager of creator) enlists other resource managers, become active in transaction. in phase 1, creator issues commit command transaction, , enlisted resource managers respond whether prepared commit. if managers prepared commit, transaction move phase 2, otherwise abort.

in phase 2, superior resource manager write durable entry internal log, , issue commit enlisted resource managers. once done, superior resource manager begin sending commit enlisted resource managers and, irrespective of errors...will continue until enlisted resource managers have been sent commit message. superior resource manager wait confirmation of commit enlisted resource managers, error message, or until timeout occurs. should enlisted resource managers respond positively commit, superior resource manager erase log entry, , transaction end.


Comments

Popular posts from this blog

tcpdump - How to check if server received packet (acknowledged) -