Transactions and SOA



There are 2 types of TXs (and they are not atomic and longrunning)


1-     Within my borders


2-     Across borders


1-    Within my borders means that simply I have control overall the resources and parties that take place in this TX. It is within myborders so I should be able to control it, but again THIS IS NOT ATOMIC TX.


In this type I can use either atomic TX or long running. Both of them pass the autonomy test of SOA . everysystem tries to control its own resources. I don’t accept someone fromoutside to control my own resources or lock them. So all systems within myborders are controlled by me. The main point here is to define the border.


2-    Across borders means that I have to fire a call to aremote system outside my border, eg online purchase where many systems areinvolved.


a.      Can atomic TX works here ? normally no because most probable we will get time out .but is this the only reason , NO. let’s take a look on a simple example:system1 initiates a TX and is calling system2 to include its resources in theTX. Will system2 accepts that system1 puts locks on its internal resources .this violates the Autonomy tenet of SOA. Even if I trust you , I cannot giveyou locks over my resources, which you might hold forever. And even if I do trust you , the whole TX might timeout because of cross bordering. the whole question here is not about trust, because even if i trust, you can hold my resources forever.


Any Solutions ?


 


1-     Reservation Pattern: you go to airlines andtry to book a seat in a flight. Do they lock the seat for you if you didn’tpay for the ticket ? NO , they just give you a reservation number and a date .if you come later than this date then your reservation is cancelled. You don’tcontrol their resources or have locks on them.


2-     OkOk . I will pay for the ticket then. Would you please lock the seat for me(locka resource on your system for me) ? JJ JJ JJ JJ JJ JJ JJ JJ JJ


They reply: sure J J


Then you go late on yourtravel day (1hr before the flight) and you find the flight over booked and theytell you SORRY,FLIGHT IS OVERBOOKED.  WHAT ? WHERE IS MY LOCK THEN ?


Or you buy somethingonline and after sometimes , they tell you SORRY . we don’t have stocknow. As soon as we get it , we will ship it for you.


In all cases what they aredoing is lying in the first place , then TRY to compensate you .


Lying/Compensating Pattern:  you have to lie in thiscase by deceiving the calling system that asks for locks and says “ok itis locked for you” then later on if anything goes wrong , you compensate.Do you want your money back? Sorry for the flight , we will upgrade you tobusiness class next flight for free (Compensation).


3-    Irresponsible/CompensatingPattern:  warn the customer from beginning about losing aflight so please come 3 hrs early we are not responsible if you come late(stillnot 100% guarantee coz flight might be overbooked), etc..  but still thesystem has to compensate by some way or another.


 


 


Summary:


1-    Know your borders. So you can identify which type of TXare you using.


2-    If it is type1 “Within Border”, try to useAtomic TX as you can , if you will not get time out


3-    If type2 , then think proactively and carefully aboutcompensation.









 


 


Skip to main content