Class KafkaStreamProducer

java.lang.Object
com.avoka.fc.core.stream.producer.KafkaStreamProducer
All Implemented Interfaces:
IStreamProducer<org.apache.kafka.clients.producer.RecordMetadata>
Direct Known Subclasses:
MockKafkaStreamProducer

public class KafkaStreamProducer extends Object implements IStreamProducer<org.apache.kafka.clients.producer.RecordMetadata>
Provide a Kafka producer.
Since:
22.10.0
  • Constructor Details

    • KafkaStreamProducer

      public KafkaStreamProducer()
  • Method Details

    • sendToStream

      public void sendToStream(ServiceConnection serviceConnection, String streamName, String key, String content, StreamCallback<org.apache.kafka.clients.producer.RecordMetadata> callback)
      Asynchronously send content to the streamName.
      Specified by:
      sendToStream in interface IStreamProducer<org.apache.kafka.clients.producer.RecordMetadata>
      Parameters:
      serviceConnection - the service connection
      streamName - the stream name
      key - the key
      content - the content which should be sent
      callback - the callback method which the user can implement to provide asynchronous handling of request completion
    • sendToStream

      public void sendToStream(ServiceConnection serviceConnection, String streamName, String partitionKey, String key, String content, StreamCallback<org.apache.kafka.clients.producer.RecordMetadata> callback)
      Asynchronously send content to the streamName and partitionKey.
      Specified by:
      sendToStream in interface IStreamProducer<org.apache.kafka.clients.producer.RecordMetadata>
      Parameters:
      serviceConnection - the service connection
      streamName - the stream name
      partitionKey - the partitionKey
      key - the key
      content - the content which should be sent
      callback - the callback method which the user can implement to provide asynchronous handling of request completion
    • getKafkaProducer

      protected org.apache.kafka.clients.producer.Producer<String,String> getKafkaProducer(Properties properties)
      return a producer to produce message
      Parameters:
      properties - The producer configs
      Returns:
      a producer