public DeviceActorService(StatefulServiceContext context, ActorTypeInformation typeInfo, Func<ActorBase> actorFactory = null, IActorStateProvider stateProvider = null, ActorServiceSettings settings = null) : base(context, typeInfo, actorFactory, stateProvider, settings) { // Read settings from the DeviceActorServiceConfig section in the Settings.xml file var activationContext = Context.CodePackageActivationContext; var config = activationContext.GetConfigurationPackageObject(ConfigurationPackage); var section = config.Settings.Sections[ConfigurationSection]; // Read the ServiceBusConnectionString setting from the Settings.xml file var parameter = section.Parameters[ServiceBusConnectionStringParameter]; if (!string.IsNullOrWhiteSpace(parameter?.Value)) { ServiceBusConnectionString = parameter.Value; } else { throw new ArgumentException( string.Format(ParameterCannotBeNullFormat, ServiceBusConnectionStringParameter), ServiceBusConnectionStringParameter); } // Read the EventHubName setting from the Settings.xml file parameter = section.Parameters[EventHubNameParameter]; if (!string.IsNullOrWhiteSpace(parameter?.Value)) { EventHubName = parameter.Value; } else { throw new ArgumentException(string.Format(ParameterCannotBeNullFormat, EventHubNameParameter), EventHubNameParameter); } // Read the QueueLength setting from the Settings.xml file parameter = section.Parameters[QueueLengthParameter]; if (!string.IsNullOrWhiteSpace(parameter?.Value)) { QueueLength = DefaultQueueLength; int queueLength; if (int.TryParse(parameter.Value, out queueLength)) { QueueLength = queueLength; } } else { throw new ArgumentException(string.Format(ParameterCannotBeNullFormat, QueueLengthParameter), QueueLengthParameter); } }
public TelemetryEnabledActorService(StatefulServiceContext context, ActorTypeInformation actorTypeInfo, Func<ActorBase> actorFactory = null, IActorStateProvider stateProvider = null, ActorServiceSettings settings = null) : base(context, actorTypeInfo, actorFactory, stateProvider, settings) {}