示例#1
0
        public async Task <Guid> CreateAsync(string type, CancellationToken cancellationToken)
        {
            var myTypeDictionary = await this.StateManager.GetOrAddAsync <IReliableDictionary <string, bool> >(ACTOR_TYPE_COLLECTION);

            var myDictionary = await this.StateManager.GetOrAddAsync <IReliableDictionary <Guid, string> >(ACTOR_COLLECTION);

            ActorId key = ActorId.CreateRandom();

            // register actor if type doesn't exist
            using (ITransaction tx = this.StateManager.CreateTransaction())
            {
                if (!await myTypeDictionary.ContainsKeyAsync(tx, type))
                {
                    ActorRuntime.RegisterActorAsync <SampleActor.SampleActor>(
                        (context, actorType) => new ActorService(context, actorType)).GetAwaiter().GetResult();
                    await myTypeDictionary.TryAddAsync(tx, type, true);
                }
            }

            // Create actor
            ActorProxy.Create <ISampleActor>(key, $"fabric:/Default.Main/{type}ActorService");

            // Add to collection
            using (ITransaction tx = this.StateManager.CreateTransaction())
            {
                await myDictionary.AddAsync(tx, key.GetGuidId(), type, TimeSpan.FromMilliseconds(ACTOR_CREATION_TIMEOUT * 1000), cancellationToken);

                await tx.CommitAsync();
            }
            return(key.GetGuidId());
        }
        /// <summary>
        /// This is the entry point of the service host process.
        /// </summary>
        private static void Main()
        {
            try
            {
                // The ServiceManifest.XML file defines one or more service type names.
                // Registering a service maps a service type name to a .NET type.
                // When Service Fabric creates an instance of this service type,
                // an instance of the class is created in this host process.

                //ServiceRuntime.RegisterServiceAsync("SFReliableActorServiceNetCoreApiType",
                //    context => new SFReliableActorServiceNetCoreApi(context)).GetAwaiter().GetResult();

                //ServiceEventSource.Current.ServiceTypeRegistered(Process.GetCurrentProcess().Id, typeof(SFReliableActorServiceNetCoreApi).Name);

                ActorRuntime.RegisterActorAsync <MyActor>((context, actorType) => new MyActorService(context, actorType)).GetAwaiter().GetResult();

                // Prevents this host process from terminating so services keeps running.
                Thread.Sleep(Timeout.Infinite);
            }
            catch (Exception e)
            {
                ServiceEventSource.Current.ServiceHostInitializationFailed(e.ToString());
                throw;
            }
        }
示例#3
0
        /// <summary>
        /// This is the entry point of the service host process.
        /// </summary>
        private static void Main()
        {
            try
            {
                // This line registers an Actor Service to host your actor class with the Service Fabric runtime.
                // The contents of your ServiceManifest.xml and ApplicationManifest.xml files
                // are automatically populated when you build this project.
                // For more information, see https://aka.ms/servicefabricactorsplatform

                ActorRuntime.RegisterActorAsync <MyActor>((context, actorType) => new ActorService(context, actorType))
                .GetAwaiter()
                .GetResult();

                /* hOW TO USE dependency injection on actor registration
                 *
                 *  public MessageProcessingActor(ActorService actorService,
                 *          ActorId actorId,
                 *          IEnumerable<IMessageHandler> handlers)
                 *
                 *
                 *  await ActorRuntime.RegisterActorAsync<MessageProcessingActor>(
                 *      (context, actorType) => new ActorService(context, actorType,
                 *      (s, id) => new MessageProcessingActor(s,id, _handlers))
                 *      );
                 */

                Thread.Sleep(Timeout.Infinite);
            }
            catch (Exception e)
            {
                ActorEventSource.Current.ActorHostInitializationFailed(e.ToString());
                throw;
            }
        }
        public static IUnityContainer WithActor <TActor>(this IUnityContainer container, ActorServiceSettings settings = null) where TActor : ActorBase
        {
            var logger = container.Resolve <ILoggerFactory>().CreateLogger <TActor>();

            logger.LogInformation("Registering Actor {ActorName}", typeof(TActor).Name);

            if (!container.IsRegistered <IActorDeactivationInterception>())
            {
                container.RegisterType <IActorDeactivationInterception, OnActorDeactivateInterceptor>(new HierarchicalLifetimeManager());
            }

            container.RegisterType(typeof(TActor), ActorProxyTypeFactory.CreateType <TActor>(), new HierarchicalLifetimeManager());
            ActorRuntime.RegisterActorAsync <TActor>((context, actorType) => {
                try
                {
                    return(new ActorService(context,
                                            actorTypeInfo: actorType,
                                            actorFactory: (service, id) =>
                                            container.CreateChildContainer()
                                            .RegisterInstance(service, new ContainerControlledLifetimeManager())
                                            .RegisterInstance(id, new ContainerControlledLifetimeManager()).Resolve <TActor>(),
                                            settings: settings));
                }
                catch (Exception ex)
                {
                    logger.LogCritical(new EventId(100, "FailedToCreateActorService"), ex, "Failed to create ActorService for {ActorName}", typeof(TActor).Name);
                    throw;
                }
            }).GetAwaiter().GetResult();



            return(container);
        }
