Skip to content

Service discoverability principle

lukaszPulawski edited this page Apr 30, 2015 · 1 revision

Service discoverability is one of core features of Ratel, enabling trivial integration of (micro-)service oriented distributed applications. It deliberately provides only one, most desired discoverabilty type, namely discoverability by contract, which in java world can be rephrased to discoverability by java interface. It means that a service is uniquely identified by the business interface it implements. As a consequence, you should not have two different services that implement the same interface, because Ratel will not distinguish them.

How service is discovered?

Given the block code:

public clas MyApp {
  @Discover
  private MyService serviceClient;

Ratel will inject a lazy proxy that will discover all registered instances of a service uniquely identified by MyService interface.

How service is exposed.

So, how the lazy proxy will know where to post the requests? Given the block code:

@Publish
public class MyServiceImpl implements MyService {...

Ratel will expose this bean at the address constructed according to the following pattern:

http://<value of property jboss.bind.address>:<value of property jboss.bind.port>/<dispatcher servlet's context path>/ratelServices/MyService

It means that the service provider application must have jboss.bind.address and jboss.bind.port properties set.

Services are supplemented with communicative metadata by which they can be effectively discovered and interpreted.

Ratel uses the Registry server to ensure that all metadata is implicitly exchanged between services, clients as well as tracing and monitoring applications. The only information that must be shared between them is the address of the registry server