When you use spring then you mark the service method as @Transactional.
So the method marks the begin and end of the transaction. So at the end
of the transaction
the jms message is either committed or rolled back. If the service
accesses a databases then the database transaction is also taking part
in the transaction.
Using jta you can have transactions that span more than one service. The
problem is that this does not really scale well as the central
transaction management can negate the effect of additional servers or
threads.
Christian
Am 06.02.2012 23:14, schrieb rouble:
Hi Christian,
Thanks for the comments. One thing I am missing is how is the
beginning of a transaction indicated via a SOAP web service? Or the
committing of a transaction?
tia,
rouble
On Mon, Feb 6, 2012 at 4:23 PM, Christian Schneider
<[email protected]> wrote:
One way is to use SOAP/JMS where transactions should work. If you combine
this with a JTA transaction you should be able to get real transactional
behaviour.
One problem with http is that you do not even have guaranteed delivery. For
example you might send a request, then the connection breaks and still the
call will
do itæ„€ effect. A very important best practice here is to use idempotent
service contracts. So you can retry the call and it will only be executed
once. For example you can create a unique id before the call. So if the call
fails to return a result but has an effect on the server you can retry and
the second call can be ignored by the server.
If rollbacks need to be done only very seldomly you can do them manually.
You just log the failure for a human to correct the problem. This sounds
weird for us developers but is quite common in business.
Christian
Am 06.02.2012 21:30, schrieb rouble:
CXF Gurus, and Users,
How are developers implementing SOAP web services that are
transactional. For instance, if I have a bank web service that does:
api call: debit savings $10
api call: credit checkings $10
I need to be able to begin a transaction before the api calls, and
commit it after. If either one of the apis fails, I need to be able to
rollback.
I understand there are standards such WS-AtomicTransaction,
WS-Coordination and such. But how are people implementing these kinds
of functions in the absence of those standards being implemented in
CXF?
Obviously, one way would be to re-write the above api calls as one api
call:
api call: transfter savings checkings $10
But that is not always an option depending on the API.
tia,
rouble
--
Christian Schneider
http://www.liquid-reality.de
Open Source Architect
Talend Application Integration Division http://www.talend.com
--
Christian Schneider
http://www.liquid-reality.de
Open Source Architect
Talend Application Integration Division http://www.talend.com