use of io.scalecube.services.discovery.ScalecubeServiceDiscovery in project scalecube by scalecube.
the class ErrorFlowTest method initNodes.
@BeforeAll
public static void initNodes() {
provider = Microservices.builder().discovery(endpoint -> new ScalecubeServiceDiscovery().transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory())).transport(cfg -> cfg.port(PORT.incrementAndGet())).options(opts -> opts.metadata(endpoint))).transport(RSocketServiceTransport::new).services(new GreetingServiceImpl()).startAwait();
final Address seedAddress = provider.discovery().address();
consumer = Microservices.builder().discovery(endpoint -> new ScalecubeServiceDiscovery().membership(cfg -> cfg.seedMembers(seedAddress)).transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory())).transport(cfg -> cfg.port(PORT.incrementAndGet())).options(opts -> opts.metadata(endpoint))).transport(RSocketServiceTransport::new).startAwait();
}
use of io.scalecube.services.discovery.ScalecubeServiceDiscovery in project scalecube by scalecube.
the class StreamingServiceTest 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).defaultDataDecoder(ServiceMessageCodec::decodeData).startAwait();
final Address gatewayAddress = gateway.discovery().address();
node = 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).defaultDataDecoder(ServiceMessageCodec::decodeData).services(new SimpleQuoteService()).startAwait();
}
use of io.scalecube.services.discovery.ScalecubeServiceDiscovery in project scalecube by scalecube.
the class ServiceRemoteTest method test_services_contribute_to_cluster_metadata.
@Test
public void test_services_contribute_to_cluster_metadata() {
Map<String, String> tags = new HashMap<>();
tags.put("HOSTNAME", "host1");
Microservices ms = Microservices.builder().discovery(serviceEndpoint -> new ScalecubeServiceDiscovery().transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory())).options(opts -> opts.metadata(serviceEndpoint))).transport(RSocketServiceTransport::new).tags(tags).services(new GreetingServiceImpl()).startAwait();
assertTrue(ms.serviceEndpoint().tags().containsKey("HOSTNAME"));
}
use of io.scalecube.services.discovery.ScalecubeServiceDiscovery in project scalecube by scalecube.
the class RSocketServiceTransportTest method setUp.
@BeforeEach
public void setUp() {
gateway = Microservices.builder().discovery(endpoint -> new ScalecubeServiceDiscovery().transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory())).options(opts -> opts.metadata(endpoint))).transport(RSocketServiceTransport::new).startAwait();
final Address gatewayAddress = this.gateway.discovery().address();
serviceNode = Microservices.builder().discovery(serviceEndpoint -> new ScalecubeServiceDiscovery().transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory())).options(opts -> opts.metadata(serviceEndpoint)).membership(cfg -> cfg.seedMembers(gatewayAddress))).transport(RSocketServiceTransport::new).services(new SimpleQuoteService()).startAwait();
}
Aggregations