public Task <IActorResponse> CallWithoutException(long actorId, IActorRequest message)
        {
            if (actorId == 0)
            {
                throw new Exception($"actor id is 0: {DCETRuntime.MongoHelper.ToJson(message)}");
            }

            string  address = StartConfigComponent.Instance.GetProcessInnerAddress(IdGenerater.GetProcessId(actorId));
            Session session = NetInnerComponent.Instance.Get(address);

            message.ActorId = actorId & IdGenerater.HeadMask | IdGenerater.Head;
            message.RpcId   = ++RpcId;

            var tcs = new TaskCompletionSource <IActorResponse>();

            requestCallback.Add(message.RpcId, new ActorMessageSender((response) =>
            {
                tcs.SetResult(response);
            }));
            session.Send(message);
            return(tcs.Task);
        }
Ejemplo n.º 2
0
 protected AChannel(AService service, ChannelType channelType)
 {
     this.Id          = IdGenerater.GenerateId();
     this.ChannelType = channelType;
     this.Service     = service;
 }