Пример #1
0
 public void LookAt(PublishToken token)
 {
     foreach (var s in token.Subscriptions)
     {
         s.Push(token.Message);
     }
 }
Пример #2
0
        public void LookAt(PublishToken token)
        {
            var tasks = token.Subscriptions.Select(s => _taskMaker.StartNew(() => s.Push(token.Message))).ToArray();

            Task.WaitAll(tasks);
            tasks.PublishExceptionMessages(bus);
        }
Пример #3
0
 public void LookAt(PublishToken token)
 {
     for (var i = 0; i <= _pipelineMembers.Count - 1; i++)
     {
         if (token.Cancel)
             break;
         _pipelineMembers[i].LookAt(token);
     }
 }
Пример #4
0
 public void LookAt(PublishToken token)
 {
     for (var i = 0; i <= _pipelineMembers.Count - 1; i++)
     {
         if (token.Cancel)
         {
             break;
         }
         _pipelineMembers[i].LookAt(token);
     }
 }
 public void LookAt(PublishToken token)
 {
     var tasks = token.Subscriptions.Select(s => taskMaker.StartNew(() => s.Push(token.Message))).ToArray();
     if (tasks.Length == 0)
         return;
     taskMaker.ContinueWhenAll(tasks,
                               ts =>
                                   {
                                       //TODO: How to catch this exception? Seems to go to Nirvana...
                                       if (token.Message is ExceptionOccurred && ts.Any(t=>t.IsFaulted))
                                           throw new MemBusException("Possible infinite messaging cycle since handling ExceptionOccurred has produced unhandled exceptions!");
                                       ts.PublishExceptionMessages(bus);
                                   });
 }
Пример #6
0
        public void LookAt(PublishToken token)
        {
            var info = new MessageInfo(token.Message);

            for (int i = _pipelines.Count - 1; i >= 0; i--) //Backwards as we keep the default at index 0
            {
                if (!_pipelines[i].Handles(info))
                {
                    continue;
                }
                _pipelines[i].LookAt(token);
                break;
            }
        }
Пример #7
0
        public void LookAt(PublishToken token)
        {
            var message = (ActivateViewModelMsg)token.Message;

            // Sometimes objects that are bound to WPF and are created not on the dispatcher thread throw exceptions
            // hence we ensure that viewmodels are created on said dispatcher thread
            _dispatchServices.EnsureActionOnDispatcher(
                () =>
                    {
                        var obj = _container.With(message).GetInstance(message.ViewModelType);

                        if (obj == null)
                            // SM could not instantiate the type for whatever reason
                            return;
                        message.SetInstantiatedModel(obj);
                    });
        }
Пример #8
0
        public void publishes_message_fire_and_forget()
        {
            var p = new ParallelNonBlockingPublisher();
            var evtBlock = new ManualResetEvent(false);
            var evtSignal = new ManualResetEvent(false);
            var evtSignal2 = new ManualResetEvent(false);
            var lockingSub = new MockSubscription<MessageA>(evtBlock, evtSignal);
            var runThroughSub = new MockSubscription<MessageA>(evtSignal:evtSignal2);

            var token = new PublishToken(new MessageA(), new[] { lockingSub, runThroughSub });
            p.LookAt(token);
            lockingSub.Received.ShouldBeEqualTo(0);
            evtSignal2.WaitOne();
            runThroughSub.Received.ShouldBeEqualTo(1);
            evtBlock.Set();
            evtSignal.WaitOne();
            lockingSub.Received.ShouldBeEqualTo(1);
        }
        public void LookAt(PublishToken token)
        {
            var tasks = token.Subscriptions.Select(s => taskMaker.StartNew(() => s.Push(token.Message))).ToArray();

            if (tasks.Length == 0)
            {
                return;
            }
            taskMaker.ContinueWhenAll(tasks,
                                      ts =>
            {
                //TODO: How to catch this exception? Seems to go to Nirvana...
                if (token.Message is ExceptionOccurred && ts.Any(t => t.IsFaulted))
                {
                    throw new MemBusException("Possible infinite messaging cycle since handling ExceptionOccurred has produced unhandled exceptions!");
                }
                ts.PublishExceptionMessages(_bus);
            });
        }
Пример #10
0
 public void LookAt(PublishToken token)
 {
     var tasks = token.Subscriptions.Select(s => _taskMaker.StartNew(() => s.Push(token.Message))).ToArray();
     Task.WaitAll(tasks);
     tasks.PublishExceptionMessages(_bus);
 }
Пример #11
0
 private static void publisherCheck(IPublishPipelineMember p)
 {
     var token = new PublishToken(new MessageA(), new[] { new MockSubscription<MessageA>(), new MockSubscription<MessageA>() });
     p.LookAt(token);
     token.Subscriptions.OfType<MockSubscription<MessageA>>().All(s=>s.Received == 1).ShouldBeTrue();
 }
Пример #12
0
 public void LookAt(PublishToken token)
 {
     _bus.Publish(_message);
 }
Пример #13
0
 #pragma warning disable 1998 //This is just a route through method, so it's OK if this part does run synchronously
 public async Task LookAtAsync(PublishToken token)
 {
     await Task.Run(() => LookAt(token));
 }
Пример #14
0
 public void LookAt(PublishToken token)
 {
     token.Subscriptions.Select(s => _taskMaker.StartNew(() => s.Push(token.Message))).ToArray();
 }
Пример #15
0
 #pragma warning disable 1998 //This is just a route through method, so it's OK if this part does run synchronously
 public async Task LookAtAsync(PublishToken token)
 {
     await Task.Run(() => LookAt(token));
 }
Пример #16
0
 public void LookAt(PublishToken token)
 {
     token.Subscriptions.Select(s => _taskMaker.StartNew(() => s.Push(token.Message))).ToArray();
 }
Пример #17
0
 public async Task LookAtAsync(PublishToken token)
 {
     IAsyncPublishPipelineMember publisher = new SequentialPublisher();
     await publisher.LookAtAsync(token);
 }
        void IPublishPipelineMember.LookAt(PublishToken token)
        {
            var member = _actualPipelineMember();

            member.LookAt(token);
        }
Пример #19
0
 public void LookAt(PublishToken token)
 {
     foreach (var s in token.Subscriptions)
         s.Push(token.Message);
 }