/// <summary> /// <para>Registers the specified <see cref="System.Fabric.IStatelessServiceFactory" /> for the specified service type.</para> /// </summary> /// <param name="serviceTypeName"> /// <para>The type name of the service type (as a string). This should match the type of the service group type as specified in the manifests and/or the /// CreateService command.</para> /// </param> /// <param name="factory"> /// <para>The <see cref="System.Fabric.IStatelessServiceFactory" /> which can create the specified service type.</para> /// </param> public void RegisterStatelessServiceFactory(string serviceTypeName, IStatelessServiceFactory factory) { this.ThrowIfDisposed(); FabricRuntime.ValidateParametersForRegisterServiceFactory(serviceTypeName, factory); Utility.WrapNativeSyncInvokeInMTA(() => this.RegisterServiceFactoryHelper(false, serviceTypeName, factory), "FabricRuntime.RegisterStatelessServiceFactory"); }
/// <summary> /// <para>Asynchronously registers the specified <see cref="System.Fabric.IStatelessServiceFactory" /> for the specified service type, with the /// specified <paramref name="timeout" /> and <paramref name="cancellationToken" /></para> /// </summary> /// <param name="serviceTypeName"> /// <para>The type name of the service type (as a string). This should match the type of the service group type as specified in the manifests /// and/or the CreateService command.</para> /// </param> /// <param name="factory"> /// <para>The <see cref="System.Fabric.IStatelessServiceFactory" /> which can create the specified service type.</para> /// </param> /// <param name="timeout"> /// <para>The maximum amount of time Service Fabric will allow this operation to continue before returning a TimeoutException.</para> /// </param> /// <param name="cancellationToken"> /// <para>The <see cref="System.Threading.CancellationToken" /> that the operation is observing. It can be used to send a notification that /// the operation should be canceled. Note that cancellation is advisory and that the operation may still be completed even if it is canceled.</para> /// </param> /// <returns> /// <para>The task representing the asynchronous operation.</para> /// </returns> public Task RegisterStatelessServiceFactoryAsync(string serviceTypeName, IStatelessServiceFactory factory, TimeSpan timeout, CancellationToken cancellationToken) { this.ThrowIfDisposed(); FabricRuntime.ValidateParametersForRegisterServiceFactory(serviceTypeName, factory); ServiceFactoryBroker broker = new ServiceFactoryBroker(factory, this.codePackageActivationContext); return(this.RegisterServiceFactoryAsyncHelper(false, serviceTypeName, broker, (uint)timeout.TotalMilliseconds, cancellationToken)); }
/// <summary> /// <para>Adds the specified stateless service factory to the service group factory.</para> /// </summary> /// <param name="serviceTypeName"> /// <para>The service type name as a string. It should match the service type that is specified in the manifest /// or the <see cref="System.Fabric.Description.ServiceGroupMemberDescription" /> of the <see cref="System.Fabric.Description.ServiceGroupDescription" /> /// that is provided during the <see cref="System.Fabric.FabricClient.ServiceGroupManagementClient.CreateServiceGroupAsync(System.Fabric.Description.ServiceGroupDescription)" /> call.</para> /// </param> /// <param name="factory"> /// <para>The stateless service factory to add.</para> /// </param> public void AddStatelessServiceFactory(string serviceTypeName, IStatelessServiceFactory factory) { Requires.Argument("serviceTypeName", serviceTypeName).NotNullOrWhiteSpace(); Requires.Argument("factory", factory).NotNull(); this.VerifyServiceTypeNameIsUnique(serviceTypeName); this.VerifyIsEmpty(this.statefulFactories.Keys); this.statelessFactories.Add(serviceTypeName, factory); }
public Task RegisterStatelessServiceAsync(string serviceTypeName, IStatelessServiceFactory serviceFactory, TimeSpan timeout = default, CancellationToken cancellationToken = default) { return(Runtime.RegisterStatelessServiceFactoryAsync(serviceTypeName, serviceFactory, timeout, cancellationToken)); }