예제 #1
0
        protected override object OnAfterIncoming(object result, IHubIncomingInvokerContext context)
        {
            var startedOn  = (DateTime)context.StateTracker["ProfilingHubPipelineModule-Invocation-StartedOn"];
            var invocation = new InvocationModel
            {
                ConnectionId = context.Hub.Context.ConnectionId,
                Hub          = context.MethodDescriptor.Hub.Name,
                Method       = context.MethodDescriptor.Name,
                StartedOn    = startedOn,
                EndedOn      = DateTime.Now,
                Result       = new InvocationResultModel
                {
                    Value = result,
                    Type  = context.MethodDescriptor.ReturnType
                },
                Arguments = context.Args.Count > 0 ? context.Args
                            .Select((t, i) => new InvocationArgumentModel
                {
                    Value = t,
                    Name  = context.MethodDescriptor.Parameters[i].Name,
                    Type  = context.MethodDescriptor.Parameters[i].ParameterType
                })
                            .ToList() : null
            };

            PluginSettings.StoreInvocation(invocation);
            return(base.OnAfterIncoming(result, context));
        }
        protected override object OnAfterIncoming(object result, IHubIncomingInvokerContext context)
        {
            var startedOn = (DateTime)context.StateTracker["ProfilingHubPipelineModule-Invocation-StartedOn"];
            var invocation = new InvocationModel
            {
                ConnectionId = context.Hub.Context.ConnectionId,
                Hub = context.MethodDescriptor.Hub.Name,
                Method = context.MethodDescriptor.Name,
                StartedOn = startedOn,
                EndedOn = DateTime.Now,
                Result = new InvocationResultModel
                    {
                        Value = result,
                        Type = context.MethodDescriptor.ReturnType
                    },
                Arguments = context.Args.Count > 0 ? context.Args
                    .Select((t, i) => new InvocationArgumentModel
                    {
                        Value = t,
                        Name = context.MethodDescriptor.Parameters[i].Name,
                        Type = context.MethodDescriptor.Parameters[i].ParameterType
                    })
                    .ToList() : null
            };

            PluginSettings.StoreInvocation(invocation);
            return base.OnAfterIncoming(result, context);
        }
예제 #3
0
        /// <summary>
        /// Subscribes the given subscriber to notifications of the
        /// given type of message using the supplied callback.
        /// </summary>
        /// <typeparam name="T">The type of message the subecriber is interested in.</typeparam>
        /// <param name="subscriber">The subscriber.</param>
        /// <param name="invocationModel">The invocation model.</param>
        /// <param name="callbackFilter">The filter invoked to determine if the callback shopuld be invoked.</param>
        /// <param name="callback">The callback.</param>
        public void Subscribe <T>(object subscriber, InvocationModel invocationModel, Func <object, T, bool> callbackFilter, Action <object, T> callback)
        {
            Ensure.That(subscriber).Named(() => subscriber).IsNotNull();
            Ensure.That(callback).Named(() => callback).IsNotNull();
            Ensure.That(callbackFilter).Named(() => callbackFilter).IsNotNull();

            var subscription = new PocoSubscription <T>(subscriber, callback, callbackFilter, invocationModel, this.dispatcher);

            this.SubscribeCore(typeof(T), subscription);
        }
예제 #4
0
        /// <summary>
        /// Subscribes the given subscriber to notifications of the
        /// given type of message using the supplied callback only.
        /// </summary>
        /// <param name="subscriber">The subscriber.</param>
        /// <param name="messageType">Type of the message.</param>
        /// <param name="invocationModel">The invocation model.</param>
        /// <param name="callbackFilter">The filter invoked to determine if the callback shopuld be invoked.</param>
        /// <param name="callback">The callback.</param>
        public void Subscribe(object subscriber, Type messageType, InvocationModel invocationModel, Func <object, object, bool> callbackFilter, Action <object, object> callback)
        {
            Ensure.That(subscriber).Named(() => subscriber).IsNotNull();
            Ensure.That(messageType).Named(() => messageType).IsNotNull();
            Ensure.That(callbackFilter).Named(() => callbackFilter).IsNotNull();
            Ensure.That(callback).Named(() => callback).IsNotNull();

            var subscription = new PocoSubscription(subscriber, callback, callbackFilter, invocationModel, this.dispatcher);

            this.SubscribeCore(messageType, subscription);
        }
