/// <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)); }
public abstract AckAndMessage DecodeMessage(ByteString raw, RemoteActorRefProvider provider, Address localAddress);
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); }
public BenchmarkActorRef(Counter counter, RemoteActorRefProvider provider) { _counter = counter; Provider = provider; Path = new RootActorPath(Provider.DefaultAddress) / "user" / "tempRef"; }
public ActorRefResolveCache(RemoteActorRefProvider provider, int capacity = 1024, int evictAgeThreshold = 600) : base(capacity, evictAgeThreshold) { _provider = provider; }
public ActorRefResolveThreadLocalCache(RemoteActorRefProvider provider) { _provider = provider; _current = new ThreadLocal <ActorRefResolveCache>(() => new ActorRefResolveCache(_provider)); }