-
-
Notifications
You must be signed in to change notification settings - Fork 107
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 it looks for available port (0) the reason is to make it more easy to test with less configuration
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
discovery port
is the port used by cluster to discover cluster members peers, detect failures, manage gossips
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 )