예제 #5
0
        public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result)
        {
            var model = new InvocationModel()
            {
                Contract   = Contract,
                Method     = binder.Name,
                ReturnType = binder.ReturnType,
                Arguments  = args
            };

            result = InvokeMember.Invoke(model);
            return(true);
        }
예제 #6
0
        private object OnContractMethodInvoked(InvocationModel model)
        {
            var transport = new TransportModel()
            {
                Identifier = Guid.NewGuid(),
                Contract   = model.Contract,
                Method     = model.Method,
                Parameters = model.Arguments,
                Type       = TransportType.Method
            };

            TelepathyClient.Send(SerializeTransport(transport));
            var response = WaitForReponse(transport.Identifier);

            return(response.ReturnValue);
        }
        public static InvocationModel ToInvocationModel(this Invocation invocation)
        {
            InvocationModel model;

            if (invocation == null)
            {
                return(new InvocationModel());
            }

            model = new InvocationModel()
            {
                CommandLine          = invocation.CommandLine,
                StartTime            = invocation.StartTimeUtc,
                EndTime              = invocation.EndTimeUtc,
                Machine              = invocation.Machine,
                Account              = invocation.Account,
                ProcessId            = invocation.ProcessId,
                FileName             = invocation.ExecutableLocation?.Uri?.ToString(),
                WorkingDirectory     = invocation.WorkingDirectory?.Uri?.ToString(),
                EnvironmentVariables = invocation.EnvironmentVariables,
            };

            return(model);
        }
예제 #8
0
        void Subscribe(IMessageBroker broker, String key, RegisterEventArgs h, Type genericHandler, InvocationModel invocationModel)
        {
            var messageType = genericHandler.GetGenericArguments().Single();

            logger.Debug
            (
                "\tSubscribing to message: {0}",
                messageType.ToString("SN")
            );

            if (genericHandler.Is <IMessageHandler>())
            {
                broker.Subscribe(this, messageType, invocationModel, msg =>
                {
                    if (this.Container != null)
                    {
                        var handler = this.Container.Resolve(h.TypeFrom, key) as IMessageHandler;
                        if (handler != null)
                        {
                            logger.Debug
                            (
                                "Dispatching message {0} to IMessageHandler {1}",
                                msg.GetType().ToString("SN"),
                                handler.GetType().ToString("SN")
                            );

                            if (handler.ShouldHandle(msg))
                            {
                                handler.Handle(msg);
                            }
                        }
                        else
                        {
                            logger.Debug
                            (
                                "IMessageHandler for {0} is null.",
                                msg.GetType().ToString("SN")
                            );
                        }
                    }
                    else
                    {
                        logger.Debug("Kernel is null.");
                        logger.Debug("Kernel is null.");
                    }
                });
            }
            else if (genericHandler.Is <IHandleMessage>())
            {
                broker.Subscribe(this, messageType, invocationModel, (s, msg) =>
                {
                    if (this.Container != null)
                    {
                        var handler = this.Container.Resolve(h.TypeFrom, key) as IHandleMessage;
                        if (handler != null)
                        {
                            logger.Debug
                            (
                                "Dispatching message {0} to IHandleMessage {1}",
                                msg.GetType().ToString("SN"),
                                handler.GetType().ToString("SN")
                            );

                            if (handler.ShouldHandle(s, msg))
                            {
                                handler.Handle(s, msg);
                            }
                        }
                        else
                        {
                            logger.Debug
                            (
                                "IHandleMessage for {0} is null.",
                                msg.GetType().ToString("SN")
                            );
                        }
                    }
                    else
                    {
                        logger.Debug("Kernel is null.");
                    }
                });
            }
        }
