Hi, I’m beginner… I wanna know more about SendProducer.
I see the documentation that “For use-cases that don’t benefit form Akka Streams, the Send Producer offers a Future-based send API.”
Future based send API… As i understand that,
The function queues up work to be done and returns an uncompleted Future object immediately.
Later, when a value is available, the Future object completes with that value (or with an error; we’ll discuss that later).
If we use KafkaProducer, it return Future[Done]. And if we use SendProducer, it returns Future[Result[…]]. So both return Futures. Then what’s difference?
Please help me in learning. @ennru
KafkaProducer is for when you have a stream of elements Source or Flow and want to send them to a Kafka topic.
SendProducer is for when you don’t have a stream, and don’t want the overhead of creating a single element stream for each message. One example could be that you want to send a value from a HTTP request to a Kafka topic. There can be many (concurrent) HTTP requests but they are not represented as one single stream.
Implemented SendProducer with properties of RETRY_BACKOFF_MS_CONFIG with 3 sec. But still its retrying infinitely and says java.net.ConnectException: Connection refused.