public override void OnException(ExceptionContext context)
        {
            ApiError apiError = null;

            // Handle Errors thru the chain
            ErrorHandler apiErrorHanler           = new ApiErrorHandler();
            ErrorHandler unauthorizedErrorHandler = new UnauthorizedErrorHandler();
            ErrorHandler unhandledErrorHandler    = new UnhandledErrorHandler();

            // Set Handlers
            apiErrorHanler.SetNextHandler(unauthorizedErrorHandler);
            unauthorizedErrorHandler.SetNextHandler(unhandledErrorHandler);

            // Hanle
            apiErrorHanler.Handle(context, apiError);

            base.OnException(context);
        }
Example #2
0
        public static IObservableConnection Create(IConnectionConfig config)
        {
            var connectionFactory = new ConnectionFactory
            {
                HostName    = config.HostName,
                Password    = config.Password,
                UserName    = config.UserName,
                VirtualHost = config.VirtualHost
            };
            var publisher      = new RabbitMqPublisher(connectionFactory);
            var errorPublisher = new RabbitMqPublisher(connectionFactory);
            var errorHandler   = new UnhandledErrorHandler(errorPublisher, config.Serializer);
            var logger         = config.Logger;
            var subscriber     = new RabbitMqSubscriber(connectionFactory, errorHandler, logger);
            var listener       = new ConnectionEntryPoint(connectionFactory, subscriber);

            return(listener);
        }