public override void InvokeMessageHandler(IMessageHandlerInvocation invocation) { using (invocation.SetupForInvocation()) { _handler(invocation.Message); } }
public override void InvokeMessageHandler(IMessageHandlerInvocation invocation) { var handler = CreateHandler(invocation.Context); using (invocation.SetupForInvocation(handler)) { _handleAction(handler, invocation.Message); } }
public override void InvokeMessageHandler(IMessageHandlerInvocation invocation) { var handler = CreateHandler(invocation.Context); using (invocation.SetupForInvocation(handler)) { _handleAction(handler, invocation.Messages[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); } } }
public override void InvokeMessageHandler(IMessageHandlerInvocation invocation) { Invoked = true; using (invocation.SetupForInvocation()) { var message = invocation.Messages.OfType <IExecutableMessage>().FirstOrDefault(); message?.Execute(invocation); } }
public override void InvokeMessageHandler(IMessageHandlerInvocation invocation) { Invoked = true; using (invocation.SetupForInvocation()) { var message = invocation.Messages.ExpectedSingle() as IExecutableMessage; message?.Execute(invocation); } }
public override void InvokeMessageHandler(IMessageHandlerInvocation invocation) { Invoked = true; if (InvokeMessageHandlerCallback == null) return; using (invocation.SetupForInvocation()) { InvokeMessageHandlerCallback(invocation); } }
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; }
public void should_invoke_handler_async() { IMessageHandlerInvocation capturedMessageHandlerInvocation = null; _invoker.InvokeMessageHandlerCallback = x => capturedMessageHandlerInvocation = x; _invocation.RunAsync().RunSynchronously(); _invoker.Invoked.ShouldBeTrue(); capturedMessageHandlerInvocation.ShouldEqual(_invocation); }
public async Task ExecuteAsync(IMessageHandlerInvocation invocation) { HandleStarted.Set(); DispatchQueueName = DispatchQueue.GetCurrentDispatchQueueName(); var callbackTask = Callback?.Invoke(invocation); if (callbackTask != null) { await callbackTask.ConfigureAwait(false); } }
public void Execute(IMessageHandlerInvocation invocation) { HandleStarted.Set(); DispatchQueueName = DispatchQueue.GetCurrentDispatchQueueName(); Callback?.Invoke(invocation); if (IsBlocking) { _blockingSignal.Wait(5.Seconds()); } }
public override void InvokeMessageHandler(IMessageHandlerInvocation invocation) { Invoked = true; if (InvokeMessageHandlerCallback == null) { return; } using (invocation.SetupForInvocation()) { InvokeMessageHandlerCallback(invocation); } }
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)); } }
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); } } } }
public abstract void InvokeMessageHandler(IMessageHandlerInvocation invocation);
public abstract void InvokeMessageHandler(IMessageHandlerInvocation invocation);
public override void InvokeMessageHandler(IMessageHandlerInvocation invocation) { throw new NotSupportedException(); }
public override void InvokeMessageHandler(IMessageHandlerInvocation invocation) { throw new NotSupportedException($"{nameof(InvokeMessageHandler)} is not supported in Asynchronous mode"); }
public override void InvokeMessageHandler(IMessageHandlerInvocation invocation) { }
public virtual Task InvokeMessageHandlerAsync(IMessageHandlerInvocation invocation) { return(new Task(() => InvokeMessageHandler(invocation), TaskCreationOptions.HideScheduler)); }
public override void InvokeMessageHandler(IMessageHandlerInvocation invocation) { throw new NotSupportedException(); }
public virtual Task InvokeMessageHandlerAsync(IMessageHandlerInvocation invocation) { throw new NotSupportedException("InvokeMessageHandlerAsync is not supported in Synchronous mode"); }
public virtual Task InvokeMessageHandlerAsync(IMessageHandlerInvocation invocation) { return new Task(() => InvokeMessageHandler(invocation), TaskCreationOptions.HideScheduler); }