示例#5
0
        /// <summary>
        /// This is the entry point of the service host process.
        /// </summary>
        private static void Main()
        {
            try
            {
                // This line registers an Actor Service to host your actor class with the Service Fabric runtime.
                // The contents of your ServiceManifest.xml and ApplicationManifest.xml files
                // are automatically populated when you build this project.
                // For more information, see https://aka.ms/servicefabricactorsplatform
                var       cosmosDB  = FabricRuntime.GetActivationContext().GetConfigurationPackageObject("Config").Settings.Sections["CosmosDB"];
                Container container = new Container();
                container.Configure(config =>
                {
                    var configPackage =
                        config.For <AskActor>().Use <AskActor>();
                });
                ActorRuntime.RegisterActorAsync <AskActor> (
                    (context, actorType) => new ActorService(context, actorType, (service, actorId) =>
                                                             container.GetInstance <AskActor>(
                                                                 new ExplicitArguments().Set(service).Set(actorId)
                                                                 ))).GetAwaiter().GetResult();

                Thread.Sleep(Timeout.Infinite);
            }
            catch (Exception e)
            {
                ActorEventSource.Current.ActorHostInitializationFailed(e.ToString());
                throw;
            }
        }
示例#6
0
        /// <summary>
        /// This is the entry point of the service host process.
        /// </summary>
        private static void Main()
        {
            try
            {
                // This line registers an Actor Service to host your actor class with the Service Fabric runtime.
                // The contents of your ServiceManifest.xml and ApplicationManifest.xml files
                // are automatically populated when you build this project.
                // For more information, see https://aka.ms/servicefabricactorsplatform


                var actorProxyFactory          = new ActorProxyFactory();
                var serviceProxyFactory        = new ServiceProxyFactory();
                IRepositoryFactories factories = null;

                ActorRuntime.RegisterActorAsync <ParticipantActor>(
                    (context, actorType) => new ActorService(context, actorType, (service, actorId) =>
                                                             new ParticipantActor(service, actorId, actorProxyFactory, serviceProxyFactory, factories))).GetAwaiter().GetResult();


                ActorRuntime.RegisterActorAsync <ApprovalActor>(
                    (context, actorType) => new ActorService(context, actorType, (service, actorId) =>
                                                             new ApprovalActor(service, actorId, actorProxyFactory, serviceProxyFactory, factories))).GetAwaiter().GetResult();

                Thread.Sleep(Timeout.Infinite);
            }
            catch (Exception e)
            {
                ActorEventSource.Current.ActorHostInitializationFailed(e.ToString());
                throw;
            }
        }
