• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IMessageHandler类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IMessageHandler的典型用法代码示例。如果您正苦于以下问题:C# IMessageHandler类的具体用法?C# IMessageHandler怎么用?C# IMessageHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IMessageHandler类属于命名空间,在下文中一共展示了IMessageHandler类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: HandlerMapping

        public HandlerMapping(string version, string command, IMessageHandler handler)
        {
            if (version == null)
            {
                throw new ArgumentNullException("version");
            }

            if (command == null)
            {
                throw new ArgumentNullException("command");
            }

            if (handler == null)
            {
                throw new ArgumentNullException("handler");
            }

            _catchAll = version == "*";
            _version = _catchAll ? 
            	new string[0] : 
            	#if CF
            	version.Split(new[] { ',' })
            	#else
            	version.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
            	#endif
            	;
            _command = command;
            _handler = handler;
        }
开发者ID:bleissem,项目名称:sharpsnmplib,代码行数:29,代码来源:HandlerMapping.cs


示例2: PriorityBurrowConsumer

        public PriorityBurrowConsumer(IModel channel, IMessageHandler messageHandler, IRabbitWatcher watcher, bool autoAck, int batchSize)
            : base(channel)
        {
            if (channel == null)
            {
                throw new ArgumentNullException("channel");
            }
            if (messageHandler == null)
            {
                throw new ArgumentNullException("messageHandler");
            }
            if (watcher == null)
            {
                throw new ArgumentNullException("watcher");
            }

            if (batchSize < 1)
            {
                throw new ArgumentException("batchSize must be greater than or equal 1", "batchSize");
            }

            Model.ModelShutdown += WhenChannelShutdown;
            Model.BasicRecoverAsync(true);

            _messageHandler = messageHandler;
            _messageHandler.HandlingComplete += MessageHandlerHandlingComplete;
            _watcher = watcher;
            _autoAck = autoAck;
            _batchSize = batchSize;
        }
开发者ID:joefeser,项目名称:Burrow.NET,代码行数:30,代码来源:PriorityBurrowConsumer.cs


示例3: RegisterHandler

        public static void RegisterHandler(Type type, IMessageHandler handlerObject)
        {
            lock (syncObj)
            {
                if (handlers.ContainsKey(type))
                {
                    //Console.WriteLine("Type found - checking handlers list");
                    LinkedList<IMessageHandler> typeHandlers = handlers[type];
                    if (typeHandlers == null) // для этого типа раньше не регистрировались подписчики
                    {
                        typeHandlers = new LinkedList<IMessageHandler>();
                    }

                    // WARNING: linear search
                    if (!typeHandlers.Contains(handlerObject)) // для этого типа и этого объекта не назначен этот же объект-обработчик
                        typeHandlers.AddLast(handlerObject);
                }
                else
                {
                    //Console.WriteLine("Type not found - creating handlers list");
                    handlers.Add(type, new LinkedList<IMessageHandler>());
                    handlers[type].AddLast(handlerObject);
                }
            }
        }
开发者ID:Skybladev2,项目名称:Sea-battles,代码行数:25,代码来源:MessageDispatcher.cs


示例4: UserRtsController

        /// <summary>
        /// Creates this controller
        /// </summary>
        /// <param name="user">Command user that this controller listens to</param>
        /// <param name="actionTarget">Entity actions are sent to this object</param>
        public UserRtsController( CommandUser user, IMessageHandler actionTarget )
        {
            m_Target = actionTarget;

            CommandList entityCommandList = CommandListManager.Instance.FindOrCreateFromEnum( typeof( EntityCommands ) );
            user.AddActiveListener( entityCommandList, OnCommandActive );
        }
开发者ID:johann-gambolputty,项目名称:robotbastards,代码行数:12,代码来源:UserRtsController.cs


示例5: Invoke

        public override void Invoke(Type msgType, IMessage message, IMessageHandler handler)
        {
            // PERF: cache or create compiled Lambda to invoke this
            var method = handler.GetType().GetMethod("Handle", new[] { msgType });

            method.Invoke(handler, new object[] { message });
        }
开发者ID:zhoufoxcn,项目名称:Castle.RabbitMq,代码行数:7,代码来源:DefaultMessageHandlerInvoker.cs


示例6: NotificationConsumer

        public NotificationConsumer(IMessageHandler messageHandler, IChannelWrapper channelWrapper)
        {
            _messageHandler = messageHandler;
            _channelWrapper = channelWrapper;

            Listen();
        }
开发者ID:cybyvlad,项目名称:Threadtail,代码行数:7,代码来源:NotificationConsumer.cs


