Skip to content
Ronen edited this page Feb 23, 2019 · 3 revisions

Q: is it possible to register several services in same jvm behind fixed port?

you can control what port you want and have all services in one jvm actually scalecube-services is very flexible about that and you can scale later at any given point of time the deployment and packaging is totally decoupled from development.

in the example bellow lets register 3 services (A,B,C) in same Microservices node (same jvm) and set the transport port to 3800 (fixed) and discovery port 4800 (fixed)

if not provided then by default Microservices looks for available port (0).

Microservices ms = Microservices.builder()
        .transport(options -> options.port(3800))
        .discovery(options -> options.port(4800)
            .seeds(Address.create("127.0.1.1",4800)))
        .services(new ServiceA(),new ServiceB(),new ServiceC())
        .startAwait();
  • transport port is the port used for services to communicate (mainly via rsocket)
  • discovery port is the port used to discover peers, detect failures, manage gossips (cluster control port)

the only limitation is that you cant register same service in same microservice instance but you can register same service under same jvm (different ports) by same service i mean same service interface (same service name and same service method )