示例#7
0
        /// <summary>
        /// This is the entry point of the service host process.
        /// </summary>
        private static void Main()
        {
            try
            {
                // This line registers an Actor Service to host your actor class with the Service Fabric runtime.
                // The contents of your ServiceManifest.xml and ApplicationManifest.xml files
                // are automatically populated when you build this project.
                // For more information, see http://aka.ms/servicefabricactorsplatform

                ActorRuntime.RegisterActorAsync <Environment>(
                    (context, actorType) => new ActorService(context, actorType, () => new Environment())).GetAwaiter().GetResult();
                ActorRuntime.RegisterActorAsync <Person>(
                    (context, actorType) => new ActorService(context, actorType, () => new Person())).GetAwaiter().GetResult();
                ActorRuntime.RegisterActorAsync <Thief>(
                    (context, actorType) => new ActorService(context, actorType, () => new Thief())).GetAwaiter().GetResult();
                ActorRuntime.RegisterActorAsync <House>(
                    (context, actorType) => new ActorService(context, actorType, () => new House())).GetAwaiter().GetResult();
                ActorRuntime.RegisterActorAsync <Garden>(
                    (context, actorType) => new ActorService(context, actorType, () => new Garden())).GetAwaiter().GetResult();
                ActorRuntime.RegisterActorAsync <Kitchen>(
                    (context, actorType) => new ActorService(context, actorType, () => new Kitchen())).GetAwaiter().GetResult();
                ActorRuntime.RegisterActorAsync <Bedroom>(
                    (context, actorType) => new ActorService(context, actorType, () => new Bedroom())).GetAwaiter().GetResult();

                Thread.Sleep(Timeout.Infinite);
            }
            catch (Exception e)
            {
                ActorEventSource.Current.ActorHostInitializationFailed(e.ToString());
                throw;
            }
        }
示例#8
0
        /// <summary>
        /// This is the entry point of the service host process.
        /// </summary>
        private static void Main()
        {
            try
            {
                // This line registers an Actor Service to host your actor class with the Service Fabric runtime.
                // The contents of your ServiceManifest.xml and ApplicationManifest.xml files
                // are automatically populated when you build this project.
                // For more information, see https://aka.ms/servicefabricactorsplatform
                ActorRuntime.RegisterActorAsync <NetCoreActor>((context, actorType) =>
                                                               new ActorService(context, actorType, settings: new ActorServiceSettings
                {
                    //ActorConcurrencySettings = new ActorConcurrencySettings
                    //{
                    //    ReentrancyMode = ActorReentrancyMode.Disallowed
                    //}
                })).GetAwaiter().GetResult();

                Thread.Sleep(Timeout.Infinite);
            }
            catch (Exception e)
            {
                ActorEventSource.Current.ActorHostInitializationFailed(e.ToString());
                throw;
            }
        }
示例#9
0
 public void RegisterActorFactory <TActor>(
     ILifetimeScope container,
     Func <ActorBase, IActorStateProvider, IActorStateManager> stateManagerFactory = null,
     IActorStateProvider stateProvider = null,
     ActorServiceSettings settings     = null) where TActor : ActorBase
 {
     ActorRuntime.RegisterActorAsync <TActor>((context, actorTypeInfo) =>
     {
         return(new ActorService(context, actorTypeInfo, (actorService, actorId) =>
         {
             var lifetimeScope = container.BeginLifetimeScope(builder =>
             {
                 builder.RegisterInstance(context)
                 .As <StatefulServiceContext>()
                 .As <ServiceContext>();
                 builder.RegisterInstance(actorService)
                 .As <ActorService>();
                 builder.RegisterInstance(actorId)
                 .As <ActorId>();
             });
             var actor = lifetimeScope.Resolve <TActor>();
             return actor;
         }, stateManagerFactory, stateProvider, settings));
     }).GetAwaiter().GetResult();
 }
