Package com.avoka.fc.core.stream
Class KafkaStreamProducer
java.lang.Object
com.avoka.fc.core.stream.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 Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetKafkaProducer
(Properties properties) return a producer to produce messagevoid
sendToStream
(ServiceConnection serviceConnection, String streamName, String key, String content, StreamCallback<org.apache.kafka.clients.producer.RecordMetadata> callback) Asynchronously send content to the streamName.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.
-
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 interfaceIStreamProducer<org.apache.kafka.clients.producer.RecordMetadata>
- Parameters:
serviceConnection
- the service connectionstreamName
- the stream namekey
- the keycontent
- the content which should be sentcallback
- 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 interfaceIStreamProducer<org.apache.kafka.clients.producer.RecordMetadata>
- Parameters:
serviceConnection
- the service connectionstreamName
- the stream namepartitionKey
- the partitionKeykey
- the keycontent
- the content which should be sentcallback
- 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
-