Ejemplo n.º 1
0
        public void HandleMessage(MessageContext context)
        {
            try
            {
                Action <MessageContext> value;
                if (_actionDispatch.TryGetValue(context.Message.GetType(), out value) == false)
                {
                    throw new InvalidOperationException("Can't find handler for " + context.Message.GetType());
                }

                value(context);

                Engine.OnEventsProcessed();
            }
            catch (Exception e)
            {
                context.Error(e);
            }
            finally
            {
                if (context.AsyncResponse == false)
                {
                    context.Done();
                }
            }
        }
Ejemplo n.º 2
0
		public void HandleMessage(MessageContext context)
		{
			try
			{
			    Action<MessageContext> value;
			    if(_actionDispatch.TryGetValue(context.Message.GetType(), out value) == false)
                       throw new InvalidOperationException("Can't find handler for " + context.Message.GetType());

                value(context);

				Engine.OnEventsProcessed();
			}
			catch (Exception e)
			{
				context.Error(e);
			}
			finally
			{
				if (context.AsyncResponse == false)
					context.Done();
			}
		}