Example #1
0
 public void Update(VCActor sender, VCActor receiver, VCMessage message, string user)
 {
     Sender   = sender;
     Receiver = receiver;
     Message  = message;
     User     = user;
 }
Example #2
0
 public VectorClock()
 {
     Sender   = null;
     Receiver = null;
     Message  = new VCMessage();
     Clock    = new VCClock();
     User     = null;
 }
        void ReleaseDesignerOutlets()
        {
            if (VCMessage != null)
            {
                VCMessage.Dispose();
                VCMessage = null;
            }

            if (VCUserIdentity != null)
            {
                VCUserIdentity.Dispose();
                VCUserIdentity = null;
            }
        }
Example #4
0
        public void Enqueue(IActorRef receiver, Envelope envelope)
        {
            VCMessage message       = GetMessage(envelope);
            VCActor   senderActor   = new VCActor(envelope.Sender.Path.ToString(), GetActorType(envelope.Sender));
            VCActor   receiverActor = new VCActor(receiver.Path.ToString(), GetActorType(receiver));

            OnSend(receiverActor, senderActor, message);

            OnReceive(receiverActor, senderActor, message);

            SendToAPI();

            _messageQueue.Enqueue(receiver, envelope);
        }
Example #5
0
        private void OnSend(VCActor receiver, VCActor sender, VCMessage message)
        {
            _clock_sender = VectorClockHelper.GetVectorClock(sender.Path.ToString());

            _clock_sender.Update(
                sender,
                receiver,
                message,
                GetUser()
                );

            _clock_sender.Tick(sender.Path.ToString());

            VectorClockHelper.Update(sender.Path.ToString(), _clock_sender);
        }
Example #6
0
        private VCMessage GetMessage(Envelope envelope)
        {
            VCMessage message = new VCMessage(envelope.Message.GetType().Name);
            var       props   = envelope.Message.GetType().GetProperties();

            foreach (var prop in props)
            {
                try
                {
                    var value = envelope.Message.GetType().GetProperty(prop.Name).GetValue(envelope.Message);
                    if (value == null)
                    {
                        throw new Exception();
                    }
                    message.AddProp(prop.Name, value.ToString());
                }
                catch { message.AddProp(prop.Name, ""); }
            }

            return(message);
        }