예제 #9
0
        void Subscribe(IContainer container, IMessageBroker broker, Guid key, Bag bag, Type genericHandler, InvocationModel invocationModel)
        {
            var messageType = genericHandler.GetGenericArguments().Single();

            logger.Debug
            (
                "\tSubscribing to message: {0}",
                messageType.ToString("SN")
            );

            if (genericHandler.Is <IMessageHandler>())
            {
                broker.Subscribe(this, messageType, invocationModel, msg =>
                {
                    var handler = container.Resolve(bag.Services.FirstOrDefault()) as IMessageHandler;
                    if (handler != null)
                    {
                        logger.Debug
                        (
                            "Dispatching message {0} to IMessageHandler {1}",
                            msg.GetType().ToString("SN"),
                            handler.GetType().ToString("SN")
                        );

                        if (handler.ShouldHandle(msg))
                        {
                            handler.Handle(msg);
                        }
                    }
                    else
                    {
                        logger.Debug
                        (
                            "IMessageHandler for {0} is null.",
                            msg.GetType().ToString("SN")
                        );
                    }
                });
            }
            else if (genericHandler.Is <IHandleMessage>())
            {
                broker.Subscribe(this, messageType, invocationModel, (s, msg) =>
                {
                    var handler = container.Resolve(bag.Services.FirstOrDefault()) as IHandleMessage;
                    if (handler != null)
                    {
                        logger.Debug
                        (
                            "Dispatching message {0} to IHandleMessage {1}",
                            msg.GetType().ToString("SN"),
                            handler.GetType().ToString("SN")
                        );

                        if (handler.ShouldHandle(s, msg))
                        {
                            handler.Handle(s, msg);
                        }
                    }
                    else
                    {
                        logger.Debug
                        (
                            "IHandleMessage for {0} is null.",
                            msg.GetType().ToString("SN")
                        );
                    }
                });
            }
        }
예제 #10
0
        public PocoAsyncSubscription(Object subscriber, Func <Object, T, System.Threading.Tasks.Task> action, Func <Object, T, System.Threading.Tasks.Task <bool> > actionFilter, InvocationModel invocationModel, IDispatcher dispatcher)
        {
            Ensure.That(subscriber).Named(() => subscriber).IsNotNull();
            Ensure.That(action).Named(() => action).IsNotNull();
            Ensure.That(actionFilter).Named(() => actionFilter).IsNotNull();
            Ensure.That(dispatcher).Named(() => dispatcher).IsNotNull();
            Ensure.That(invocationModel).Is(InvocationModel.Default);

            this.Subscriber      = subscriber;
            this.action          = action;
            this.actionFilter    = actionFilter;
            this.Sender          = null;
            this.InvocationModel = invocationModel;
            this.dispatcher      = dispatcher;

            this.Priority = SubscriptionPriority.Normal;
        }
예제 #11
0
 static void InvokeCore(IDispatcher dispatcher, Action <Object, Object> action, Object sender, Object message, InvocationModel type)
 {
     if (type == InvocationModel.Safe && !dispatcher.IsSafe)
     {
         dispatcher.Dispatch <Object, Object>(sender, message, action);
     }
     else
     {
         action(sender, message);
     }
 }
예제 #12
0
        /// <summary>
        /// Waits for the specified message type and raise the Changed event
        /// if the supplied confition is satisfied by the dispatched or broadcasted message.
        /// </summary>
        /// <typeparam name="TMessage">The type of the message.</typeparam>
        /// <param name="filter">The filter condition.</param>
        /// <param name="invocationModel">The invocation model.</param>
        /// <returns>This monitor instance.</returns>
        public MessageBrokerMonitor WaitingFor <TMessage>(Func <TMessage, bool> filter, InvocationModel invocationModel) where TMessage : class
        {
            this.broker.Subscribe <TMessage>(this, invocationModel, (sender, msg) =>
            {
                if (filter(msg))
                {
                    this.OnChanged();
                }
            });

            return(this);
        }
        void Subscribe( IMessageBroker broker, String key, IHandler h, Type genericHandler, InvocationModel invocationModel )
        {
            /*
             * Qui abbiamo un problema di questo tipo: quando in Castle viene
             * registrato un componente per più di un servizio, ergo per più 
             * interfacce vogliamo venga risolto lo stesso tipo, abbiamo l'inghippo
             * che Castle registra n componenti che risolvono verso lo stesso tipo
             * tante quante sono le interfacce. Quindi l'evento qui registrato viene
             * scatenato n volte e siccome il primo test che noi facciamo è verificare
             * che il servizio sia IMessageHandler se un componente gestisce n messaggi
             * arriviamo qui n volte. Se il componente inoltre richiede la Subscribe
             * automatica per quei messaggi, ha quindi più di un SubscribeToMessageAttribute
             * dobbiamo assicurarci che la subscribe venga fatta una ed una sola volta.
             * per ogni tipo di messaggio.
             */
            var messageType = genericHandler.GetGenericArguments().Single(); // attribute.MessageType;

            logger.Debug
            (
                "\tSubscribing to message: {0}",
                messageType.ToString( "SN" )
            );

            if ( genericHandler.Is<IMessageHandler>() )
            {
                broker.Subscribe( this, messageType, invocationModel, msg =>
                {
                    if ( this.Kernel != null )
                    {
                        var handler = this.Kernel.Resolve( key, h.ComponentModel.Services.First() ) as IMessageHandler;
                        if ( handler != null )
                        {
                            logger.Debug
                            (
                                "Dispatching message {0} to IMessageHandler {1}",
                                msg.GetType().ToString( "SN" ),
                                handler.GetType().ToString( "SN" )
                            );

                            if ( handler.ShouldHandle( msg ) )
                            {
                                handler.Handle( msg );
                            }
                        }
                        else
                        {
                            logger.Debug
                            (
                                "IMessageHandler for {0} is null.",
                                msg.GetType().ToString( "SN" )
                            );
                        }
                    }
                    else
                    {
                        logger.Debug( "Kernel is null." );
                        logger.Debug( "Kernel is null." );
                    }
                } );
            }
            else if ( genericHandler.Is<IHandleMessage>() )
            {
                broker.Subscribe( this, messageType, invocationModel, ( s, msg ) =>
                {
                    if ( this.Kernel != null )
                    {
                        var handler = this.Kernel.Resolve( key, h.ComponentModel.Services.First() ) as IHandleMessage;
                        if ( handler != null )
                        {
                            logger.Debug
                            (
                                "Dispatching message {0} to IHandleMessage {1}",
                                msg.GetType().ToString( "SN" ),
                                handler.GetType().ToString( "SN" )
                            );

                            if ( handler.ShouldHandle( s, msg ) )
                            {
                                handler.Handle( s, msg );
                            }
                        }
                        else
                        {
                            logger.Debug
                            (
                                "IHandleMessage for {0} is null.",
                                msg.GetType().ToString( "SN" )
                            );
                        }
                    }
                    else
                    {
                        logger.Debug( "Kernel is null." );
                    }
                } );
            }
        }
