Пример #1
0
 internal ClusterEntity(
     FabricHealthClientWrapper healthClient,
     HealthDataConsumer consumer,
     TraceWriterWrapper traceWriter,
     IServiceConfiguration config,
     EntityFilterRepository filterRepository)
     : base(healthClient, consumer, traceWriter, config, filterRepository)
 {
     this.ClusterName = Guard.IsNotNullOrEmpty(this.Config.ClusterName, nameof(this.Config.ClusterName));
 }
Пример #2
0
 protected Entity(
     FabricHealthClientWrapper healthClient,
     HealthDataConsumer consumer,
     TraceWriterWrapper traceWriter,
     IServiceConfiguration config,
     EntityFilterRepository filters)
 {
     this.HealthClient = Guard.IsNotNull(healthClient, nameof(healthClient));
     this.Consumer     = Guard.IsNotNull(consumer, nameof(consumer));
     this.TraceWriter  = Guard.IsNotNull(traceWriter, nameof(traceWriter));
     this.Config       = Guard.IsNotNull(config, nameof(config));
     this.Filters      = Guard.IsNotNull(filters, nameof(filters));
 }
Пример #3
0
 internal ApplicationEntity(
     FabricHealthClientWrapper healthClient,
     HealthDataConsumer consumer,
     string clusterName,
     Uri applicationUri,
     TraceWriterWrapper traceWriter,
     IServiceConfiguration config,
     EntityFilterRepository filterRepository)
     : base(healthClient, consumer, traceWriter, config, filterRepository)
 {
     this.ClusterName    = Guard.IsNotNullOrEmpty(clusterName, nameof(clusterName));
     this.applicationUri = Guard.IsNotNull(applicationUri, nameof(applicationUri));
 }
Пример #4
0
        internal HealthDataProducer(
            FabricHealthClientWrapper healthClient,
            HealthDataConsumer consumer,
            TraceWriterWrapper traceWriter,
            IServiceConfiguration config,
            EntityFilterRepository filterRepository)
        {
            this.healthClient     = Guard.IsNotNull(healthClient, nameof(healthClient));
            this.consumer         = Guard.IsNotNull(consumer, nameof(consumer));
            this.traceWriter      = Guard.IsNotNull(traceWriter, nameof(traceWriter));
            this.config           = Guard.IsNotNull(config, nameof(config));
            this.filterRepository = Guard.IsNotNull(filterRepository, nameof(filterRepository));
            this.stopwatch        = new Stopwatch();

            this.stack = new Stack <IEntity>();
        }
 internal DeployedServicePackageEntity(
     FabricHealthClientWrapper healthClient,
     HealthDataConsumer consumer,
     string clusterName,
     Uri applicationUri,
     string serviceManifestName,
     string nodeName,
     TraceWriterWrapper traceWriter,
     IServiceConfiguration config,
     EntityFilterRepository filterRepository)
     : base(healthClient, consumer, traceWriter, config, filterRepository)
 {
     this.ClusterName         = Guard.IsNotNullOrEmpty(clusterName, nameof(clusterName));
     this.NodeName            = Guard.IsNotNullOrEmpty(nodeName, nameof(nodeName));
     this.applicationUri      = Guard.IsNotNull(applicationUri, nameof(applicationUri));
     this.ServiceManifestName = Guard.IsNotNullOrEmpty(serviceManifestName, nameof(serviceManifestName));
 }
Пример #6
0
 internal PartitionEntity(
     FabricHealthClientWrapper healthClient,
     HealthDataConsumer consumer,
     string clusterName,
     string applicationName,
     string serviceName,
     Guid partitionId,
     TraceWriterWrapper traceWriter,
     IServiceConfiguration config,
     EntityFilterRepository filterRepository)
     : base(healthClient, consumer, traceWriter, config, filterRepository)
 {
     this.ClusterName     = Guard.IsNotNullOrEmpty(clusterName, nameof(clusterName));
     this.ApplicationName = Guard.IsNotNullOrEmpty(applicationName, nameof(applicationName));
     this.ServiceName     = Guard.IsNotNullOrEmpty(serviceName, nameof(serviceName));
     this.PartitionId     = partitionId;
 }
Пример #7
0
        /// <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>
        protected override async Task RunAsync(CancellationToken cancellationToken)
        {
            if (this.healthDataService == null)
            {
                // compose the HealthDataService instance with all the dependencies.
                var config           = new ServiceConfiguration(this.serviceContext.CodePackageActivationContext, TraceWriter);
                var filterRepository = new EntityFilterRepository(config);

                var healthClient = new FabricHealthClientWrapper(
                    TraceWriter,
                    this.Context.ServiceTypeName,
                    this.Context.PartitionId,
                    this.Context.ReplicaOrInstanceId);

                var consumer = new SampleHealthDataConsumer();
                var producer = new HealthDataProducer(healthClient, consumer, TraceWriter, config, filterRepository);
                this.healthDataService = new HealthDataService(producer, TraceWriter, config, filterRepository);

                //this.TraceInfo("Service.RunAsync: Composed new HealthDataService instance");
            }

            //this.TraceInfo("Service.RunAsync: Invoking HealthDataService.RunAsync");
            await this.healthDataService.RunAsync(cancellationToken).ConfigureAwait(false);
        }