public static void Add <TContainer, TMessage>(
     this IRoutingTable table,
     Func <TContainer, IMessageHandler <TMessage> > callback,
     int sequence     = int.MaxValue,
     Type handlerType = null)
     where TContainer : class
 {
     table.Add(x => callback(x.CurrentResolver.As <TContainer>()), sequence, handlerType);
 }
示例#2
0
		public virtual IMessagingHost StartWithReceive(IRoutingTable table, Func<IHandlerContext, IMessageHandler<ChannelMessage>> handler = null)
		{
			Log.Info("Starting host in full-duplex mode.");

			table.Add(handler ?? (context => new DefaultChannelMessageHandler(context, table)));

			var host = this.StartHost();
			host.BeginReceive(this.BuildDeliveryChain(table).Handle);
			return host;
		}
示例#3
0
        public virtual IMessagingHost StartWithReceive(IRoutingTable table, Func <IHandlerContext, IMessageHandler <ChannelMessage> > handler = null)
        {
            Log.Info("Starting host in full-duplex mode.");

            table.Add(handler ?? (context => new DefaultChannelMessageHandler(context, table)), 0, typeof(DefaultChannelMessageHandler));

            var host = this.StartHost();

            host.BeginReceive(this.BuildDeliveryChain(table).Handle);
            return(host);
        }