public static void Main(string[] args) { try { const string ElasticSearchEventListenerId = "ElasticSearchEventListener"; FabricEventListeners.FabricConfigurationProvider configProvider = new FabricEventListeners.FabricConfigurationProvider(ElasticSearchEventListenerId); ElasticSearchListener esListener = null; if (configProvider.HasConfiguration) { esListener = new ElasticSearchListener(configProvider, new FabricEventListeners.FabricHealthReporter(ElasticSearchEventListenerId)); } ServiceRuntime.RegisterServiceAsync("WebServiceType", context => new WebService(context)).GetAwaiter().GetResult(); ServiceEventSource.Current.ServiceTypeRegistered(Process.GetCurrentProcess().Id, typeof(WebService).Name); Thread.Sleep(Timeout.Infinite); GC.KeepAlive(esListener); } catch (Exception e) { ServiceEventSource.Current.ServiceHostInitializationFailed(e); throw; } }
public static void Main(string[] args) { try { const string ElasticSearchEventListenerId = "ElasticSearchEventListener"; FabricEventListeners.FabricConfigurationProvider configProvider = new FabricEventListeners.FabricConfigurationProvider(ElasticSearchEventListenerId); ElasticSearchListener esListener = null; if (configProvider.HasConfiguration) { esListener = new ElasticSearchListener(configProvider, new FabricEventListeners.FabricHealthReporter(ElasticSearchEventListenerId)); } ServiceRuntime.RegisterServiceAsync( "ClusterServiceType", context => { IReliableStateManager stateManager = new ReliableStateManager(context); return(new ClusterService( #if LOCAL new FakeClusterOperator(stateManager), new FakeMailer(), #else new ArmClusterOperator(context), new SendGridMailer(context), #endif ServiceProxy.Create <IApplicationDeployService>( new ServiceUriBuilder("ApplicationDeployService").ToUri(), new ServicePartitionKey(0)), stateManager, context, new ClusterConfig())); }) .GetAwaiter().GetResult(); ServiceEventSource.Current.ServiceTypeRegistered(Process.GetCurrentProcess().Id, typeof(ClusterService).Name); Thread.Sleep(Timeout.Infinite); GC.KeepAlive(esListener); } catch (Exception e) { ServiceEventSource.Current.ServiceHostInitializationFailed(e); throw; } }