use of io.scalecube.services.routings.sut.TagService in project scalecube by scalecube.
the class RoutersTest method setup.
@BeforeAll
public static void setup() {
gateway = Microservices.builder().discovery(serviceEndpoint -> new ScalecubeServiceDiscovery().transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory())).options(opts -> opts.metadata(serviceEndpoint))).transport(RSocketServiceTransport::new).startAwait();
gatewayAddress = gateway.discovery().address();
// Create microservices instance cluster.
provider1 = Microservices.builder().discovery(endpoint -> new ScalecubeServiceDiscovery().transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory())).options(opts -> opts.metadata(endpoint)).membership(cfg -> cfg.seedMembers(gatewayAddress))).transport(RSocketServiceTransport::new).services(ServiceInfo.fromServiceInstance(new GreetingServiceImpl(1)).tag("ONLYFOR", "joe").tag("SENDER", "1").build(), ServiceInfo.fromServiceInstance(new GreetingServiceImplA()).tag("Weight", "0.1").build()).startAwait();
// Create microservices instance cluster.
provider2 = Microservices.builder().discovery(endpoint -> new ScalecubeServiceDiscovery().transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory())).options(opts -> opts.metadata(endpoint)).membership(cfg -> cfg.seedMembers(gatewayAddress))).transport(RSocketServiceTransport::new).services(ServiceInfo.fromServiceInstance(new GreetingServiceImpl(2)).tag("ONLYFOR", "fransin").tag("SENDER", "2").build(), ServiceInfo.fromServiceInstance(new GreetingServiceImplB()).tag("Weight", "0.9").build()).startAwait();
TagService tagService = input -> input.map(String::toUpperCase);
provider3 = Microservices.builder().discovery(endpoint -> new ScalecubeServiceDiscovery().transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory())).options(opts -> opts.metadata(endpoint)).membership(cfg -> cfg.seedMembers(gatewayAddress))).transport(RSocketServiceTransport::new).services(ServiceInfo.fromServiceInstance(tagService).tag("tagB", "bb").tag("tagC", "c").build()).startAwait();
}
Aggregations