Пример #1
0
 public override void InvokeMessageHandler(IMessageHandlerInvocation invocation)
 {
     using (invocation.SetupForInvocation())
     {
         _handler(invocation.Message);
     }
 }
Пример #2
0
 public override void InvokeMessageHandler(IMessageHandlerInvocation invocation)
 {
     var handler = CreateHandler(invocation.Context);
     using (invocation.SetupForInvocation(handler))
     {
         _handleAction(handler, invocation.Message);
     }
 }
Пример #3
0
        public override void InvokeMessageHandler(IMessageHandlerInvocation invocation)
        {
            var handler = CreateHandler(invocation.Context);

            using (invocation.SetupForInvocation(handler))
            {
                _handleAction(handler, invocation.Messages[0]);
            }
        }
Пример #4
0
 public void Setup()
 {
     _invoker           = new TestMessageHandlerInvoker <FakeCommand>();
     _message           = new FakeCommand(123);
     _messageContext    = MessageContext.CreateTest("u.name");
     _pipes             = new List <IPipe>();
     _invocation        = new PipeInvocation(_invoker, _message, _messageContext, _pipes);
     _handlerInvocation = _invocation;
 }
 public override void InvokeMessageHandler(IMessageHandlerInvocation invocation)
 {
     using (invocation.SetupForInvocation())
     {
         foreach (var message in invocation.Messages)
         {
             _handler(message);
         }
     }
 }
Пример #6
0
        public override void InvokeMessageHandler(IMessageHandlerInvocation invocation)
        {
            Invoked = true;

            using (invocation.SetupForInvocation())
            {
                var message = invocation.Messages.OfType <IExecutableMessage>().FirstOrDefault();
                message?.Execute(invocation);
            }
        }
Пример #7
0
        public override void InvokeMessageHandler(IMessageHandlerInvocation invocation)
        {
            Invoked = true;

            using (invocation.SetupForInvocation())
            {
                var message = invocation.Messages.ExpectedSingle() as IExecutableMessage;
                message?.Execute(invocation);
            }
        }
Пример #8
0
        public override void InvokeMessageHandler(IMessageHandlerInvocation invocation)
        {
            Invoked = true;
            if (InvokeMessageHandlerCallback == null)
                return;

            using (invocation.SetupForInvocation())
            {
                InvokeMessageHandlerCallback(invocation);
            }
        }
Пример #9
0
 public void Setup()
 {
     _invoker        = new TestMessageHandlerInvoker <ExecutableEvent>();
     _message        = new ExecutableEvent();
     _messageContext = MessageContext.CreateTest();
     _pipes          = new List <IPipe>();
     _invocation     = new PipeInvocation(_invoker, new List <IMessage> {
         _message
     }, _messageContext, _pipes);
     _handlerInvocation = _invocation;
 }
Пример #10
0
        public void should_invoke_handler_async()
        {
            IMessageHandlerInvocation capturedMessageHandlerInvocation = null;

            _invoker.InvokeMessageHandlerCallback = x => capturedMessageHandlerInvocation = x;

            _invocation.RunAsync().RunSynchronously();

            _invoker.Invoked.ShouldBeTrue();
            capturedMessageHandlerInvocation.ShouldEqual(_invocation);
        }
Пример #11
0
        public async Task ExecuteAsync(IMessageHandlerInvocation invocation)
        {
            HandleStarted.Set();
            DispatchQueueName = DispatchQueue.GetCurrentDispatchQueueName();

            var callbackTask = Callback?.Invoke(invocation);

            if (callbackTask != null)
            {
                await callbackTask.ConfigureAwait(false);
            }
        }
Пример #12
0
        public void Execute(IMessageHandlerInvocation invocation)
        {
            HandleStarted.Set();
            DispatchQueueName = DispatchQueue.GetCurrentDispatchQueueName();

            Callback?.Invoke(invocation);

            if (IsBlocking)
            {
                _blockingSignal.Wait(5.Seconds());
            }
        }
Пример #13
0
        public override void InvokeMessageHandler(IMessageHandlerInvocation invocation)
        {
            Invoked = true;
            if (InvokeMessageHandlerCallback == null)
            {
                return;
            }

            using (invocation.SetupForInvocation())
            {
                InvokeMessageHandlerCallback(invocation);
            }
        }
Пример #14
0
 public override Task InvokeMessageHandlerAsync(IMessageHandlerInvocation invocation)
 {
     try
     {
         var handler = CreateHandler(_container, invocation.Context);
         using (invocation.SetupForInvocation(handler))
         {
             return(_handleAction(handler, invocation.Messages[0]));
         }
     }
     catch (Exception ex)
     {
         return(Task.FromException(ex));
     }
 }
Пример #15
0
 public override Task InvokeMessageHandlerAsync(IMessageHandlerInvocation invocation)
 {
     try
     {
         var handler = CreateHandler(_container, invocation.Context);
         using (invocation.SetupForInvocation(handler))
         {
             return _handleAction(handler, invocation.Message);
         }
     }
     catch (Exception ex)
     {
         return TaskUtil.FromError(ex);
     }
 }
        public override async Task InvokeMessageHandlerAsync(IMessageHandlerInvocation invocation)
        {
            Invoked = true;

            using (invocation.SetupForInvocation())
            {
                foreach (var message in invocation.Messages)
                {
                    (message as IExecutableMessage)?.Execute(invocation);

                    var asyncTask = (message as IAsyncExecutableMessage)?.ExecuteAsync(invocation);
                    if (asyncTask != null)
                    {
                        await asyncTask.ConfigureAwait(false);
                    }
                }
            }
        }
Пример #17
0
 public abstract void InvokeMessageHandler(IMessageHandlerInvocation invocation);
Пример #18
0
 public abstract void InvokeMessageHandler(IMessageHandlerInvocation invocation);
 public override void InvokeMessageHandler(IMessageHandlerInvocation invocation)
 {
     throw new NotSupportedException();
 }
Пример #20
0
 public override void InvokeMessageHandler(IMessageHandlerInvocation invocation)
 {
     throw new NotSupportedException($"{nameof(InvokeMessageHandler)} is not supported in Asynchronous mode");
 }
Пример #21
0
 public override void InvokeMessageHandler(IMessageHandlerInvocation invocation)
 {
 }
Пример #22
0
 public virtual Task InvokeMessageHandlerAsync(IMessageHandlerInvocation invocation)
 {
     return(new Task(() => InvokeMessageHandler(invocation), TaskCreationOptions.HideScheduler));
 }
Пример #23
0
 public override void InvokeMessageHandler(IMessageHandlerInvocation invocation)
 {
     throw new NotSupportedException();
 }
Пример #24
0
 public virtual Task InvokeMessageHandlerAsync(IMessageHandlerInvocation invocation)
 {
     throw new NotSupportedException("InvokeMessageHandlerAsync is not supported in Synchronous mode");
 }
Пример #25
0
 public virtual Task InvokeMessageHandlerAsync(IMessageHandlerInvocation invocation)
 {
     return new Task(() => InvokeMessageHandler(invocation), TaskCreationOptions.HideScheduler);
 }