private void LoadResponseMessagesHandlers() { ResponseMessagesHandlers handlers = (ResponseMessagesHandlers)ConfigurationManager.GetSection("ResponseMessagesHandlers"); if (handlers == null || handlers.ResponseMessagesHandlersList.Count == 0) { throw new ArgumentNullException("Messages Handlers Not Found"); } m_responseHandlers = new List <IResponseMessageHandler <QuickFix.Message> >(); int count = 1; foreach (ResponseMessageHandler handler in handlers.ResponseMessagesHandlersList) { Type handlerTyp = Type.GetType(handler.Type, true, true); if (typeof(IResponseMessageHandler <QuickFix.Message>).IsAssignableFrom(handlerTyp)) { IResponseMessageHandler <QuickFix.Message> newHandlerInstance = (IResponseMessageHandler <QuickFix.Message>)Activator.CreateInstance(handlerTyp); m_responseHandlers.Add(newHandlerInstance); newHandlerInstance.Initialize(handler.MsgTypeValue); } else { throw new Exception("Handler Not Defined"); } count++; } }
public PublisherFactory(IConnectionManager connectionManager, RmqConfig rmqConfig, IRmqLogger logger) { IChannelWrapper channel = connectionManager.GetRpcChannel(); IResponseMessageHandler replyHandler = connectionManager.GetResponseMessageHandler(); basicPublisher = new BasicPublisher(channel, replyHandler, rmqConfig, logger); }
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 void Response <TRequest, TResponse>(IResponseMessageHandler obj) where TRequest : class where TResponse : class { throw new NotImplementedException(); }
public ResponseMessageHandlerFactory(IRmqLogger logger) { responseMessageHandler = new ResponseMessageHandler(logger); }