示例#10
0
        /// <summary>
        /// This is the entry point of the service host process.
        /// </summary>
        private static void Main()
        {
            try
            {
                // Create default garbage collection settings for all the actor types
                ActorGarbageCollectionSettings actorGarbageCollectionSettings = new ActorGarbageCollectionSettings(300, 60);

                // This line registers your actor class with the Fabric Runtime.
                // The contents of your ServiceManifest.xml and ApplicationManifest.xml files
                // are automatically populated when you build this project.
                // For more information, see http://aka.ms/servicefabricactorsplatform

                ActorRuntime.RegisterActorAsync <TestObservableObserverActor>(
                    (context, actorType) => new TestObservableObserverActorService(
                        context,
                        actorType,
                        () => new TestObservableObserverActor(),
                        null,
                        new ActorServiceSettings
                {
                    ActorGarbageCollectionSettings = actorGarbageCollectionSettings
                })).GetAwaiter().GetResult();

                Thread.Sleep(Timeout.Infinite);
            }
            catch (Exception e)
            {
                ActorEventSource.Current.ActorHostInitializationFailed(e);
                throw;
            }
        }
示例#11
0
        private static void Main()
        {
            try
            {
                var settings = ReadSettings();

                ActorRuntime.RegisterActorAsync <MatchingEngine>(
                    (context, actorType) => new ActorService(context, actorType, () =>
                {
                    var assetPairQuoteRepository = new AssetPairQuoteRepository();
                    var dictionaryProxy          = new DictionaryProxy(settings.Factories);

                    return(new MatchingEngine(dictionaryProxy, new AccountInfoRepository(),
                                              assetPairQuoteRepository, new MarketOrderRepository(),
                                              new PendingOrderRepository(), new TransactionHistoryRepository(),
                                              new OrderCalculator(assetPairQuoteRepository, dictionaryProxy),
                                              new MatchingEngineEventSubscriber(settings.MatchingEngine),
                                              new OrderBookService(assetPairQuoteRepository, dictionaryProxy)));
                }))
                .GetAwaiter()
                .GetResult();

                MappingConfig.Configure();

                Thread.Sleep(Timeout.Infinite);
            }
            catch (Exception e)
            {
                ActorEventSource.Current.ActorHostInitializationFailed(e.ToString());
                throw;
            }
        }
示例#12
0
        /// <summary>
        /// This is the entry point of the service host process.
        /// </summary>
        private static void Main()
        {
            try
            {
                // This line registers an Actor Service to host your actor class with the Service Fabric runtime.
                // The contents of your ServiceManifest.xml and ApplicationManifest.xml files
                // are automatically populated when you build this project.
                // For more information, see http://aka.ms/servicefabricactorsplatform

                ActorRuntime.RegisterActorAsync <Reminder1>(
                    (context, actorType) => new ActorService(context, actorType,
                                                             null, null, null,
                                                             new ActorServiceSettings()
                {
                    ActorConcurrencySettings = new ActorConcurrencySettings()
                    {
                        ReentrancyMode = ActorReentrancyMode.Disallowed
                    },
                    ActorGarbageCollectionSettings =
                        //new ActorGarbageCollectionSettings(60 * 60, 60) //Default
                        new ActorGarbageCollectionSettings(5 * 60, 60) // 5 min IDLE, 1 min scan
                }
                                                             )).GetAwaiter().GetResult();

                Thread.Sleep(Timeout.Infinite);
            }
            catch (Exception e)
            {
                ActorEventSource.Current.ActorHostInitializationFailed(e.ToString());
                throw;
            }
        }
        /// <summary>
        /// This is the entry point of the service host process.
        /// </summary>
        private static void Main()
        {
            try
            {
                // This line registers an Actor Service to host your actor class with the Service Fabric runtime.
                // The contents of your ServiceManifest.xml and ApplicationManifest.xml files
                // are automatically populated when you build this project.
                // For more information, see https://aka.ms/servicefabricactorsplatform

                ActorRuntime.RegisterActorAsync<TigerAdapterActor>(
                   (context, actorType) => new ActorService(context, actorType)).GetAwaiter().GetResult();

                ActorRuntime.RegisterActorAsync<LionAdapterActor>(
                   (context, actorType) => new ActorService(context, actorType)).GetAwaiter().GetResult();

                // This only creates a proxy object, it does not activate an actor or invoke any methods yet.
                var proxy = ActorProxy.Create<IAdapter>(new ActorId("tiger"), new Uri("fabric:/ConfigAndMonitor/TigerAdapterActor"));
                proxy.RegisterEventsAsync();
                proxy = ActorProxy.Create<IAdapter>(new ActorId("lion"), new Uri("fabric:/ConfigAndMonitor/LionAdapterActor"));
                proxy.RegisterEventsAsync();

                Thread.Sleep(Timeout.Infinite);
            }
            catch (Exception e)
            {
                ActorEventSource.Current.ActorHostInitializationFailed(e.ToString());
                throw;
            }
        }
