Example #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();
                }
            }
        }
		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();
			}
		}