public void StartInitialization()
        {
            ILoggerFactory connectionLoggerFactory = LoggerFactory.Create("");
            IRmqLogger     connectionLogger        = connectionLoggerFactory.CreateLogger(nameof(ConnectionWrapper));

            connection = new ConnectionWrapper(config, connectionLogger);

            IModel rpcCh = connection.CreateChannel();


            rpcChannelPool = channelPoolFactory.CreateChannelPool(rpcCh);

            IConsumerBinder  rpcConsumerBinder  = new RpcConsumerBinder();
            IConsumerFactory rpcConsumerFactory = new ConsumerFactory(
                rpcChannelPool.GetChannelWrapper(),
                rpcConsumerBinder);

            ILoggerFactory loggerFactory = LoggerFactory.Create(ConsumerType.Rpc.ToString());
            IRmqLogger     managerLogger = loggerFactory.CreateLogger(nameof(ConsumerManager));

            IConsumerManager rpcConsumerManager = new ConsumerManager(
                rpcConsumerFactory,
                managerLogger);

            rpcConsumerManager.InitConsumer();


            IMainConsumerEventHandlerFactory rpcMainEventHandlerFactory
                = ConsumerEventHandlersFactory.Create(rpcConsumerManager, loggerFactory);

            IConsumerMainEventHandlers rpcConsumerMainEventHandler
                = rpcMainEventHandlerFactory.CreateMainHandler();



            IRmqLogger connectionHandlerLogger = loggerFactory.CreateLogger(nameof(ConnectionEventHandlers));
            IConnectionEventsHandlerFactory connectionEventsHandlerFactory
                = ConnectionEventsHandlerFactory.Create(connectionHandlerLogger, connection);
            IConnectionEventHandlers connectionEventHandler = connectionEventsHandlerFactory.CreateHandler();


            IRmqLogger channelGuardLogger = loggerFactory.CreateLogger(nameof(ChannelGuardService));

            this.channelGuardService
                = new ChannelGuardService(
                      rpcChannelPool,                   // <--- TODO только rpc?
                      channelGuardLogger,
                      connectionEventHandler,
                      rpcConsumerMainEventHandler);

            // Подписка на ответы запросов rpc
            responseMessageHandler = responseMessageHandlerFactory.GetHandler();
            rpcConsumerMainEventHandler.AddReceiveHandler(responseMessageHandler.HandleMessage);
        }
        public IChannelPool CreateSubscriptionChannelPool(ushort prefechCount)
        {
            if (subsCh is null)
            {
                subsCh = connection.CreateChannel();
                subsCh.BasicQos(0, prefechCount, false);
                subsCh.QueueDeclare(
                    config.Queue,
                    durable: true,
                    exclusive: false,
                    autoDelete: false,
                    arguments: new Dictionary <string, object> {
                    ["x-dead-letter-exchange"]    = "",
                    ["x-dead-letter-routing-key"] = "_q_dead"
                });
            }


            IChannelPool pool = channelPoolFactory.CreateChannelPool(subsCh);

            subscriptionWrapChannel = pool.GetChannelWrapper();
            return(pool);
        }
 public IChannelWrapper GetRpcChannel()
 {
     return(rpcChannelPool.GetChannelWrapper());
 }