示例#14
0
        private static void Main()
        {
            var rootServiceProvider = ConfigureServices();

            try
            {
                ActorRuntime.RegisterActorAsync <DeviceSimulatorActor>(
                    (context, actorType) => new ActorService(
                        context,
                        actorType,
                        (actorService, actorId) =>
                {
                    var actorFactory = rootServiceProvider.GetRequiredService <Func <ActorService, ActorId, DeviceSimulatorActor> >();

                    var actor = actorFactory(actorService, actorId);

                    return(actor);
                })).GetAwaiter().GetResult();

                Thread.Sleep(Timeout.Infinite);
            }
            catch (Exception e)
            {
                DeviceSimulatorActorEventSource.Current.ActorHostInitializationFailed(e.ToString());
                throw;
            }
        }
示例#15
0
        /// <summary>
        /// This is the entry point of the service host process.
        /// </summary>
        private static void Main()
        {
            try
            {
                // This line registers an Actor Service to host your actor class with the Service Fabric runtime.
                // The contents of your ServiceManifest.xml and ApplicationManifest.xml files
                // are automatically populated when you build this project.
                // For more information, see https://aka.ms/servicefabricactorsplatform
                ActorRuntime.RegisterActorAsync <PersonEventStoredActor>(
                    (context, actorType) => new PersonEventStoredActorService(context, actorType, settings:
                                                                              new ActorServiceSettings()
                {
                    ActorGarbageCollectionSettings =
                        new ActorGarbageCollectionSettings(idleTimeoutInSeconds: 15, scanIntervalInSeconds: 15)
                })).GetAwaiter().GetResult();

                ActorRuntime.RegisterActorAsync <TempEventStoredActor>(
                    (context, actorType) => new TempEventStoredActorService(context, actorType, settings:
                                                                            new ActorServiceSettings()
                {
                    ActorGarbageCollectionSettings =
                        new ActorGarbageCollectionSettings(idleTimeoutInSeconds: 15, scanIntervalInSeconds: 15)
                })).GetAwaiter().GetResult();

                ActorRuntime.RegisterActorAsync <ActorDemo>(
                    (context, actorType) => new ActorDemoActorService(context, actorType)).GetAwaiter().GetResult();

                Thread.Sleep(Timeout.Infinite);
            }
            catch (Exception e)
            {
                ActorDemoEventSource.Current.ActorHostInitializationFailed(e.ToString());
                throw;
            }
        }
        private static void Main()
        {
            ActorRuntime.RegisterActorAsync <Partition>((context, actorType) =>
            {
                var kernel = new StandardKernel();
                kernel.Bind <TelemetryClient>().ToSelf();
                kernel.Bind <PoolsActorService>().ToMethod(x =>
                                                           new PoolsActorService(context, actorType, "PoolActorServiceEndpoint",
                                                                                 (svc, id) =>
                {
                    var actorProxyFactory = new CorrelatingActorProxyFactory(context, callbackClient => new FabricTransportActorRemotingClientFactory(callbackClient));
                    var fabricClient      = new FabricClient();
                    return(new Partition(
                               svc,
                               id,
                               kernel.Get <TelemetryClient>(),
                               new InstanceProxy(
                                   actorProxyFactory,
                                   new GuidGetter()
                                   ),
                               new PoolProxy(
                                   actorProxyFactory,
                                   new PartitionProxy(actorProxyFactory, fabricClient),
                                   fabricClient
                                   )
                               ));
                }
                                                                                 )
                                                           );
                return(kernel.Get <PoolsActorService>());
            }).GetAwaiter().GetResult();

            Thread.Sleep(Timeout.Infinite);
        }
