Author |
Message
|
bprasana |
Posted: Thu May 06, 2010 4:32 pm Post subject: Question on Transaction Management |
|
|
 Disciple
Joined: 18 Apr 2005 Posts: 179
|
I am sure this is a common scenario.
Requirement says : Update 2 applications in a Transaction.
One is a database that a Broker can access.
The other one is a Mainframe system, with no rollback capability.We interact through MQ Queues.
Which is the best way to handle this?
Do i update 'local' database first but hold the commit till I update a Mainframe system? (is it possible??).
Thanks
bprasana |
|
Back to top |
|
 |
smdavies99 |
Posted: Thu May 06, 2010 9:50 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
do you get a reply message showing success/failure from the MF?
Your question does not indicate this _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
bprasana |
Posted: Thu May 06, 2010 9:52 pm Post subject: yes |
|
|
 Disciple
Joined: 18 Apr 2005 Posts: 179
|
Yes..I will get a notification from MF. for Success and Fail |
|
Back to top |
|
 |
fatherjack |
Posted: Fri May 07, 2010 12:37 am Post subject: |
|
|
 Knight
Joined: 14 Apr 2010 Posts: 522 Location: Craggy Island
|
bprasana wrote: |
Update 2 applications in a Transaction. |
You can't in your scenario.
smdavies99 wrote: |
do you get a reply message showing success/failure from the MF? |
It doesn't matter whether you do or not.
For example, what if you get a success response from m/f then your database update fails. And how long are you going to wait for a response from m/f? Forever? What if you give up waiting - do you rollback your database update on the assumption your m/f app has failed. What happens then if the success message arrives late from m/f.
The scope of your transaction should be updating the database and putting the message to the queue and then committing that. The mainframe transaction is a separate transaction which gets the message and updates its resources and commits. If the mainframe transaction fails you'll need to implement something else to handle this scenario - maybe a compensating transaction, or some form of retry or maybe even manual intervention.
Or don't use WMB and MQ but rather use a distributed transaction processing monitor which can manage the distributed transaction as a single UOW. _________________ Never let the facts get in the way of a good theory. |
|
Back to top |
|
 |
bprasana |
Posted: Fri May 07, 2010 4:44 pm Post subject: thanks |
|
|
 Disciple
Joined: 18 Apr 2005 Posts: 179
|
Thanks fatherjack
I guess thats the approach I need to take. Since i dont have option of replacing WMB/MQ |
|
Back to top |
|
 |
smdavies99 |
Posted: Fri May 07, 2010 11:02 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
The reason I asked if there is a success/fail message coming back from the M/F is that is there is, you can put a MQGet node in your flow with a timeout and if that expires then you can roll back the other work just as if you got a failure.
You are sort of doing a one message aggregation. Fire off a request and then wait a while for it to complete. If nowt comes back then roll everything back.
If failure comes back, roll everything back. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
bprasana |
Posted: Sat May 08, 2010 6:13 pm Post subject: Correct, But.. |
|
|
 Disciple
Joined: 18 Apr 2005 Posts: 179
|
what fatherjack said is also correct. What will happen if the success response comes in late. I really dont have any mechanism to roll back that.
I need to probably have another monitoring flow which will check for these replies and update the database automatically.
But coming back to your point smdavies99, how would the design look like in ur case?
If I were to update my database first using a stored proc for db2 9.5 and then send MQ ms to update Mainframe. will i still be able to hold the commit for my database till i get msg back from mainframe.?
or do you suggest updating the MF first and then the db2?
thanks
bprasana |
|
Back to top |
|
 |
smdavies99 |
Posted: Sun May 09, 2010 12:41 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
It depends...
If you are doing the DB2 insert in a flow that is transactional then you could do it before the MF Send./receive.
If your flow is not transactional and you do it before the MF operation then if it failed you would have to then delete the updated data manually. This is what is known as a compensating transaction.
In the latter case I'd probably do the MF operation first. Then you only need to do the DB2 operation if you get Success back.
Ok, this is a pretty simplistic answer. There is most certainly a lot more things to consider in an operation like this that is outside the scope of this forum. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
|