Class MockProducerInterceptor

java.lang.Object
org.apache.kafka.test.MockProducerInterceptor
All Implemented Interfaces:
AutoCloseable, org.apache.kafka.clients.producer.ProducerInterceptor<String,String>, org.apache.kafka.common.ClusterResourceListener, org.apache.kafka.common.Configurable
Direct Known Subclasses:
KafkaProducerTest.MonitorableInterceptor

public class MockProducerInterceptor extends Object implements org.apache.kafka.common.ClusterResourceListener, org.apache.kafka.clients.producer.ProducerInterceptor<String,String>
  • Field Details

    • INIT_COUNT

      public static final AtomicInteger INIT_COUNT
    • CLOSE_COUNT

      public static final AtomicInteger CLOSE_COUNT
    • ONSEND_COUNT

      public static final AtomicInteger ONSEND_COUNT
    • CONFIG_COUNT

      public static final AtomicInteger CONFIG_COUNT
    • THROW_CONFIG_EXCEPTION

      public static final AtomicInteger THROW_CONFIG_EXCEPTION
    • THROW_ON_CONFIG_EXCEPTION_THRESHOLD

      public static final AtomicInteger THROW_ON_CONFIG_EXCEPTION_THRESHOLD
    • ON_SUCCESS_COUNT

      public static final AtomicInteger ON_SUCCESS_COUNT
    • ON_ERROR_COUNT

      public static final AtomicInteger ON_ERROR_COUNT
    • ON_ERROR_WITH_METADATA_COUNT

      public static final AtomicInteger ON_ERROR_WITH_METADATA_COUNT
    • ON_ACKNOWLEDGEMENT_COUNT

      public static final AtomicInteger ON_ACKNOWLEDGEMENT_COUNT
    • CLUSTER_META

      public static final AtomicReference<org.apache.kafka.common.ClusterResource> CLUSTER_META
    • NO_CLUSTER_ID

      public static final org.apache.kafka.common.ClusterResource NO_CLUSTER_ID
    • CLUSTER_ID_BEFORE_ON_ACKNOWLEDGEMENT

      public static final AtomicReference<org.apache.kafka.common.ClusterResource> CLUSTER_ID_BEFORE_ON_ACKNOWLEDGEMENT
    • APPEND_STRING_PROP

      public static final String APPEND_STRING_PROP
      See Also:
  • Constructor Details

    • MockProducerInterceptor

      public MockProducerInterceptor()
  • Method Details

    • configure

      public void configure(Map<String,?> configs)
      Specified by:
      configure in interface org.apache.kafka.common.Configurable
    • onSend

      public org.apache.kafka.clients.producer.ProducerRecord<String,String> onSend(org.apache.kafka.clients.producer.ProducerRecord<String,String> record)
      Specified by:
      onSend in interface org.apache.kafka.clients.producer.ProducerInterceptor<String,String>
    • onAcknowledgement

      public void onAcknowledgement(org.apache.kafka.clients.producer.RecordMetadata metadata, Exception exception)
      Specified by:
      onAcknowledgement in interface org.apache.kafka.clients.producer.ProducerInterceptor<String,String>
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface org.apache.kafka.clients.producer.ProducerInterceptor<String,String>
    • setThrowOnConfigExceptionThreshold

      public static void setThrowOnConfigExceptionThreshold(int value)
    • resetCounters

      public static void resetCounters()
    • onUpdate

      public void onUpdate(org.apache.kafka.common.ClusterResource clusterResource)
      Specified by:
      onUpdate in interface org.apache.kafka.common.ClusterResourceListener