示例#1
0
        /// <summary>
        /// TBD
        /// </summary>
        /// <param name="message">TBD</param>
        protected void SendMessageBuffer(EntityStarted message)
        {
            var id = message.EntityId;

            // Get the buffered messages and remove the buffer
            IImmutableList <Tuple <Msg, IActorRef> > buffer;

            if (MessageBuffers.TryGetValue(id, out buffer))
            {
                MessageBuffers = MessageBuffers.Remove(id);
            }

            if (buffer.Count != 0)
            {
                Log.Debug("Sending message buffer for entity [{0}] ([{1}] messages)", id, buffer.Count);

                GetEntity(id);

                // Now there is no deliveryBuffer we can try to redeliver
                // and as the child exists, the message will be directly forwarded
                foreach (var pair in buffer)
                {
                    DeliverMessage(pair.Item1, pair.Item2);
                }
            }
        }
示例#2
0
 private object EntityStartedFromBinary(byte[] binary)
 {
     using (var stream = new MemoryStream(binary, false))
     {
         var msg = EntityStarted.ParseFrom(stream);
         return(new Shard.EntityStarted(msg.EntityId));
     }
 }
示例#3
0
 private EntityStarted EntityStartedToProto(Shard.EntityStarted entityStarted)
 {
     return(EntityStarted.CreateBuilder().SetEntityId(entityStarted.EntityId).Build());
 }