示例7: BlockUserTask

 public BlockUserTask(IMessageHandler consumeHandler, IMessageHandler publishHandler, string publishRoutingKey, IFeedBackDataManager feedBackManager, IAccountManager accountManager, IBlackListDataManager blackListDataManager)
     : base(consumeHandler, publishHandler, publishRoutingKey)
 {
     _feedBackManager = feedBackManager;
     _accountManager = accountManager;
     _blackListDataManager = blackListDataManager;
 }
开发者ID:TokleMahesh,项目名称:BG,代码行数:7,代码来源:BlockUserTask.cs


示例8: PollingConsumer

 public PollingConsumer(IPollableChannel inputChannel, IMessageHandler handler)
 {
     AssertUtils.ArgumentNotNull(inputChannel, "inputChannel");
     AssertUtils.ArgumentNotNull(handler, "handler");
     _inputChannel = inputChannel;
     _handler = handler;
 }
开发者ID:rlxrlxrlx,项目名称:spring-net-integration,代码行数:7,代码来源:PollingConsumer.cs


示例9: MessageClient

 public MessageClient(IFramedClient framedClient, 
                      IStacksSerializer packetSerializer,
                      IMessageHandler messageHandler)
     : this(new MessageIdCache(),
            framedClient, packetSerializer, messageHandler)
 {
 }
开发者ID:wushian,项目名称:Stacks,代码行数:7,代码来源:MessageClient.cs


示例10: Eve

 public Eve(IMessageHandler messager)
 {
     pMessager = messager;
     pTimeOut.AutoReset = false;
     pTimeOut.Interval = pCommonTimeout;
     pTimeOut.Elapsed += PTimeOutElapsed;
 }
开发者ID:antgraf,项目名称:BaEveCourier,代码行数:7,代码来源:Eve.Public.cs


示例11: PipedRoute

 public PipedRoute(IMessageHandler handler, MethodInfo endpoint, string commandName, string[] parameterNames)
 {
     _commandName = commandName;
     _parameterNames = parameterNames;
     Handler = handler;
     EndPoint = endpoint;
 }
开发者ID:rjt011000,项目名称:NBot,代码行数:7,代码来源:PipedRoute.cs


示例12: RedisMessageHandlerWorker

 public RedisMessageHandlerWorker(
     IRedisClientsManager clientsManager, IMessageHandler messageHandler, string queueName,
     Action<IMessageHandlerBackgroundWorker, Exception> errorHandler)
     : base(messageHandler, queueName, errorHandler)
 {
     this.clientsManager = clientsManager;
 }
开发者ID:adam-26,项目名称:ServiceStack.Redis,代码行数:7,代码来源:RedisMessageHandlerWorker.cs


示例13: EventDrivenConsumer

 public EventDrivenConsumer(ISubscribableChannel inputChannel, IMessageHandler handler)
 {
     AssertUtils.ArgumentNotNull(inputChannel, "inputChannel must not be null");
     AssertUtils.ArgumentNotNull(handler, "handler must not be null");
     _inputChannel = inputChannel;
     _handler = handler;
 }
开发者ID:rlxrlxrlx,项目名称:spring-net-integration,代码行数:7,代码来源:EventDrivenConsumer.cs


示例14: Initialize

        //        1. List<pos + DateTime (class)> // högre och högre tid på olika pos
        //        2. bild i ps, rita cirklar dra streck mellan dom..
        //        3. bygga på med vinklar (sist, till att börja med kör vi med position)
        public override void Initialize(GameContext context)
        {
            base.Initialize(context);

            snapShots = new List<Snapshot>();
            snapShots.Add(new Snapshot(TimeSpan.FromSeconds(0), new Vector2(487.0f, 585.0f)));
            snapShots.Add(new Snapshot(TimeSpan.FromSeconds(3), new Vector2(510.0f, 200.0f)));
            snapShots.Add(new Snapshot(TimeSpan.FromSeconds(7), new Vector2(775.0f, 326.0f)));
            snapShots.Add(new Snapshot(TimeSpan.FromSeconds(10), new Vector2(1142.0f, 103.0f)));

            this.spriteBatch = spriteBatch ?? new SpriteBatch(Context.Graphics.Device);

            time = "";
            interpolate = new Vector2();

            gameServer = ServiceLocator.Get<IGameServer>();
            gameClient = ServiceLocator.Get<IGameClient>();
            messageHandler = ServiceLocator.Get<IMessageHandler>();

            // Create the connection between the client and server
            gameServer.Start();
            gameClient.Connect();

            //sendTimer = new GameTimer(TimeSpan.FromMilliseconds(1000 / 20), SendClientSpatial);

            Context.Input.Keyboard.ClearMappings();
            Context.Input.Keyboard.AddMapping(Keys.F1);
            Context.Input.Keyboard.AddMapping(Keys.F2);
            Context.Input.Keyboard.AddMapping(Keys.F3);
        }
