internal static void Initialize( StatelessServiceInitializationParameters initializationParameters, MonitoringAgentServiceEvent trace) { codePkgActivationCtx = initializationParameters.CodePackageActivationContext; serviceTrace = trace; }
private ICommunicationListener CreateInputListener(StatelessServiceInitializationParameters args) { EndpointResourceDescription inputEndpoint = args.CodePackageActivationContext.GetEndpoint("FEEndpoint"); string uriPrefix = String.Format("{0}://+:{1}/", inputEndpoint.Protocol, inputEndpoint.Port); string uriPublished = uriPrefix.Replace("+", FabricRuntime.GetNodeContext().IPAddressOrFQDN); return(new HttpCommunicationListener(uriPrefix, uriPublished, this)); }
public OrleansCommunicationListener( StatelessServiceInitializationParameters parameters, ClusterConfiguration configuration, IServicePartition servicePartition) { this.parameters = parameters; this.configuration = configuration; this.partition = servicePartition; }
public void Initialize(StatelessServiceInitializationParameters initializationParameters) { this.initializationParameters = initializationParameters; this.trace = new MonitoringAgentServiceEvent( this.initializationParameters.CodePackageActivationContext.WorkDirectory, this.initializationParameters.PartitionId, this.initializationParameters.InstanceId); ConfigReader.Initialize(this.initializationParameters, this.trace); }
public void Initialize(StatelessServiceInitializationParameters initializationParameters) { this.initParams = initializationParameters; this.partitionId = initializationParameters.PartitionId; this.instanceId = initializationParameters.InstanceId; // write the information from the code package activation context var context = initializationParameters.CodePackageActivationContext; WriteEventToGlobalFile(string.Format(CultureInfo.InvariantCulture, "ApplicationName = {0}", context.ApplicationName)); WriteEventToGlobalFile(string.Format(CultureInfo.InvariantCulture, "ApplicationTypeName = {0}", context.ApplicationTypeName)); WriteEventToGlobalFile(string.Format(CultureInfo.InvariantCulture, "ServiceManifestName = {0}", context.GetServiceManifestName())); WriteEventToGlobalFile(string.Format(CultureInfo.InvariantCulture, "ServiceManifestVersion = {0}", context.GetServiceManifestVersion())); WriteEventToGlobalFile(string.Format(CultureInfo.InvariantCulture, "CodePackageName = {0}", context.CodePackageName)); WriteEventToGlobalFile(string.Format(CultureInfo.InvariantCulture, "CodePackageVersion = {0}", context.CodePackageVersion)); }
private ICommunicationListener CreateInputListener(StatelessServiceInitializationParameters args) { // Service instance's URL is the node's IP & desired port EndpointResourceDescription inputEndpoint = args.CodePackageActivationContext.GetEndpoint("WebApiServiceEndpoint"); // This is the public-facing URL that HTTP clients, e.g., web browsers, can connect to. // The "alphabetpartitions" path is a unique URL prefix for this service so that other // services that might be hosted on the same node can also use this port with their own unique URL prefix. string uriPrefix = String.Format("{0}://+:{1}/alphabetpartitions/", inputEndpoint.Protocol, inputEndpoint.Port); // The published URL is slightly different from the listening URL prefix. // The listening URL is given to HttpListener. // The published URL is the URL that is published to the Service Fabric Naming Service, // which is used for service discovery. Clients will ask for this address through that discovery service. // The address that clients get needs to have the actual IP or FQDN of the node in order to connect, // so we need to replace '+' with the node's IP or FQDN. string uriPublished = uriPrefix.Replace("+", FabricRuntime.GetNodeContext().IPAddressOrFQDN); return new HttpCommunicationListener(uriPrefix, uriPublished, this.ProcessInputRequest); }
private ICommunicationListener CreateInputListener(StatelessServiceInitializationParameters args) { // Service instance's URL is the node's IP & desired port EndpointResourceDescription inputEndpoint = args.CodePackageActivationContext.GetEndpoint("WebApiServiceEndpoint"); // This is the public-facing URL that HTTP clients, e.g., web browsers, can connect to. // The "alphabetpartitions" path is a unique URL prefix for this service so that other // services that might be hosted on the same node can also use this port with their own unique URL prefix. string uriPrefix = String.Format("{0}://+:{1}/alphabetpartitions/", inputEndpoint.Protocol, inputEndpoint.Port); // The published URL is slightly different from the listening URL prefix. // The listening URL is given to HttpListener. // The published URL is the URL that is published to the Service Fabric Naming Service, // which is used for service discovery. Clients will ask for this address through that discovery service. // The address that clients get needs to have the actual IP or FQDN of the node in order to connect, // so we need to replace '+' with the node's IP or FQDN. string uriPublished = uriPrefix.Replace("+", FabricRuntime.GetNodeContext().IPAddressOrFQDN); return(new HttpCommunicationListener(uriPrefix, uriPublished, this.ProcessInputRequest)); }
public void Initialize(StatelessServiceInitializationParameters initializationParameters) { Console.WriteLine("AspNetCoreService: Initialize"); }
public void Initialize(StatelessServiceInitializationParameters initializationParameters) { this.partitionId = initializationParameters.PartitionId; this.instanceId = initializationParameters.InstanceId; }
/// <summary> /// The initialize. /// </summary> /// <param name="initializationParameters"> /// The initialization parameters. /// </param> public void Initialize(StatelessServiceInitializationParameters initializationParameters) { this.parameters = initializationParameters; this.cancellation = new CancellationTokenSource(); }
public void Initialize(StatelessServiceInitializationParameters initializationParameters) { Console.WriteLine("AspNetCoreService: Initialize"); }
public void Initialize(StatelessServiceInitializationParameters initializationParameters) { }
void IStatelessServiceInstance.Initialize(StatelessServiceInitializationParameters initializationParameters) { // no-op - the initialization is done in the constructor }
internal MdsAgentManager( StatelessServiceInitializationParameters initializationParameters, MonitoringAgentServiceEvent trace) { this.stopTaskCompletionSource = null; this.initializationParameters = initializationParameters; this.trace = trace; this.codePackageActivationContext = this.initializationParameters.CodePackageActivationContext; this.codePackageActivationContext.ConfigurationPackageModifiedEvent += ConfigPackageModified; this.codePackageActivationContext.DataPackageModifiedEvent += DataPackageModified; string maConfigFileName = ConfigReader.GetConfigValue( Constants.ConfigSectionName, Constants.MAConfigFileParamName, Constants.DefaultMAConfigFileName); DataPackage maDataPackage = this.codePackageActivationContext.GetDataPackageObject(Constants.MdsAgentDataPackageName); this.maDataPackagePath = maDataPackage.Path; this.maConfigFileFullPath = Path.Combine(this.maDataPackagePath, maConfigFileName); this.maWorkFolder = Path.Combine(this.codePackageActivationContext.WorkDirectory, Constants.MdsAgentWorkSubFolderName); Directory.CreateDirectory(this.maWorkFolder); this.maTenant = ConfigReader.GetConfigValue( Constants.ConfigSectionName, Constants.ClusterNameParamName, Constants.DefaultClusterName); this.maDataCenter = ConfigReader.GetConfigValue( Constants.ConfigSectionName, Constants.DataCenterParamName, Constants.DefaultDataCenterName); // FixDisallowedCharacters replaces special chars in application name with underscore. // This is required since MA cannot handle all special chars in identity fields. // MA usually allows chars that are supported in a URI. this.maApp = this.codePackageActivationContext.ApplicationName.FixDisallowedCharacters(); this.maRole = this.maApp; // The actual nodeName as reported by the FabricClient. This may contain chars like '.' (dot). // In current MA identity, the dot is replaced by and underscore in Role and RoleInstance value // however, the node name itself needs to retain its original value to match that reported by the HM for consistency in downstream processing. this.maNodeName = FabricRuntime.GetNodeContext().NodeName; this.maRoleInstance = this.maNodeName.FixDisallowedCharacters(); this.maDeploymentId = AzureRegistryStore.DeploymentId; this.maXStoreAccounts = ConfigReader.GetConfigValue( Constants.ConfigSectionName, Constants.MAXStoreAccountsParamName, string.Empty); using (var fc = new FabricClient()) { this.mdsLogDirectoryFullPath = ClusterManifestParser.ParseMdsUploaderPath(fc.ClusterManager.GetClusterManifestAsync().Result); } if (!string.IsNullOrEmpty(this.mdsLogDirectoryFullPath)) { this.trace.Message( "MdsAgentManager.ctor: Fabric Geneva Warm Path event generation detected at {0}.", this.mdsLogDirectoryFullPath); } this.maMdmAccountName = ConfigReader.GetConfigValue( Constants.ConfigSectionName, Constants.MAMdmAccountNameParamName, string.Empty); this.maMdmNamespace = ConfigReader.GetConfigValue( Constants.ConfigSectionName, Constants.MAMdmNamespaceParamName, string.Empty); int maRestartDelaySeconds = ConfigReader.GetConfigValue( Constants.ConfigSectionName, Constants.MARestartDelayInSecondsParamName, Constants.DefaultMARestartDelayInSeconds); this.maRestartDelay = TimeSpan.FromSeconds(maRestartDelaySeconds); this.mdsAgentState = MdsAgentState.Initialized; this.mdsAgentStateLock = new object(); this.healthReporter = new HealthReporter(initializationParameters.PartitionId, initializationParameters.InstanceId, initializationParameters.ServiceTypeName); this.maStoppedEventHandleName = string.Format( "MAStoppedEvent{0}{1}", this.initializationParameters.PartitionId, this.initializationParameters.InstanceId); this.maStartedEventHandleName = string.Format( "MAStartedEvent{0}{1}", this.initializationParameters.PartitionId, this.initializationParameters.InstanceId); this.maStoppedEvent = new EventWaitHandle(false, EventResetMode.AutoReset, this.maStoppedEventHandleName); this.maStartedEvent = new EventWaitHandle(false, EventResetMode.AutoReset, this.maStartedEventHandleName); this.maStatusHealthMonitor = new Thread(this.MAStatusHealthMonitor) { IsBackground = false }; this.maStatusHealthMonitor.Start(); this.maResumeTimer = new Timer(this.Resume); }
public virtual void Initialize(StatelessServiceInitializationParameters initializationParameters) { throw new NotImplementedException(); }
public override void Initialize(StatelessServiceInitializationParameters initializationParameters) { this.InitializationParameters = initializationParameters; }