Inheritance: IAkkaPdu, IHasSequenceNumber
Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 public AckAndMessage(Ack ackOption, Message messageOption)
 {
     MessageOption = messageOption;
     AckOption = ackOption;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="ackOption">TBD</param>
 /// <param name="messageOption">TBD</param>
 public AckAndMessage(Ack ackOption, Message messageOption)
 {
     MessageOption = messageOption;
     AckOption = ackOption;
 }