Cluster4Spring remoting includes custom version of remote service exporters. However, while Cluster4Spring exporters include some additional features in comparison with ones offered by Spring, it is possible to use standard Spring remoting for all supported remoting schemes except for dynamic discovering one-to-many remoting scheme.

Remote service exporter

To export some bean as remote service, Cluster4Spring uses the same notion of Exporter as Spring does. The exporter included in Cluster4Spring has similar functionality with that of Spring and can be configured in a similar way.

In addition to functionality of standard Spring exporter, Cluster4Spring-based one allows specifying whether trace interceptor should be used to track incoming remote calls and, if necessary, provide implementation for such interceptor. Also, Cluster4Spring based exporter makes it possible to specify the list of interceptor names that will be applied to every invocation of remote call.

With Cluster4Spring based exporter it is also possible to specify whether particular remote service be available for dynamic auto-discovering (please refer to the following section for details).

Quick configuration example

This is a quick example of minimal configuration for declaration of remote service exporter assuming that RMI is used as underlying remoting protocol.

<bean class="org.softamis.cluster4spring.rmi.RmiServiceExporter">
   <property name="registry" ref="_RMIRegistry"/><property name="service">
      <bean class="org.softamis.cluster4spring.example.ServiceImpl"/>
   <property name="serviceInterface"
   <property name="serviceName" value="TestService"/>

As it is illustrated by listing above, in general exporting of remote service in Cluster4Spring is very close to exporting remote service using standard Spring remoting.

Remote service publisher

If one-to-many with dynamic services discovering remoting scheme is used, it is necessary to register remote services in distributed services registry. Such a registration is performed by ServicePublisher.

The actual publishing of remote services information in distributed registry is performed by ServicePublisher (and that is why configured instance of ServicePublisher should be present in Spring context).

The following diagram illustrates process of publishing information about remote services exposed in particular Spring context to distributed services registry:

Publishing of remote
services to distribute registry

To simplify configuration of remoting related subsystem (and to simplify internal architecture of remote service Exporter), each exporter does not store information about its service in distributed services registry. Instead, it just provides API that allows determining whether remote service exported by it should be stored in remote services registry as well as obtaining data that should be stored in services registry.

During initialization of Spring context, ServicePublisher collects exporters with specified class from Spring application context.

As soon as list of exporters is collected, ServicePublisher invokes instance of ExporterAcceptor (which is provided as a part of ServicePublisher configuration) to examine each exporter and decide whether information on remote service exported by that particular exporter should be added into distributed services registry which is associated with particular instance of ServicePublisher.

Finally, ServicePublisher iterates over the list of exporters that are ready for publishing, retrieves information about remote service and stores it in distributed services registry.

On closing of Spring application context, ServicePublisher iterates over the list of published exporters and removes appropriate information about published remote services from distributed services registry.

Quick configuration example

This is a quick example of minimal configuration for declaration of remote service publisher.

<bean id="RMIServicesPublisher.minimal"
�� <property name="servicesRegistry" ref="_ServerServicesRegistry"/>

For futher details about configuration of server part of Cluster4Spring remoting, please refer Examples of Configuration. Logo   Support This Project