コード例 #1
0
        public void ShouldNotHaltOnProduceException()
        {
            var exception = new ProduceException <Null, string>(new Error(ErrorCode.BrokerNotAvailable), new DeliveryResult <Null, string>());
            var producer  = GetProducerWithMocks(exception);

            producer.Start();
            Thread.Sleep(500);
            producer.Stop();
        }
コード例 #2
0
 /// <summary>
 /// Decider for all produce exceptions raised by the underlying Kafka producer
 /// </summary>
 /// <param name="exception"><see cref="ProduceException{TKey,TValue}"/> thrown when producer produced</param>
 /// <returns><see cref="Directive"/>></returns>
 protected virtual Directive OnProduceException(ProduceException <TKey, TValue> exception)
 => Directive.Stop;
コード例 #3
0
 /// <summary>
 /// Decider for all serialization exceptions raised by the underlying Kafka producer
 /// </summary>
 /// <param name="exception"><see cref="ProduceException{TKey,TValue}"/> thrown when producer produced</param>
 /// <returns><see cref="Directive"/>></returns>
 protected virtual Directive OnSerializationError(ProduceException <TKey, TValue> exception)
 => Directive.Stop;
コード例 #4
0
 protected override Directive OnSerializationError(ProduceException <K, V> exception)
 {
     CallCount++;
     return(Directive.Resume);
 }
コード例 #5
0
        private KafkaProducerArgs OnKakfaProducerException(T messages, string key = "", ProduceException <string, string> kafkaProducerExecption = null)
        {
            var e = new KafkaProducerArgs(messages, key, kafkaProducerExecption);

            KakfaProducerException?.Invoke(e);
            return(e);
        }
コード例 #6
0
 public KafkaProducerArgs(T messages, string key = "", ProduceException <string, string> KafkaProducerExecption = null)
 {
     this.Messages = messages;
     this.Key      = key;
     this.KafkaProducerExecption = KafkaProducerExecption;
 }