private async Task CallValidationService(ServiceCoreRequest value) { IValidationService proxy = proxyFactory.CreateServiceProxy <IValidationService>( new Uri( string.Concat(Context.CodePackageActivationContext.ApplicationName, "/Microsoft.IoT.ServiceFabric.Validation")), new ServicePartitionKey(0L), TargetReplicaSelector.PrimaryReplica); using (MeasureTime measure = new MeasureTime()) { ServiceResponse <ValidationServiceResponse> response = await proxy.ValidateMessage(value); response.IsSuccess = response != null; telemetry.TrackEvent( "Core-Validation-Call", new Dictionary <string, string>() { { "Id", value.Id } }, new Dictionary <string, double>() { { "CoreElapsed", measure.Elapsed.TotalMilliseconds } }); } }
public async Task <ServiceResponse <CoreServiceResponse> > ProcessMessage(ServiceCoreRequest value) { ServiceResponse <CoreServiceResponse> result = new ServiceResponse <CoreServiceResponse>(new CoreServiceResponse()); if (value != null) { // do the logic result.IsSuccess = true; // save to CosmosDb string cosmosDBConnection = Context.ReadConfigurationSettingValue("Database", "CosmosDB"); // end save to cosmosDB await CallValidationService(value); await CallAlarmaService(value); telemetry.TrackEvent( "CoreService", new Dictionary <string, string>() { { "Id", value.Id } }); } else { result.IsSuccess = false; result.Error = new ArgumentNullException(nameof(value)); } return(result); }
public async Task <ServiceResponse <AlarmServiceResponse> > ProcessMessage(ServiceCoreRequest value) { return(new ServiceResponse <AlarmServiceResponse>(new AlarmServiceResponse() { HasAlarm = false }) { IsSuccess = true }); }
public async Task <ServiceResponse <ValidationServiceResponse> > ValidateMessage(ServiceCoreRequest value) { return(new ServiceResponse <ValidationServiceResponse>(new ValidationServiceResponse())); }