예제 #14
0
 /// <summary>
 /// Subscribes the given subscriber to notifications of the
 /// given type of message using the supplied callback only
 /// if the sender is the specified reference.
 /// </summary>
 /// <typeparam name="T">The type of message the subecriber is interested in.</typeparam>
 /// <param name="subscriber">The subscriber.</param>
 /// <param name="sender">The sender filter.</param>
 /// <param name="invocationModel">The invocation model.</param>
 /// <param name="callback">The callback.</param>
 public void Subscribe <T>(object subscriber, object sender, InvocationModel invocationModel, Action <Object, T> callback)
 {
     this.Subscribe <T>(subscriber, sender, invocationModel, (s, msg) => true, callback);
 }
예제 #15
0
 /// <summary>
 /// Subscribes the given subscriber to notifications of the
 /// given type of message using the supplied callback only
 /// if the sender is the specified reference.
 /// </summary>
 /// <param name="subscriber">The subscriber.</param>
 /// <param name="sender">The sender filter.</param>
 /// <param name="messageType">Type of the message.</param>
 /// <param name="invocationModel">The invocation model.</param>
 /// <param name="callback">The callback.</param>
 public void Subscribe(object subscriber, object sender, Type messageType, InvocationModel invocationModel, Action <Object, Object> callback)
 {
     this.Subscribe(subscriber, sender, messageType, invocationModel, (s, msg) => true, callback);
 }
        void Subscribe(IPuzzleContainer container, string key, IContainerEntry entry, Type genericHandler, InvocationModel invocationModel)
        {
            /*
             * Qui abbiamo un problema di questo tipo: quando in Castle viene
             * registrato un componente per più di un servizio, ergo per più
             * interfacce vogliamo venga risolto lo stesso tipo, abbiamo l'inghippo
             * che Castle registra n componenti che risolvono verso lo stesso tipo
             * tante quante sono le interfacce. Quindi l'evento qui registrato viene
             * scatenato n volte e siccome il primo test che noi facciamo è verificare
             * che il servizio sia IMessageHandler se un componente gestisce n messaggi
             * arriviamo qui n volte. Se il componente inoltre richiede la Subscribe
             * automatica per quei messaggi, ha quindi più di un SubscribeToMessageAttribute
             * dobbiamo assicurarci che la subscribe venga fatta una ed una sola volta.
             * per ogni tipo di messaggio.
             */
            var broker      = container.Resolve <IMessageBroker>();
            var messageType = genericHandler.GetGenericArguments().Single();

            if (genericHandler.Is <IHandleMessage>())
            {
                broker.Subscribe(this, messageType, invocationModel, (s, msg) =>
                {
                    var handler = container.Resolve(key, entry.Services.First()) as IHandleMessage;

                    if (handler.ShouldHandle(s, msg))
                    {
                        handler.Handle(s, msg);
                    }
                });
            }
        }
        void Subscribe(IMessageBroker broker, String key, IHandler h, Type genericHandler, InvocationModel invocationModel)
        {
            /*
             * Qui abbiamo un problema di questo tipo: quando in Castle viene
             * registrato un componente per più di un servizio, ergo per più
             * interfacce vogliamo venga risolto lo stesso tipo, abbiamo l'inghippo
             * che Castle registra n componenti che risolvono verso lo stesso tipo
             * tante quante sono le interfacce. Quindi l'evento qui registrato viene
             * scatenato n volte e siccome il primo test che noi facciamo è verificare
             * che il servizio sia IMessageHandler se un componente gestisce n messaggi
             * arriviamo qui n volte. Se il componente inoltre richiede la Subscribe
             * automatica per quei messaggi, ha quindi più di un SubscribeToMessageAttribute
             * dobbiamo assicurarci che la subscribe venga fatta una ed una sola volta.
             * per ogni tipo di messaggio.
             */
            var messageType = genericHandler.GetGenericArguments().Single(); // attribute.MessageType;

            logger.Debug
            (
                "\tSubscribing to message: {0}",
                messageType.ToString("SN")
            );

            if (genericHandler.Is <IMessageHandler>())
            {
                broker.Subscribe(this, messageType, invocationModel, msg =>
                {
                    if (this.Kernel != null)
                    {
                        var handler = this.Kernel.Resolve(key, h.ComponentModel.Services.First()) as IMessageHandler;
                        if (handler != null)
                        {
                            logger.Debug
                            (
                                "Dispatching message {0} to IMessageHandler {1}",
                                msg.GetType().ToString("SN"),
                                handler.GetType().ToString("SN")
                            );

                            if (handler.ShouldHandle(msg))
                            {
                                handler.Handle(msg);
                            }
                        }
                        else
                        {
                            logger.Debug
                            (
                                "IMessageHandler for {0} is null.",
                                msg.GetType().ToString("SN")
                            );
                        }
                    }
                    else
                    {
                        logger.Debug("Kernel is null.");
                        logger.Debug("Kernel is null.");
                    }
                });
            }
            else if (genericHandler.Is <IHandleMessage>())
            {
                broker.Subscribe(this, messageType, invocationModel, (s, msg) =>
                {
                    if (this.Kernel != null)
                    {
                        var handler = this.Kernel.Resolve(key, h.ComponentModel.Services.First()) as IHandleMessage;
                        if (handler != null)
                        {
                            logger.Debug
                            (
                                "Dispatching message {0} to IHandleMessage {1}",
                                msg.GetType().ToString("SN"),
                                handler.GetType().ToString("SN")
                            );

                            if (handler.ShouldHandle(s, msg))
                            {
                                handler.Handle(s, msg);
                            }
                        }
                        else
                        {
                            logger.Debug
                            (
                                "IHandleMessage for {0} is null.",
                                msg.GetType().ToString("SN")
                            );
                        }
                    }
                    else
                    {
                        logger.Debug("Kernel is null.");
                    }
                });
            }
        }
		void Subscribe( IMessageBroker broker, String key, RegisterEventArgs h, Type genericHandler, InvocationModel invocationModel )
		{
			var messageType = genericHandler.GetGenericArguments().Single();

			logger.Debug
			(
				"\tSubscribing to message: {0}",
				messageType.ToString( "SN" )
			);

			if ( genericHandler.Is<IMessageHandler>() )
			{
				broker.Subscribe( this, messageType, invocationModel, msg =>
				{
					if ( this.Container != null )
					{
						var handler = this.Container.Resolve( h.TypeFrom, key ) as IMessageHandler;
						if ( handler != null )
						{
							logger.Debug
							(
								"Dispatching message {0} to IMessageHandler {1}",
									msg.GetType().ToString( "SN" ),
									handler.GetType().ToString( "SN" )
							);

							if ( handler.ShouldHandle( msg ) )
							{
								handler.Handle( msg );
							}
						}
						else
						{
							logger.Debug
							(
								"IMessageHandler for {0} is null.",
								msg.GetType().ToString( "SN" )
							);
						}
					}
					else
					{
						logger.Debug( "Kernel is null." );
						logger.Debug( "Kernel is null." );
					}
				} );
			}
			else if ( genericHandler.Is<IHandleMessage>() )
			{
				broker.Subscribe( this, messageType, invocationModel, ( s, msg ) =>
				{
					if ( this.Container != null )
					{
						var handler = this.Container.Resolve( h.TypeFrom, key ) as IHandleMessage;
						if ( handler != null )
						{
							logger.Debug
							(
								"Dispatching message {0} to IHandleMessage {1}",
									msg.GetType().ToString( "SN" ),
									handler.GetType().ToString( "SN" )
							);

							if ( handler.ShouldHandle( s, msg ) )
							{
								handler.Handle( s, msg );
							}
						}
						else
						{
							logger.Debug
							(
								"IHandleMessage for {0} is null.",
								msg.GetType().ToString( "SN" )
							);
						}
					}
					else
					{
						logger.Debug( "Kernel is null." );
					}
				} );
			}
		}
		void Subscribe( IContainer container, IMessageBroker broker, Guid key, Bag bag, Type genericHandler, InvocationModel invocationModel )
		{
			var messageType = genericHandler.GetGenericArguments().Single();

			logger.Debug
			(
				"\tSubscribing to message: {0}",
				messageType.ToString( "SN" )
			);

			if ( genericHandler.Is<IMessageHandler>() )
			{
				broker.Subscribe( this, messageType, invocationModel, msg =>
				{
					var handler = container.Resolve( bag.Services.FirstOrDefault() ) as IMessageHandler;
					if ( handler != null )
					{
						logger.Debug
						(
							"Dispatching message {0} to IMessageHandler {1}",
								msg.GetType().ToString( "SN" ),
								handler.GetType().ToString( "SN" )
						);

						if ( handler.ShouldHandle( msg ) )
						{
							handler.Handle( msg );
						}
					}
					else
					{
						logger.Debug
						(
							"IMessageHandler for {0} is null.",
							msg.GetType().ToString( "SN" )
						);
					}
				} );
			}
			else if ( genericHandler.Is<IHandleMessage>() )
			{
				broker.Subscribe( this, messageType, invocationModel, ( s, msg ) =>
				{
					var handler = container.Resolve( bag.Services.FirstOrDefault() ) as IHandleMessage;
					if ( handler != null )
					{
						logger.Debug
						(
							"Dispatching message {0} to IHandleMessage {1}",
								msg.GetType().ToString( "SN" ),
								handler.GetType().ToString( "SN" )
						);

						if ( handler.ShouldHandle( s, msg ) )
						{
							handler.Handle( s, msg );
						}
					}
					else
					{
						logger.Debug
						(
							"IHandleMessage for {0} is null.",
							msg.GetType().ToString( "SN" )
						);
					}
				} );
			}
		}
