Picture the scene;
I have a mobile App that withdraws $20 from a Spring managed Server and waits for confirmation before marking it complete on the app.
However;
-
Mobile app sends the withdraw request to the server
-
Controller receives the request and calls the server tier how service tier takes an un-usually long time to withdraw the money (reason not important ).
-
Mobile App times out (with a SocketException) and the request is re-queued until it can speak to the application again.
-
The Server completes the request from 1 but does not know the client has timed out.
We now have the scenario in that the mobile application believes the 20 dollars failed but the server carried out the request.
So the questions;
• Can Spring transactions Rollback when sockets are closed (i.e. when the mobile application times out the request)?
• If not – what is the best approach to achieve the above?
Some info on the server
• Spring 3.1
• Spring based controllers/services/DAO’s.
• Hibernate (JPA)
• MYSQL Data store
Thanks,
Ian.
At the moment I can’t imagine how that might work …
I would deal with the problem like this:
Hope that helps.