Наследование: InterfacedActorRef, IActorBoundGateway, IActorBoundGateway_NoReply
Пример #1
0
 public static async Task <IRequestTarget> BindActorOrOpenChannel(
     this ActorBoundChannelRef channel, IActorRef actor, TaggedType[] types, ActorBindingFlags bindingFlags,
     string gatewayName, object tag, ActorBindingFlags bindingFlagsForOpenChannel)
 {
     if (string.IsNullOrEmpty(gatewayName) || (channel != null && channel.CastToIActorRef().Path.Address == actor.Path.Address))
     {
         // link an actor to channel directly
         return(await channel.BindActor(actor, types, bindingFlags));
     }
     else
     {
         // grant client to access an actor via gateway
         var gatewayRef = ((InternalActorRefBase)actor).Provider.ResolveActorRef(actor.Path.Root / "user" / gatewayName);
         var gateway    = new ActorBoundGatewayRef(new AkkaReceiverTarget(gatewayRef));
         return(await gateway.WithTimeout(TimeSpan.FromSeconds(10)).OpenChannel(actor, types, tag, bindingFlagsForOpenChannel));
     }
 }
Пример #2
0
 public static async Task<IRequestTarget> BindActorOrOpenChannel(
     this ActorBoundChannelRef channel, IActorRef actor, TaggedType[] types, ActorBindingFlags bindingFlags,
     string gatewayName, object tag, ActorBindingFlags bindingFlagsForOpenChannel)
 {
     if (string.IsNullOrEmpty(gatewayName) || (channel != null && channel.CastToIActorRef().Path.Address == actor.Path.Address))
     {
         // link an actor to channel directly
         return await channel.BindActor(actor, types, bindingFlags);
     }
     else
     {
         // grant client to access an actor via gateway
         var gatewayRef = ((InternalActorRefBase)actor).Provider.ResolveActorRef(actor.Path.Root / "user" / gatewayName);
         var gateway = new ActorBoundGatewayRef(new AkkaReceiverTarget(gatewayRef));
         return await gateway.WithTimeout(TimeSpan.FromSeconds(10)).OpenChannel(actor, types, tag, bindingFlagsForOpenChannel);
     }
 }