internal IChannelReceiver CreateQueueReader(Type messageType, Type subscriptionType, Type processorInterface, Type settingsType, Type processor) { var messageProcessorType = typeof(MessageProcessor <>).MakeGenericType(processorInterface); var processorInstance = (IMessageProcessor)Activator.CreateInstance(messageProcessorType, _configuration.MessageProcessorProvider); var queueReader = _transportChannelFactories.SingleOrDefault(factory => factory.CanCreate(messageType)); if (queueReader == null) { throw new TransportMissingException(messageType); } var pipeline = new MiddlewarePipeline(_configuration.Middlewares, queueReader, _configuration.Log); var starter = queueReader.Create(messageType, subscriptionType, settingsType, _configuration, pipeline.GetPipeline(processorInstance)); return(GetQueueReaderStarter(starter, processor)); }
internal IChannelReceiver CreateChannelReceiver(Type messageType, Type subscriptionType, Type processorInterface, Type settingsType, Type processor) { var processorInstance = new MessageProcessor(processorInterface); var channelFactory = _transportChannelFactories.SingleOrDefault(factory => factory.CanCreate(messageType)); if (channelFactory == null) { throw new TransportMissingException(messageType); } var processingSettings = (IProcessingSettings)Activator.CreateInstance(settingsType); var eventSubscription = subscriptionType == null ? null : (IEventSubscription)Activator.CreateInstance(subscriptionType); var pipelineInformation = new PipelineInformation(processorInterface, eventSubscription, processingSettings, _configuration); var pipeline = new MiddlewarePipeline(_configuration.Middlewares, pipelineInformation, channelFactory, _configuration.Log); var serializer = GetSerializer(channelFactory, messageType); var starter = channelFactory.Create(messageType, eventSubscription, processingSettings, serializer, _configuration, pipeline.GetPipeline(processorInstance)); return(WrapSingletonReceiver(starter, processor)); }