Use a Server-Side Proxy to Manage Transactions Across Servers
Sometimes a client will make a series of calls to a server, and these calls, while conceptually a transaction, aren’t easily batched, or don’t feel like a batch method. A classic example of this is transferring money between two bank accounts.
If you have two distinct servers (one for each account), this involves the following four steps:
Opening a transaction (presumably using a transaction management server)
Withdrawing money from one server
Depositing the money in another server
Committing the transaction
This sequence of calls should not be executed from a client application for two reasons. The first is that client applications are often deployed across a WAN, which is slow (especially compared to a datacenter managed by IT personnel). Making four concurrent remote method calls under those conditions could lead to significant performance problems.
The second reason is that logic about transactions will most likely change. Even something as simple as “We’ve decided to log all money transfers from now on” would force you to redeploy a new version of the client that would call a logging method on a server somewhere, which is very bizarre in and of itself.
The solution is to use a server-side proxy for the client. A server-side proxy is a server, running “near” the other servers, which is client-specific and whose sole role is to manage complex transactions for the client. If you’re using a server-side proxy, the previous ...