예제 #20
0
 static System.Threading.Tasks.Task InvokeCoreAsync(IDispatcher dispatcher, Func <Object, T, System.Threading.Tasks.Task> action, Object sender, T message, InvocationModel type)
 {
     return(action(sender, message));
 }
예제 #21
0
        public PocoSubscription(Object subscriber, Object sender, Action <Object, Object> action, Func <Object, Object, bool> actionFilter, InvocationModel invocationModel, IDispatcher dispatcher)
        {
            Ensure.That(subscriber).Named(() => subscriber).IsNotNull();
            Ensure.That(sender).Named(() => sender).IsNotNull();
            Ensure.That(action).Named(() => action).IsNotNull();
            Ensure.That(actionFilter).Named(() => actionFilter).IsNotNull();
            Ensure.That(dispatcher).Named(() => dispatcher).IsNotNull();

            this.Subscriber      = subscriber;
            this.action          = action;
            this.actionFilter    = actionFilter;
            this.Sender          = sender;
            this.InvocationModel = invocationModel;
            this.dispatcher      = dispatcher;

            this.Priority = SubscriptionPriority.Normal;
        }
예제 #22
0
 /// <summary>
 /// Waits for the specified message type and raise the Changed event whenever the
 /// specified message is dispatched or broadcasted.
 /// </summary>
 /// <typeparam name="TMessage">The type of the message.</typeparam>
 /// <param name="invocationModel">The invocation model.</param>
 /// <returns>This monitor instance.</returns>
 public MessageBrokerMonitor WaitingFor <TMessage>(InvocationModel invocationModel) where TMessage : class
 {
     return(this.WaitingFor <TMessage>(m => true, invocationModel));
 }