/// <see cref="IGojulMQMessageProducer{T}.SendMessages(string, GojulMQMessageKeyProvider{T}, IEnumerable{T})"/>
        public void SendMessages(string topic, GojulMQMessageKeyProvider <T> messageKeyProvider, IEnumerable <T> messages)
        {
            Condition.Requires(topic, "topic").IsNotNull().IsNotEmpty();
            Condition.Requires(messageKeyProvider, "messageKeyProvider").IsNotNull();
            Condition.Requires(messages, "messages").IsNotNull();

            log.Information(string.Format("Starting to send messages to topic %s", topic));

            int i = 0;

            foreach (T msg in messages)
            {
                Condition.Requires((object)msg, "msg").IsNotNull();
                // We force the producer to produce synchronously. The goal here is to avoid
                // hundreds of thread producing items in the loop, which would be a nightmare
                // in term for performance.
                var kafkaMessage = new Message <string, T> {
                    Key = messageKeyProvider(msg), Value = msg
                };
                _producer.Produce(topic, kafkaMessage);
                i++;
            }
            _producer.Flush();
            log.Information(string.Format("Successfully sent {0} messages to topic {1}", i, topic));
        }
        /// <see cref="IGojulMQMessageProducer{T}.SendMessage(string, GojulMQMessageKeyProvider{T}, T)"/>
        public void SendMessage(string topic, GojulMQMessageKeyProvider <T> messageKeyProvider, T message)
        {
            Condition.Requires((object)message, "message").IsNotNull();

            SendMessages(topic, messageKeyProvider, new[] { message });
        }