public KafkaConsumerProcessorTest()
        {
            _topicPartition = new TopicPartition("topic-a", 0);

            var consumerSettings = new ConsumerSettings
            {
                MessageType  = typeof(SomeMessage),
                Topic        = _topicPartition.Topic,
                ConsumerType = typeof(SomeMessageConsumer),
                ConsumerMode = ConsumerMode.Consumer
            };

            consumerSettings.SetGroup("group-a");

            var massageBusMock = new MessageBusMock();

            massageBusMock.BusSettings.Consumers.Add(consumerSettings);
            massageBusMock.DependencyResolverMock.Setup(x => x.Resolve(typeof(SomeMessageConsumer))).Returns(_consumer);

            byte[] MessageValueProvider(Message m) => m.Value;

            var consumerInstancePoolMock = new Mock <ConsumerInstancePoolMessageProcessor <Message> >(consumerSettings, massageBusMock.Bus, (Func <Message, byte[]>)MessageValueProvider, null);

            _messageQueueWorkerMock = new Mock <MessageQueueWorker <Message> >(consumerInstancePoolMock.Object, _checkpointTrigger.Object);
            _subject = new KafkaConsumerProcessor(consumerSettings, _topicPartition, _commitControllerMock.Object, massageBusMock.Bus, _messageQueueWorkerMock.Object);
        }
예제 #2
0
        public KafkaResponseProcessorTest()
        {
            _topicPartition = new TopicPartition("topic-a", 0);

            _mssageBusMock = new MessageBusMock();
            _mssageBusMock.BusSettings.RequestResponse = new RequestResponseSettings
            {
                Topic = "topic-a"
            };

            _subject = new KafkaResponseProcessor(_mssageBusMock.BusSettings.RequestResponse, _topicPartition, _commitControllerMock.Object, _mssageBusMock.Object, _checkpointTrigger.Object);
        }
예제 #3
0
        public KafkaConsumerProcessorTest()
        {
            _loggerFactory = NullLoggerFactory.Instance;

            _topicPartition = new TopicPartition("topic-a", 0);

            var consumerSettings = new ConsumerSettings
            {
                MessageType  = typeof(SomeMessage),
                Topic        = _topicPartition.Topic,
                ConsumerType = typeof(SomeMessageConsumer),
                ConsumerMode = ConsumerMode.Consumer,
            };

            consumerSettings.SetGroup("group-a");

            var massageBusMock = new MessageBusMock();

            massageBusMock.BusSettings.Consumers.Add(consumerSettings);
            massageBusMock.DependencyResolverMock.Setup(x => x.Resolve(typeof(SomeMessageConsumer))).Returns(_consumer);
            massageBusMock.DependencyResolverMock.Setup(x => x.Resolve(typeof(ILoggerFactory))).Returns(_loggerFactory);
예제 #4
0
        public KafkaResponseProcessorTest()
        {
            _topicPartition = new TopicPartition("topic-a", 0);

            var requestResponseSettings = new RequestResponseSettings
            {
                Topic = "topic-a"
            };

            requestResponseSettings.SetGroup("group-a");

            _messageBusMock = new MessageBusMock
            {
                BusSettings =
                {
                    RequestResponse = requestResponseSettings
                }
            };

            _subject = new KafkaResponseProcessor(_messageBusMock.BusSettings.RequestResponse, _topicPartition, _commitControllerMock.Object, _messageBusMock.Bus, _checkpointTrigger.Object);
        }
        public KafkaConsumerProcessorTest()
        {
            _topicPartition = new TopicPartition("topic-a", 0);

            _consumerSettings = new ConsumerSettings()
            {
                MessageType  = typeof(SomeMessage),
                Topic        = _topicPartition.Topic,
                ConsumerType = typeof(SomeMessageConsumer),
                ConsumerMode = ConsumerMode.Subscriber,
            };

            _mssageBusMock = new MessageBusMock();
            _mssageBusMock.BusSettings.Consumers.Add(_consumerSettings);
            _mssageBusMock.DependencyResolverMock.Setup(x => x.Resolve(typeof(SomeMessageConsumer))).Returns(_consumer);

            Func <Message, byte[]> messageValueProvider = m => m.Value;

            consumerInstancePoolMock = new Mock <ConsumerInstancePool <Message> >(_consumerSettings, _mssageBusMock.Object, messageValueProvider, null);
            _messageQueueWorkerMock  = new Mock <MessageQueueWorker <Message> >(consumerInstancePoolMock.Object, _checkpointTrigger.Object);
            _subject = new KafkaConsumerProcessor(_consumerSettings, _topicPartition, _commitControllerMock.Object, _mssageBusMock.Object, _messageQueueWorkerMock.Object);
        }