Pattern for distributed transaction?

  • Thread starter Thread starter Julia
  • Start date Start date
J

Julia

Hi,

I have a list of addresses in a data base
each address row contain a column name 'SENT' which indicate if a message
was sent to this address
a component is sending email messages to all addresses which contains
'FALSE' in the 'SENT' column

The email component is not transacted of course
But I am looking for a way to ensure that in case failing to update the
data base
No email will be sent to this row again

In general my question is if I have two components one support transaction
roll back etc
and one is not.
Is there a pattern which allow me to wrap them in some kind of a
semi-transaction?
maybe some two step update needed here?

Thanks in advance.
 
Julia said:
Hi,

I have a list of addresses in a data base
each address row contain a column name 'SENT' which indicate if a message
was sent to this address
a component is sending email messages to all addresses which contains
'FALSE' in the 'SENT' column

The email component is not transacted of course
But I am looking for a way to ensure that in case failing to update the
data base
No email will be sent to this row again

In general my question is if I have two components one support
transaction
roll back etc
and one is not.
Is there a pattern which allow me to wrap them in some kind of a
semi-transaction?
maybe some two step update needed here?

To encorporate a single non-transactional component in a transaction is
simple.

Just do the work for all the transactional components first. Then do the
work for the non-transactional component. If it fails, roll back the
transactional compnents; if it succeeds, commit.

So in your case, start a database transaction, update SENT to TRUE, send the
email(s), and then commit the transaction.

David
 
Back
Top