Class KafkaAvroClient

java.lang.Object
dev.lydtech.component.framework.client.kafka.KafkaAvroClient

public class KafkaAvroClient extends Object
  • Method Details

    • getInstance

      public static KafkaAvroClient getInstance()
    • createProducer

      public org.apache.kafka.clients.producer.KafkaProducer<Long,String> createProducer()
      Create a standard Avro Producer.
    • createConsumer

      public org.apache.kafka.clients.consumer.Consumer createConsumer(String groupId, String topic)
    • consumeAndAssert

      public <T> List<org.apache.kafka.clients.consumer.ConsumerRecord<String,T>> consumeAndAssert(String testName, org.apache.kafka.clients.consumer.Consumer consumer, int expectedEventCount, int furtherPolls) throws Exception
      Defers to the method in KafkaClient.
      Throws:
      Exception
    • consumeAndAssert

      public <T> List<org.apache.kafka.clients.consumer.ConsumerRecord<String,T>> consumeAndAssert(String testName, org.apache.kafka.clients.consumer.Consumer consumer, int expectedEventCount, int furtherPolls, int awaitAtMostSeconds) throws Exception
      Defers to the method in KafkaClient.
      Throws:
      Exception
    • createProducer

      public org.apache.kafka.clients.producer.KafkaProducer<Long,String> createProducer(Properties additionalConfig)
      Create a Producer with additional config.
    • sendMessage

      public org.apache.kafka.clients.producer.RecordMetadata sendMessage(String topic, String key, Object payload) throws Exception
      Send a message synchronously without headers and with the default Avro Producer.
      Throws:
      Exception
    • sendMessage

      public org.apache.kafka.clients.producer.RecordMetadata sendMessage(String topic, String key, Object payload, Map<String,String> headers) throws Exception
      Send a message synchronously with the provided headers and with the default Avro Producer.
      Throws:
      Exception
    • sendMessageAsync

      public Future<org.apache.kafka.clients.producer.RecordMetadata> sendMessageAsync(String topic, String key, Object payload)
      Send a message asynchronously without headers and with the default Avro Producer.
    • sendMessageAsync

      public Future<org.apache.kafka.clients.producer.RecordMetadata> sendMessageAsync(String topic, String key, Object payload, Map<String,String> headers)
      Send a message asynchronously with the provided headers and with the default Avro Producer.