コード例 #1
0
ファイル: AkkaPduCodec.cs プロジェクト: xyicheng/akka.net
        /// <summary>
        /// TBD
        /// </summary>
        /// <param name="raw">TBD</param>
        /// <param name="provider">TBD</param>
        /// <param name="localAddress">TBD</param>
        /// <returns>TBD</returns>
        public override AckAndMessage DecodeMessage(ByteString raw, RemoteActorRefProvider provider, Address localAddress)
        {
            var ackAndEnvelope = AckAndEnvelopeContainer.Parser.ParseFrom(raw);

            Ack ackOption = null;

            if (ackAndEnvelope.Ack != null)
            {
                ackOption = new Ack(new SeqNo((long)ackAndEnvelope.Ack.CumulativeAck), ackAndEnvelope.Ack.Nacks.Select(x => new SeqNo((long)x)));
            }

            Message messageOption = null;

            if (ackAndEnvelope.Envelope != null)
            {
                var envelopeContainer = ackAndEnvelope.Envelope;
                if (envelopeContainer != null)
                {
                    var     recipient = provider.ResolveActorRefWithLocalAddress(envelopeContainer.Recipient.Path, localAddress);
                    Address recipientAddress;
                    if (AddressCache != null)
                    {
                        recipientAddress = AddressCache.Cache.GetOrCompute(envelopeContainer.Recipient.Path);
                    }
                    else
                    {
                        ActorPath.TryParseAddress(envelopeContainer.Recipient.Path, out recipientAddress);
                    }

                    var       serializedMessage = envelopeContainer.Message;
                    IActorRef senderOption      = null;
                    if (envelopeContainer.Sender != null)
                    {
                        senderOption = provider.ResolveActorRefWithLocalAddress(envelopeContainer.Sender.Path, localAddress);
                    }
                    SeqNo seqOption = null;
                    if (envelopeContainer.Seq != SeqUndefined)
                    {
                        unchecked
                        {
                            seqOption = new SeqNo((long)envelopeContainer.Seq); //proto takes a ulong
                        }
                    }
                    messageOption = new Message(recipient, recipientAddress, serializedMessage, senderOption, seqOption);
                }
            }


            return(new AckAndMessage(ackOption, messageOption));
        }
コード例 #2
0
 public abstract AckAndMessage DecodeMessage(ByteString raw, RemoteActorRefProvider provider, Address localAddress);
コード例 #3
0
ファイル: AkkaPduCodec.cs プロジェクト: Micha-kun/akka.net
        public override AckAndMessage DecodeMessage(ByteString raw, RemoteActorRefProvider provider, Address localAddress)
        {
            var ackAndEnvelope = AckAndEnvelopeContainer.ParseFrom(raw);

            Ack ackOption = null;

            if (ackAndEnvelope.HasAck)
            {
                ackOption = new Ack(new SeqNo((long)ackAndEnvelope.Ack.CumulativeAck), ackAndEnvelope.Ack.NacksList.Select(x => new SeqNo((long)x)));
            }

            Message messageOption = null;

            if (ackAndEnvelope.HasEnvelope)
            {
                var envelopeContainer = ackAndEnvelope.Envelope;
                if (envelopeContainer != null)
                {
                    var recipient = provider.ResolveActorRefWithLocalAddress(envelopeContainer.Recipient.Path, localAddress);
                    Address recipientAddress;
                    ActorPath.TryParseAddress(envelopeContainer.Recipient.Path, out recipientAddress);
                    var serializedMessage = envelopeContainer.Message;
                    IActorRef senderOption = null;
                    if (envelopeContainer.HasSender)
                    {
                        senderOption = provider.ResolveActorRefWithLocalAddress(envelopeContainer.Sender.Path, localAddress);
                    }
                    SeqNo seqOption = null;
                    if (envelopeContainer.HasSeq)
                    {
                        unchecked
                        {
                            seqOption = new SeqNo((long)envelopeContainer.Seq); //proto takes a ulong
                        }
                    }
                    messageOption = new Message(recipient, recipientAddress, serializedMessage, senderOption, seqOption);
                }
            }


            return new AckAndMessage(ackOption, messageOption);
        }
コード例 #4
0
ファイル: AkkaPduCodec.cs プロジェクト: Micha-kun/akka.net
 public abstract AckAndMessage DecodeMessage(ByteString raw, RemoteActorRefProvider provider, Address localAddress);
コード例 #5
0
 public BenchmarkActorRef(Counter counter, RemoteActorRefProvider provider)
 {
     _counter = counter;
     Provider = provider;
     Path = new RootActorPath(Provider.DefaultAddress) / "user" / "tempRef";
 }
コード例 #6
0
 public BenchmarkActorRef(Counter counter, RemoteActorRefProvider provider)
 {
     _counter = counter;
     Provider = provider;
     Path     = new RootActorPath(Provider.DefaultAddress) / "user" / "tempRef";
 }
コード例 #7
0
 public ActorRefResolveCache(RemoteActorRefProvider provider, int capacity = 1024, int evictAgeThreshold = 600) : base(capacity, evictAgeThreshold)
 {
     _provider = provider;
 }
コード例 #8
0
 public ActorRefResolveThreadLocalCache(RemoteActorRefProvider provider)
 {
     _provider = provider;
     _current  = new ThreadLocal <ActorRefResolveCache>(() => new ActorRefResolveCache(_provider));
 }