示例#1
0
        public static void SerializingProducer_ProduceAsync_Null_DeliveryHandler(string bootstrapServers, string topic, string partitionedTopic)
        {
            var producerConfig = new Dictionary <string, object> {
                { "bootstrap.servers", bootstrapServers }
            };

            var dh = new DeliveryHandler_SPN(topic);

            using (var producer = new Producer <Null, Null>(producerConfig, null, null))
            {
                producer.ProduceAsync(topic, null, null, 0, true, dh);
                producer.ProduceAsync(topic, null, null, 0, dh);
                producer.ProduceAsync(topic, null, null, true, dh);
                producer.ProduceAsync(topic, null, null, dh);
                producer.Flush();
            }

            Assert.Equal(4, dh.Count);
        }
示例#2
0
        public static void SerializingProducer_ProduceAsync_Null_DeliveryHandler(string bootstrapServers, string singlePartitionTopic, string partitionedTopic)
        {
            var producerConfig = new Dictionary <string, object>
            {
                { "bootstrap.servers", bootstrapServers },
                { "api.version.request", true }
            };

            var dh = new DeliveryHandler_SPN(singlePartitionTopic);

            using (var producer = new Producer <Null, Null>(producerConfig, null, null))
            {
                producer.ProduceAsync(singlePartitionTopic, null, null, 0, true, dh);
                producer.ProduceAsync(singlePartitionTopic, null, null, 0, dh);
                producer.ProduceAsync(singlePartitionTopic, null, null, true, dh);
                producer.ProduceAsync(singlePartitionTopic, null, null, dh);
                producer.Flush(TimeSpan.FromSeconds(10));
            }

            Assert.Equal(4, dh.Count);
        }