/// <summary> /// This is the main entry point for your service instance. /// </summary> /// <param name="cancellationToken">Canceled when Service Fabric needs to shut down this service instance.</param> /// <returns>Completed task</returns> protected override async Task RunAsync(CancellationToken cancellationToken) { var connectionString = this.configuration.DefaultConnectionString; this.storageTaskScheduler = new StorageTaskScheduler(connectionString); this.storageTaskScheduler.TimerStart(); this.engine = new SocialEngine( message => ServiceEventSource.Current.ServiceMessage(this.Context, message), connectionString, this.metricManager); this.dispatcher = new RestfulDispatcher <ServiceProviderResponse>( message => ServiceEventSource.Current.ServiceMessage(this.Context, message), this); await Task.CompletedTask; }
/// <summary> /// This is the main entry point for your service instance. /// </summary> /// <param name="cancellationToken">Canceled when Service Fabric needs to shut down this service instance.</param> /// <returns>Async task</returns> protected override async Task RunAsync(CancellationToken cancellationToken) { this.controller = new OperationController( this.storeFactory, this.engine, this.configuration, this.reportManager, this.credentialManager, this.metricManager); this.storageTaskScheduler = new StorageTaskScheduler(this.reportManager); this.storageTaskScheduler.TimerStart(); this.dispatcher = new RestfulDispatcher <ServiceProviderResponse>( message => ServiceEventSource.Current.ServiceMessage(this.Context, message), this.controller); await this.billingAgent.OnRunAsync(cancellationToken); }
/// <summary> /// This is the main entry point for your service instance. /// </summary> /// <param name="cancellationToken">Canceled when Service Fabric needs to shut down this service instance.</param> /// <returns>Completed task</returns> protected override async Task RunAsync(CancellationToken cancellationToken) { var storeConnectionString = this.configuration.DefaultConnectionString; var storeMaxPoolSize = this.configuration.DefaultConnectionPoolSize; var storageConnectionString = this.configuration.TelemetryStoreConnectionString; this.taskScheduler = new StoreTaskScheduler( new OtpStoreFactory(storeConnectionString, Convert.ToInt32(storeMaxPoolSize)), storageConnectionString); this.taskScheduler.TimerStart(); this.engine = new OtpEngine( message => ServiceEventSource.Current.ServiceMessage(this.Context, message), new OtpStoreFactory(storeConnectionString, Convert.ToInt32(storeMaxPoolSize)), new TelemetryManager(storageConnectionString), this.metricManager); this.dispatcher = new RestfulDispatcher <ServiceProviderResponse>( message => ServiceEventSource.Current.ServiceMessage(this.Context, message), this); await Task.CompletedTask; }
/// <summary> /// This is the main entry point for your service instance. /// </summary> /// <param name="cancellationToken">Canceled when Service Fabric needs to shut down this service instance.</param> /// <returns>Async task</returns> protected override async Task RunAsync(CancellationToken cancellationToken) { this.controller = new OperationController( this.storeFactory, this.configuration, this.reportManager, this.inboundManager, this.credentialManager, this.metricManager); this.dispatcher = new RestfulDispatcher <ServiceProviderResponse>( message => ServiceEventSource.Current.ServiceMessage(this.Context, message), this.controller); try { await Task.WhenAll( this.billingAgent.OnRunAsync(cancellationToken) /*,this.ArchiveMetricsAsync(cancellationToken) removed by jin*/); } catch (OperationCanceledException) { } }