Beispiel #1
0
        public void RegisterInfrastructureServiceFactory(IStatefulServiceFactory factory)
        {
            var activationContext = FabricRuntime.GetActivationContext();
            var broker            = new ServiceFactoryBroker(factory, activationContext);

            Utility.WrapNativeSyncInvokeInMTA(() => this.nativeAgent.RegisterInfrastructureServiceFactory(broker), "InfrastructureServiceAgent.RegisterInfrastructureServiceFactory");
        }
Beispiel #2
0
 public void RegisterInfrastructureServiceFactory(IStatefulServiceFactory factory)
 {
     if (RegisterInfrastructureServiceFactoryAction != null)
     {
         RegisterInfrastructureServiceFactoryAction(factory);
     }
 }
Beispiel #3
0
        /// <summary>
        /// <para>Registers the specified <see cref="System.Fabric.IStatefulServiceFactory" /> 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.IStatefulServiceFactory" /> which can create the specified service type.</para>
        /// </param>
        public void RegisterStatefulServiceFactory(string serviceTypeName, IStatefulServiceFactory factory)
        {
            this.ThrowIfDisposed();

            FabricRuntime.ValidateParametersForRegisterServiceFactory(serviceTypeName, factory);

            Utility.WrapNativeSyncInvokeInMTA(() => this.RegisterServiceFactoryHelper(true, serviceTypeName, factory), "FabricRuntime.RegisterStatefulServiceFactory");
        }
Beispiel #4
0
        /// <summary>
        /// <para>Registers the specified <see cref="System.Fabric.IStatefulServiceFactory" /> 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.IStatefulServiceFactory" /> 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 representing the asynchronous operation.</para>
        /// </returns>
        public Task RegisterStatefulServiceFactoryAsync(string serviceTypeName, IStatefulServiceFactory factory, TimeSpan timeout, CancellationToken cancellationToken)
        {
            this.ThrowIfDisposed();

            FabricRuntime.ValidateParametersForRegisterServiceFactory(serviceTypeName, factory);

            ServiceFactoryBroker broker = new ServiceFactoryBroker(factory, this.codePackageActivationContext);

            return(this.RegisterServiceFactoryAsyncHelper(true, serviceTypeName, broker, (uint)timeout.TotalMilliseconds, cancellationToken));
        }
Beispiel #5
0
        /// <summary>
        /// <para>Adds the specified stateful service factory to the service group factory.</para>
        /// </summary>
        /// <param name="serviceTypeName">
        /// <para>Indicates 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 stateful service factory to add.</para>
        /// </param>
        public void AddStatefulServiceFactory(string serviceTypeName, IStatefulServiceFactory factory)
        {
            Requires.Argument("serviceTypeName", serviceTypeName).NotNullOrWhiteSpace();
            Requires.Argument("factory", factory).NotNull();

            this.VerifyServiceTypeNameIsUnique(serviceTypeName);
            this.VerifyIsEmpty(this.statelessFactories.Keys);

            this.statefulFactories.Add(serviceTypeName, factory);
        }
 public Task RegisterStatefulServiceAsync(string serviceTypeName, IStatefulServiceFactory serviceFactory, TimeSpan timeout = default, CancellationToken cancellationToken = default)
 {
     return(Runtime.RegisterStatefulServiceFactoryAsync(serviceTypeName, serviceFactory, timeout, cancellationToken));
 }
Beispiel #7
0
 public void RegisterInfrastructureServiceFactory(IStatefulServiceFactory factory)
 {
     agent.RegisterInfrastructureServiceFactory(factory);
 }
Beispiel #8
0
 public void RegisterInfrastructureServiceFactory(IStatefulServiceFactory factory)
 {
     throw new NotImplementedException();
 }
 public void RegisterInfrastructureServiceFactory(IStatefulServiceFactory factory)
 {
     // Nothing to do; not used when InfrastructureService is run as a user application
 }