开发者ID:JohanGl,项目名称:Outworld-XNA,代码行数:33,代码来源:NetworkScene.cs


示例15: MessageItemProcessor

 protected MessageItemProcessor(IMessageHandler consumeHandler, IMessageHandler publishHandler,
                                string publishRoutingKey)
 {
     ConsumeHandler = consumeHandler;
     PublishHandler = publishHandler;
     IsActive = true;
     PublishRoutingKey = publishRoutingKey;
 }
开发者ID:TokleMahesh,项目名称:BG,代码行数:8,代码来源:MessageItemProcessor.cs


示例16: MessageProcessingContext

        /// <summary>
        /// Initializes a new instance of the <see cref="MessageProcessingContext"/> class.
        /// </summary>
        /// <param name="message">The Message.</param>
        /// <param name="handler">The handler.</param>
        public MessageProcessingContext(IMessage message, IMessageHandler handler)
        {
            Contract.Requires(message != null);
            Contract.Requires(handler != null);

            this.Message = message;
            this.Handler = handler;
        }
开发者ID:raimu,项目名称:kephas,代码行数:13,代码来源:MessageProcessingContext.cs


示例17: BurrowConsumer

 /// <summary>
 /// Initialize an object of <see cref="BurrowConsumer"/>
 /// </summary>
 /// <param name="channel">RabbitMQ.Client channel</param>
 /// <param name="messageHandler">An instance of message handler to handle the message from queue</param>
 /// <param name="watcher"></param>
 /// <param name="autoAck">If set to true, the msg will be acked after processed</param>
 /// <param name="batchSize"></param>
 public BurrowConsumer(IModel channel,
                       IMessageHandler messageHandler,
                       IRabbitWatcher watcher,
                       bool autoAck,
                       int batchSize) : this(channel, messageHandler, watcher, autoAck, batchSize, true)
 {
     // This is the public constructor to start the consuming thread straight away
 }
开发者ID:kangkot,项目名称:Burrow.NET,代码行数:16,代码来源:BurrowConsumer.cs


示例18: MessageHandlerDecorator

 /// <summary>
 /// Initializes a new instance of the <see cref="QueueCreationDecorator" /> class.
 /// </summary>
 /// <param name="metrics">The metrics factory.</param>
 /// <param name="handler">The handler.</param>
 /// <param name="connectionInformation">The connection information.</param>
 public MessageHandlerDecorator(IMetrics metrics,
     IMessageHandler handler,
     IConnectionInformation connectionInformation)
 {
     var name = handler.GetType().Name;
     _runCodeTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.HandleTimer", Units.Calls);
     _handler = handler;
 }
开发者ID:blehnen,项目名称:DotNetWorkQueue,代码行数:14,代码来源:IMessageHandlerDecorator.cs


示例19: MessageHandlerWorker

 public MessageHandlerWorker(
     IRedisClientsManager clientsManager, IMessageHandler messageHandler, string queueName,
     Action<MessageHandlerWorker, Exception> errorHandler)
 {
     this.clientsManager = clientsManager;
     this.messageHandler = messageHandler;
     this.QueueName = queueName;
     this.errorHandler = errorHandler;
 }
开发者ID:AVee,项目名称:ServiceStack,代码行数:9,代码来源:MessageHandlerWorker.cs


示例20: HandlingRule

 /// <summary>
 /// Initializes a new <see cref="HandlingRule"/> with the supplied message
 /// <paramref name="specification"/>, <see cref="MessageHandler"/>, and
 /// <paramref name="queueName"/>.
 /// </summary>
 /// <param name="specification">The message specification that selects messages 
 /// to which the handling rule applies</param>
 /// <param name="messageHandler">The handler to which messages matching the
 /// specification will be routed</param>
 /// <param name="queueName">(Optional) The name of the queue in which matching
 /// messages will be placed while they await handling</param>
 /// <remarks>
 /// If the <paramref name="queueName"/> is ommitted, a default queue name will
 /// be generated based on the MD5 hash of the full type name of the supplied
 /// <paramref name="messageHandler"/>
 /// </remarks>
 /// <seealso cref="GenerateQueueName"/>
 public HandlingRule(IMessageSpecification specification, IMessageHandler messageHandler,
     QueueName queueName = null)
 {
     if (specification == null) throw new ArgumentNullException("specification");
     if (messageHandler == null) throw new ArgumentNullException("messageHandler");
     _specification = specification;
     _messageHandler = messageHandler;
     _queueName = queueName ?? GenerateQueueName(messageHandler);
 }
开发者ID:tdbrian,项目名称:Platibus,代码行数:26,代码来源:HandlingRule.cs



注:本文中的IMessageHandler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IMessageLogger类代码示例发布时间:2022-05-24
下一篇:
C# IMessageFactory类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap