Using KSB, it is possible to instantiate and invoke objects on other machines remotely. To accomplish this use an ObjectDefinition to inform KSB how to instantiate the object on the remote machine and which messageEntity you are targeting:
ObjectDefinition od = new ObjectDefinition(TestClient1ObjectToBeRemoted.class.getName(), "TestCl1");
Above is the default example, you can add constructor parameters and properties to be set during instantiation. Use the proxy to the object and invoke the object according to the interface you cast the object to.
RemotedObject remotedOjb = (RemotedObject) GlobalResourceLoader.getObject(od); String returnParam = remotedOjb.invoke("call1");
There are some caveats when doing this:
Do this only when using JTA. KSB relies on JTA to know when to clean up the remote object on the remote machine.
The object will live during the currently running transaction on your machine. Either JTA transaction completion or rollback triggers cleanup.
The remote proxy will retain all non-Spring based interfaces of the object on the remote machine.
The object must return Serializable objects for methods called and take Serialized parameters.
This only works for Java clients. Objects are exported using Java for Java. There is no SOAP remoting of objects.