What shall be done to pass one object from one server to another. Suppose i have an application distributed over multiple servers. On one server i am creating account and on the other handling the transactions with respect to the account. Now i want to send account object to the other server handling the transactions. How can i do that?
See, the table used to store the account object wont be existing on the other server. That will only be having some transaction related tables that need some of the fields from the account object..So sharing the Db file wont help.
I am thinking of serialization as the best answer .. Means i will serialize an object at the first server then deserialize it while required at the other.. Is there any other better solution possible to it?
I think you need to be more precise in asking this question - if I understood it correctly, there can be either of following two possibilities :
1. When an account object is created (or any other event happens ) on Server1 you want to notify server2 with that event and pass the data ?
2. Server1 and Server2 just want to share some Data, Assuming both the servers have the appropriate handle for that data (Identifier/primary key etc are available to both the servers.)
if Case 2 is correct then I think its simplest to share using the database/file.
If Case 1 is correct its slightly more work to be done, you will need to use messaging(JMS) or Remoting (EJB / RMI/ Webservices / plain socket communication) technologies depending on whether you want a push mechanism or pull mechanism. Simple File/DB polling is also an option. You should also consider the scenario the event is generated but receiver server is down.