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);
        }
Пример #2
0
        public static TActorInterface Create <TActorInterface>(ActorId actorId, Uri serviceUri, string listenerName = null) where TActorInterface : IActor
        {
            var proxyFactory = new CorrelatingActorProxyFactory(callbackClient =>
                                                                new FabricTransportServiceRemotingClientFactory(callbackClient: callbackClient));

            TActorInterface proxy =
                proxyFactory.CreateActorProxy <TActorInterface>(serviceUri, actorId, listenerName);

            return(proxy);
        }
 public HomeController(StatelessServiceContext serviceContext)
 {
     this.serviceContext    = serviceContext;
     this.actorProxyFactory = new CorrelatingActorProxyFactory(serviceContext, callbackClient => new FabricTransportActorRemotingClientFactory(callbackClient));
 }