-
Notifications
You must be signed in to change notification settings - Fork 18
How it works
The mechanics of the Ratel on both client and server is based on standard mechanisms of the Spring container.
@Publish //This bean will be made available by http exporter and registered in the service registry
public class MyServiceImplementation
implements MyService /*<- first implemented interface */, Serializable {
On server side, when service application context is starting up, ServiceRegisterPostProcessor after initialization, finds all beans annotated with @Publish annotation and does the following things:
- It determines a first interface implemented by the bean and considers it as a Contract interface
- It creates a Hessian exporter bean mapped to the path ''/ratelservices/'' so that all http requests to the service will be handled by this exporter. The bean is then added to the application context.
- It determines a absolute address of the service and registers it to the Registry server.
After this is done, the clients can bind to the address of the service and send requests to it.
public class MyClientApp {
@Discover
MyService serviceClient; //<- lazy proxy for _MyService_ will be injected here
On client side, when application context is starting, during the properties populating phase, RemoteAutowireCandidateResolver resolves all autowired injection points annotated with @Discover annotation and injects a lazy proxy bound to the declared field/parameter type. The endpoints for this service will discovered at a first usage of the proxy.
For more details please refer to section Examples