Inheritance: IRequestTarget
Ejemplo n.º 1
0
        // Wrap ICanTell into TRef (not type-safe cast)

        public static TRef Cast <TRef>(this ICanTell receiver)
            where TRef : InterfacedActorRef, new()
        {
            if (receiver == null)
            {
                return(null);
            }

            var target = new AkkaReceiverTarget(receiver);

            return(new TRef {
                Target = target, RequestWaiter = target.DefaultRequestWaiter
            });
        }
Ejemplo n.º 2
0
        // Wrap typed actor-ref into TRef (type-safe)

        public static TRef Cast <TRef>(this TypedActorRef actorRef)
            where TRef : InterfacedActorRef, new()
        {
            if (actorRef.Actor == null)
            {
                return(null);
            }

            var target      = new AkkaReceiverTarget(actorRef.Actor);
            var newActorRef = new TRef {
                Target = target, RequestWaiter = target.DefaultRequestWaiter
            };

            CheckIfActorImplementsOrThrow(actorRef.Type, newActorRef.InterfaceType);

            return(newActorRef);
        }