Ejemplo n.º 1
0
        public void Intercept(IInvocation invocation)
        {
            try
            {
                Actor.ActorBase actorProxy    = (Actor.ActorBase)invocation.Proxy;
                IInternalActor  internalActor = (IInternalActor)actorProxy;
                IActorContext   oontext       = internalActor.ActorContext;


                if (invocation.Method.Name.Equals("PreStart", StringComparison.InvariantCultureIgnoreCase))
                {
                    oontext.IncrementActorCreated();
                }
                if (invocation.Method.Name.Equals("AroundReceive", StringComparison.InvariantCultureIgnoreCase))
                {
                    oontext.IncrementMessagesReceived();
                }

                Console.WriteLine("{0} - {1}", invocation.TargetType.Name, invocation.Method.Name);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            invocation.Proceed();
        }