Skip navigation
2005

Tom Elrod's Blog

January 2005 Previous month Next month

 

The way software systems make calls from one system to another is pretty much the same, regardless of implementation. One system sends data to another and either does or does not expect data in return. I know this is greatly simplifying it, but wouldn’t it be great if it were that simple. This is the purpose of JBoss Remoting; to provide a framework with a single, simple API for most network based invocations and related services. This allows for users to change the transport protocol (i.e. socket, http, or rmi) as well as data marshalling format (i.e. serialization, iiop, or jaxrpc) for their remote invocations without ever having to change their code.

 

The design of JBoss Remoting is such that the user only needs a simple url string in order to be able to identify and call upon any remote server. For example, the string ‘socket://192.168.0.42:5400’ is all the information that is needed to make a call on the JBoss Remoting server using the socket transport on host 192.168.0.42, which is listening on port 5400.

 

On the server side, the user only needs to implement a simple invoke method that the remoting server will call upon with it receives a remote invocation. This invoke method implementation will remain the same, regardless of any transport or marshalling changes.

 

Setting up a remoting server is easy. The following shows the code from the samples in the remoting release for configuring and starting a remoting server.

 

 

 

String locatorURI = “socket” + "://" + “localhost + ":" + 5400;

 

Connector connector = new Connector();

 

connector.setInvokerLocator(locatorURI);

 

connector.start();

 

 

 

SampleInvocationHandler invocationHandler = new SampleInvocationHandler();

 

connector.addInvocationHandler("sample", invocationHandler);

 

 

 

Making a call on this server is just as easy to code:

 

 

 

String locatorURI = “socket” + "://" + “localhost” + ":" + 5400;

 

InvokerLocator locator = new InvokerLocator(locatorURI);

 

Client remotingClient = new Client(locator);

 

Object response = remotingClient.invoke("Do something");

 

 

 

That’s all there is to it. To change between from using a socket based transport to http, just change the “socket” string to “http”.

 

JBoss Remoting 1.0.1 beta has just been released. See the project page (http://www.jboss.org/products/remoting) for more info on remoting (including full user’s guide, demo, and distribution). To wet your appetite, here is a list of features included in JBoss Remoting:

  • Server identification – a simple String identifier which allows for remoting servers to be identified and called upon.
  • Pluggable transports – can use different protocol transports, such as socket, rmi, http, etc., via the same remoting API.
  • Pluggable data marshallers – can use different data marshallers and unmarshallers to convert the invocation payloads into desired data format for wire transfer.
  • Automatic discovery – can detect remoting servers as they come on and off line.
  • Server grouping – ability to group servers by logical domains, so only communicate with servers within specified domains.
  • Callbacks – can receive server callbacks via push and pull models.
  • Asynchronous calls – can make asynchronous, or one way, calls to server.
  • Local invocation – if making an invocation on a remoting server that is within the same process space, remoting will automatically make this call by reference, to improve performance.