예제 #1
0
        private void Produce(string topic, TKey key, TValue val, DateTime?timestamp, int partition, bool blockIfQueueFull, IDeliveryHandler <TKey, TValue> deliveryHandler)
        {
            var handler  = new TypedDeliveryHandlerShim(key, val, deliveryHandler);
            var keyBytes = KeySerializer?.Serialize(key);
            var valBytes = ValueSerializer?.Serialize(val);

            producer.Produce(topic, valBytes, 0, valBytes == null ? 0 : valBytes.Length, keyBytes, 0, keyBytes == null ? 0 : keyBytes.Length, timestamp, partition, blockIfQueueFull, handler);
        }
예제 #2
0
        public void ProduceAsync(string topic, TKey key, TValue val, IDeliveryHandler <TKey, TValue> deliveryHandler, DateTime?timestamp = null, int?partition = null, bool blockIfQueueFull = true)
        {
            var handler = new TypedDeliveryHandlerShim(key, val, deliveryHandler);

            producer.ProduceAsync(topic, KeySerializer?.Serialize(key), ValueSerializer?.Serialize(val), handler, timestamp, partition, blockIfQueueFull);
        }