@Override public Discoverable deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { JsonObject jsonObj = json.getAsJsonObject(); String service = jsonObj.get("service").getAsString(); String hostname = jsonObj.get("hostname").getAsString(); int port = jsonObj.get("port").getAsInt(); InetSocketAddress address = new InetSocketAddress(hostname, port); byte[] payload = context.deserialize(jsonObj.get("payload"), BYTE_ARRAY_TYPE); return new Discoverable(service, address, payload); } }
@Override public Discoverable deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { JsonObject jsonObj = json.getAsJsonObject(); String service = jsonObj.get("service").getAsString(); String hostname = jsonObj.get("hostname").getAsString(); int port = jsonObj.get("port").getAsInt(); byte[] payload = context.deserialize(jsonObj.get("payload"), BYTE_ARRAY_TYPE); InetSocketAddress address = new InetSocketAddress(hostname, port); return new Discoverable(service, address, payload); }
@Override public Discoverable deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { JsonObject jsonObj = json.getAsJsonObject(); String service = jsonObj.get("service").getAsString(); String hostname = jsonObj.get("hostname").getAsString(); int port = jsonObj.get("port").getAsInt(); InetSocketAddress address = new InetSocketAddress(hostname, port); byte[] payload = context.deserialize(jsonObj.get("payload"), BYTE_ARRAY_TYPE); return new Discoverable(service, address, payload); } }
private Discoverable createDiscoverable(final String serviceName) { InetSocketAddress address; // NOTE: at this moment we are not using port anywhere int port = Networks.getRandomPort(); try { address = new InetSocketAddress(InetAddress.getLocalHost(), port); } catch (UnknownHostException e) { address = new InetSocketAddress(port); } return new Discoverable(serviceName, address); } }
@Override public Cancellable announce(String serviceName, int port, byte[] payload) { Discoverable discoverable = new Discoverable(serviceName, new InetSocketAddress(getHostname(), port), payload); return discoveryService.register(discoverable); }
@Override public Cancellable announce(String serviceName, int port, byte[] payload) { Discoverable discoverable = new Discoverable(serviceName, new InetSocketAddress(getHostname(), port), payload); return discoveryService.register(discoverable); }
private Discoverable createDiscoverable(final String serviceName) { InetSocketAddress address; // NOTE: at this moment we are not using port anywhere int port = Networks.getRandomPort(); try { address = new InetSocketAddress(InetAddress.getLocalHost(), port); } catch (UnknownHostException e) { address = new InetSocketAddress(port); } return new Discoverable(serviceName, address); } }
@Override public Cancellable announce(String serviceName, int port, byte[] payload) { return discoveryService.register( ResolvingDiscoverable.of(new Discoverable(serviceName, new InetSocketAddress(hostname, port), payload))); } }
@Override public Cancellable announce(final String serviceName, final int port) { return discoveryService.register( ResolvingDiscoverable.of(new Discoverable(serviceName, new InetSocketAddress(hostname, port)))); }
@Override public Cancellable announce(final String serviceName, final int port) { return discoveryService.register( ResolvingDiscoverable.of(new Discoverable(serviceName, new InetSocketAddress(hostname, port)))); }
@Override public Cancellable announce(String serviceName, int port, byte[] payload) { return discoveryService.register( ResolvingDiscoverable.of(new Discoverable(serviceName, new InetSocketAddress(hostname, port), payload))); } }
private Discoverable createDiscoverable(String serviceName, final int port) { InetSocketAddress address; try { address = new InetSocketAddress(InetAddress.getLocalHost(), port); } catch (UnknownHostException e) { address = new InetSocketAddress(port); } return new Discoverable(serviceName, address); } }
@Override protected void startUp() throws Exception { LOG.info("Starting Transaction HTTP Service..."); httpService.start(); // Register the service cancelDiscovery = discoveryService.register( ResolvingDiscoverable.of(new Discoverable(Constants.Service.TRANSACTION_HTTP, httpService.getBindAddress()))); LOG.info("Transaction HTTP started successfully on {}", httpService.getBindAddress()); }
@Override protected void startUp() throws Exception { LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(Id.Namespace.SYSTEM.getId(), Constants.Logging.COMPONENT_NAME, Constants.Service.METRICS_PROCESSOR)); LOG.info("Starting MetricsProcessor Status Service..."); httpService.start(); cancellable = discoveryService.register( ResolvingDiscoverable.of(new Discoverable(Constants.Service.METRICS_PROCESSOR, httpService.getBindAddress()))); LOG.info("Started MetricsProcessor Status Service."); }
@Override protected void startUp() throws Exception { LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(Id.Namespace.SYSTEM.getId(), Constants.Logging.COMPONENT_NAME, Constants.Service.METRICS_PROCESSOR)); LOG.info("Starting MetricsProcessor Status Service..."); httpService.start(); cancellable = discoveryService.register( ResolvingDiscoverable.of(new Discoverable(Constants.Service.METRICS_PROCESSOR, httpService.getBindAddress()))); LOG.info("Started MetricsProcessor Status Service."); }
@Override protected void startUp() throws Exception { LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(NamespaceId.SYSTEM.getEntityName(), Constants.Logging.COMPONENT_NAME, Constants.Service.DATASET_EXECUTOR)); LOG.info("Starting DatasetOpExecutorService..."); httpService.start(); cancellable = discoveryService.register( ResolvingDiscoverable.of(new Discoverable(Constants.Service.DATASET_EXECUTOR, httpService.getBindAddress()))); LOG.info("DatasetOpExecutorService started successfully on {}", httpService.getBindAddress()); }
@Override protected void startUp() throws Exception { LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(NamespaceId.SYSTEM.getEntityName(), Constants.Logging.COMPONENT_NAME, Constants.Service.DATASET_EXECUTOR)); LOG.info("Starting DatasetOpExecutorService..."); httpService.start(); cancellable = discoveryService.register( ResolvingDiscoverable.of(new Discoverable(Constants.Service.DATASET_EXECUTOR, httpService.getBindAddress()))); LOG.info("DatasetOpExecutorService started successfully on {}", httpService.getBindAddress()); }
@Override protected void startUp() throws Exception { LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(Id.Namespace.SYSTEM.getId(), Constants.Logging.COMPONENT_NAME, Constants.Service.LOGSAVER)); httpService.start(); cancellable = discoveryService.register( ResolvingDiscoverable.of(new Discoverable(Constants.Service.LOGSAVER, httpService.getBindAddress()))); }
@Override protected void startUp() throws Exception { LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(NamespaceId.SYSTEM.getEntityName(), Constants.Logging.COMPONENT_NAME, Constants.Service.STREAMS)); httpService.start(); discoverable = ResolvingDiscoverable.of(new Discoverable(Constants.Service.STREAMS, httpService.getBindAddress())); cancellable = discoveryService.register(discoverable); }
@Override protected void startUp() throws Exception { LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(Id.Namespace.SYSTEM.getId(), Constants.Logging.COMPONENT_NAME, Constants.Service.LOG_QUERY)); httpServer.start(); cancellable = discoveryService.register( ResolvingDiscoverable.of(new Discoverable(Constants.Service.LOG_QUERY, httpServer.getBindAddress()))); }