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(); }
/// <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;
/// <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;
protected override Directive OnSerializationError(ProduceException <K, V> exception) { CallCount++; return(Directive.Resume); }
private KafkaProducerArgs OnKakfaProducerException(T messages, string key = "", ProduceException <string, string> kafkaProducerExecption = null) { var e = new KafkaProducerArgs(messages, key, kafkaProducerExecption); KakfaProducerException?.Invoke(e); return(e); }
public KafkaProducerArgs(T messages, string key = "", ProduceException <string, string> KafkaProducerExecption = null) { this.Messages = messages; this.Key = key; this.KafkaProducerExecption = KafkaProducerExecption; }