Exemple #1
0
        public RestService(INancyBootstrapper bootstrapper, IServiceConfig config, ILogger logger, ShortlistQueryRepository shortlistQueryRepository)
        {
            if (bootstrapper == null) { throw new ArgumentNullException(nameof(bootstrapper)); }
            if (config == null) { throw new ArgumentNullException(nameof(config)); }
            if (logger == null) { throw new ArgumentNullException(nameof(logger)); }
            if (shortlistQueryRepository == null) { throw new ArgumentNullException(nameof(shortlistQueryRepository)); }

            _shortlistQueryRepository = shortlistQueryRepository;
            var nancyConfig = new HostConfiguration();
            nancyConfig.UrlReservations.CreateAutomatically = true;

            _nancyService = new NancyHost(bootstrapper, nancyConfig, new Uri(config.RestUrl));
            nancyConfig.UnhandledExceptionCallback = (exception) =>
            {
                var message = String.Format("Uncaught exception: {0}", exception.Message);
                logger.WriteError(message);
            };
            if (config.QueueConsumer)
            {
                SetupEventQueueListener(config, logger);
            }
        }
Exemple #2
0
 public QueryFacade(ShortlistQueryRepository shortlistQueryRepository)
 {
     _shortlistQueryRepository = shortlistQueryRepository;
 }