示例#17
0
        /// <summary>
        /// This is the entry point of the service host process.
        /// </summary>
        private static void Main()
        {
            try
            {
                // This line registers an Actor Service to host your actor class with the Service Fabric runtime.
                // The contents of your ServiceManifest.xml and ApplicationManifest.xml files
                // are automatically populated when you build this project.
                // For more information, see https://aka.ms/servicefabricactorsplatform

                ActorRuntime.RegisterActorAsync <MessageProcessor>(
                    (context, actorType) => new ActorService(context, actorType)).GetAwaiter().GetResult();

                ActorRuntime.RegisterActorAsync <SMSProcessor>(
                    (context, actorType) => new ActorService(context, actorType)).GetAwaiter().GetResult();

                ActorRuntime.RegisterActorAsync <EmailProcessor>(
                    (context, actorType) => new ActorService(context, actorType)).GetAwaiter().GetResult();

                ActorRuntime.RegisterActorAsync <PushProcessor>(
                    (context, actorType) => new ActorService(context, actorType)).GetAwaiter().GetResult();

                Thread.Sleep(Timeout.Infinite);
            }
            catch (Exception e)
            {
                ActorEventSource.Current.ActorHostInitializationFailed(e.ToString());
                throw;
            }
        }
        /// <summary>
        /// This is the entry point of the service host process.
        /// </summary>
        private static void Main()
        {
            ILogger logger = null;

            try
            {
                // This line registers an Actor Service to host your actor class with the Service Fabric runtime.
                // The contents of your ServiceManifest.xml and ApplicationManifest.xml files
                // are automatically populated when you build this project.
                // For more information, see https://aka.ms/servicefabricactorsplatform

                ActorRuntime.RegisterActorAsync <MyActor>((context, actorType) =>
                {
                    var applicationInsightsKey = FabricRuntime.GetActivationContext()
                                                 .GetConfigurationPackageObject("Config")
                                                 .Settings
                                                 .Sections["ConfigurationSection"]
                                                 .Parameters["ApplicationInsightsKey"]
                                                 .Value;

                    var loggerFactory = new LoggerFactoryBuilder(context).CreateLoggerFactory(applicationInsightsKey);
                    logger            = loggerFactory.CreateLogger <MyActor>();

                    return(ActorServiceFactory.CreateActorService(context, actorType, logger, (service, id) => new MyActor(service, id, logger)));
                }).GetAwaiter().GetResult();

                Thread.Sleep(Timeout.Infinite);
            }
            catch (Exception e)
            {
                logger?.LogActorHostInitalizationFailed <MyActor>(e);
                throw;
            }
        }
        private static void Main()
        {
            ActorRuntime.RegisterActorAsync <SfActor>(
                (context, actorType) => new ActorService(context, actorType, () => new SfActor())).GetAwaiter().GetResult();

            // Prevents this host process from terminating so services keep running.
            Thread.Sleep(Timeout.Infinite);
        }
    private static void Main()
    {
        ActorRuntime.RegisterActorAsync <MyActor>(
            (context, actorType) => new MyActorService(context, actorType, () => new MyActor()))
        .GetAwaiter().GetResult();

        Thread.Sleep(Timeout.Infinite);
    }
