Example #1
0
        private void OnInvokeMethodRequest(ActorSender sender, ActorMessageEnvelope <InvokeMethodRequest> request)
        {
            request.Message.Deserialize(_methodFixture.ArgumentDecoder);
            var message = InvokeMethod(request.Message);

            message.Serialize(_methodFixture.ArgumentEncoder);

            var response = new ActorMessageEnvelope <InvokeMethodResponse>()
            {
                CorrelationID   = request.MessageID,
                CorrelationTime = request.MessageTime,
                Message         = message,
            };

            this.BeginReply(sender.ChannelIdentifier, response);
        }
Example #2
0
 protected override void DoHandleMessage(ActorSender sender, ActorMessageEnvelope envelope)
 {
     if (GetAdmissibleMessageHandleStrategy(envelope.MessageType).IsOneWay)
     {
         base.DoHandleMessage(sender, envelope);
     }
     else
     {
         envelope.HandledBy(this.Actor, GetAdmissibleMessageType(envelope.MessageType), this.Actor.Decoder, sender,
                            (object o) =>
         {
             return(o
                    .GetType()
                    .GetMethod("OnSyncMessage")
                    .MakeGenericMethod(GetAdmissibleMessageType(envelope.MessageType)));
         });
     }
 }
Example #3
0
 protected override void DoHandleMessage(ActorSender sender, ActorMessageEnvelope envelope)
 {
     if (IsRateLimited)
     {
         _rateLimiter.Wait();
         try
         {
             base.DoHandleMessage(sender, envelope);
         }
         finally
         {
             _rateLimiter.Release();
         }
     }
     else
     {
         base.DoHandleMessage(sender, envelope);
     }
 }
 public virtual void HandleMessage(ActorSender sender, ActorMessageEnvelope envelope)
 {
     if (GetAdmissibleMessageHandleStrategy(envelope.MessageType).IsAsyncPattern)
     {
         Task.Factory.StartNew(() =>
         {
             try
             {
                 DoHandleMessage(sender, envelope);
             }
             catch (Exception ex)
             {
                 _log.Error(ex.Message, ex);
             }
         },
                               TaskCreationOptions.PreferFairness);
     }
     else
     {
         DoHandleMessage(sender, envelope);
     }
 }
 protected virtual void DoHandleMessage(ActorSender sender, ActorMessageEnvelope envelope)
 {
     envelope.HandledBy(this, GetAdmissibleMessageType(envelope.MessageType), this.Actor.Decoder, sender);
 }
Example #6
0
 private void OnInvokeMethodMessage(ActorSender sender, ActorMessageEnvelope <InvokeMethodMessage> request)
 {
     request.Message.Deserialize(_methodFixture.ArgumentDecoder);
     InvokeMethod(request.Message);
 }