/// <summary> /// Optional override to create listeners (e.g., TCP, HTTP) for this service replica to handle client or user requests. /// </summary> /// <returns>A collection of listeners.</returns> protected override IEnumerable <ServiceInstanceListener> CreateServiceInstanceListeners() { try { if (this.jobControllerService == null) { this.jobControllerService = new DistributedJobController(this.Context); } if (this.jobRunnerService == null) { this.jobRunnerService = new JobRunner(this.Context); } var host = this.Context.NodeContext.IPAddressOrFQDN; var listeners = new[] { new ServiceInstanceListener(serviceContext => new GrpcCommunicationListener(new [] { DistributedJobControllerProto.DistributedJobControllerSvc.BindService(this.jobControllerService), JobRunnerProto.JobRunnerSvc.BindService(this.jobRunnerService) }, host, GrpcServerPort), "GrpcEndpoint") }; VegaDistTestEventSource.Log.RegisterListenersSucceeded(); return(listeners); } catch (Exception ex) { VegaDistTestEventSource.Log.RegisterListenersFailed(ex.ToString()); } return(null); }
/// <summary> /// Disposes this object /// </summary> /// <param name="disposing">If disposing managed fields</param> private void Dispose(bool disposing) { if (!this.disposedValue) { if (disposing) { if (this.jobRunnerService != null) { this.jobRunnerService.CancelRunningJob(new Empty(), null); this.jobRunnerService.Dispose(); this.jobRunnerService = null; } if (this.jobControllerService != null) { this.jobControllerService.Dispose(); this.jobControllerService = null; } } this.disposedValue = true; } }