示例#21
0
        public static void Start <TActor, TActorService>()
            where TActor : Actor
            where TActorService : ActorService
        {
            ActorRuntime.RegisterActorAsync <TActor>(CreateActorService <TActor, TActorService>)
            .GetAwaiter()
            .GetResult();

            Thread.Sleep(Timeout.Infinite);
        }
        private static async Task Main()
        {
            //arrange
            await ActorRuntime.RegisterActorAsync <ReproActor>(
                (context, actorType) => new ActorService(context, actorType));

            var actor = _actorProxyFactory.CreateActorProxy <IReproActor>(
                _actorServiceUri, new ActorId("repro"));

            //act
            await actor.RegisterNonRepeatingReminderAsync(default);
示例#23
0
 private static void Main()
 {
     try {
         ActorRuntime.RegisterActorAsync <PerformanceManagerActor>(
             (context, actorType) => new ActorService(context, actorType)).GetAwaiter().GetResult();
         Thread.Sleep(Timeout.Infinite);
     } catch (Exception e) {
         ActorEventSource.Current.ActorHostInitializationFailed(e.ToString());
         throw;
     }
 }
示例#24
0
        public async Task StartAsync(CancellationToken cancellationToken)
        {
            try
            {
                Func <StatefulServiceContext, ActorTypeInformation, ActorService> create = (context, actorType) => {
                    _addServiceContextToLogging?.Invoke(context);
                    return(_actorServiceFactory.Create(context, actorType));
                };

                await ActorRuntime.RegisterActorAsync <TActor>(
                    create,
                    _registrationOptions.Timeout           = default,
示例#25
0
        /// <summary>
        /// This is the entry point of the service host process.
        /// </summary>
        private static void Main()
        {
            // This line registers an Actor Service to host your actor class with the Service Fabric runtime.
            // The contents of your ServiceManifest.xml and ApplicationManifest.xml files
            // are automatically populated when you build this project.
            // For more information, see http://aka.ms/servicefabricactorsplatform

            ActorRuntime.RegisterActorAsync <TaskExecutorActor>(
                (context, actorType) => new ActorService(context, actorType, () => new TaskExecutorActor())).Wait();

            Thread.Sleep(Timeout.Infinite);
        }
示例#26
0
 /// <summary>
 /// This is the entry point of the service host process.
 /// </summary>
 private static void Main()
 {
     try
     {
         ActorRuntime.RegisterActorAsync <SubscribingActor>().GetAwaiter().GetResult();
         Thread.Sleep(Timeout.Infinite);                  // Prevents this host process from terminating so services keeps running.
     }
     catch (Exception e)
     {
         ActorEventSource.Current.ActorHostInitializationFailed(e);
         throw;
     }
 }
        /// <summary>
        /// This is the entry point of the service host process.
        /// </summary>
        private static void Main()
        {
            try
            {
                ActorRuntime.RegisterActorAsync <MyActor>((context, actorType) => new MyActorService(context, actorType)).GetAwaiter().GetResult();

                Thread.Sleep(Timeout.Infinite);
            }
            catch (Exception e)
            {
                throw;
            }
        }
示例#28
0
 public static void Main(string[] args)
 {
     try
     {
         ActorRuntime.RegisterActorAsync <CustomerOrderActor>();
         Thread.Sleep(Timeout.Infinite);
     }
     catch (Exception e)
     {
         ActorEventSource.Current.ActorHostInitializationFailed(e.ToString());
         throw;
     }
 }
示例#29
0
 private static void Main()
 {
     try
     {
         ActorRuntime.RegisterActorAsync <Sheep>((context, information) => new ActorService(context, information, () => new Sheep()));
         Thread.Sleep(Timeout.Infinite);
     }
     catch (Exception e)
     {
         ActorEventSource.Current.ActorHostInitializationFailed(e.ToString());
         throw;
     }
 }
 private static void Main()
 {
     ActorRuntime.RegisterActorAsync <Pool>((context, actorType) =>
     {
         return(new PoolsActorService(
                    context,
                    actorType,
                    "PoolActorServiceEndpoint",
                    (svc, id) =>
                    new Pool(svc, id)
                    ));
     }).GetAwaiter().GetResult();
     Thread.Sleep(Timeout.Infinite);
 }