com.devonfw.module.kafka.common.messaging.api.client.MessageSender Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of devon4j-kafka Show documentation
Show all versions of devon4j-kafka Show documentation
kafka implementation for devon4j.
package com.devonfw.module.kafka.common.messaging.api.client;
import java.util.concurrent.TimeoutException;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.kafka.support.SendResult;
import org.springframework.util.concurrent.ListenableFuture;
/**
* The interface used to send message to kafka broker with the help of multiple methods. For example, the method
* {@link #sendMessage(ProducerRecord)}} sends the message by interacting with
* {@link KafkaTemplate#send(org.apache.kafka.clients.producer.ProducerRecord)}}.
*
* @param the key type.
* @param the value type.
* @deprecated The implementation of devon4j-kafka will be abandoned. It is superseeded by Springs Kafka
* implementation.
*/
@Deprecated
public interface MessageSender {
/**
* Send the provided {@link ProducerRecord}} to kafka.
*
* @param producerRecord the {@link ProducerRecord}
* @return the {@link ListenableFuture}.
*/
ListenableFuture> sendMessage(ProducerRecord producerRecord);
/**
* Send the provided {@link ProducerRecord}} to kafka and waits for the default timeout seconds by default 60.
*
* @param producerRecord {@link ProducerRecord}}
* @throws Exception generic exception. Throws {@link TimeoutException}} when timeout seconds exceeds.
*/
void sendMessageAndWait(ProducerRecord producerRecord) throws Exception;
/**
* Send the provided {@link ProducerRecord}} to kafka and waits for the given timeout seconds.
*
* @param producerRecord producerRecord the {@link ProducerRecord}
* @param timeout the seconds needs to wait for the operation to complete
* @throws Exception generic exception. Throws {@link TimeoutException}} when timeout seconds exceeds.
*/
void sendMessageAndWait(ProducerRecord producerRecord, int timeout) throws Exception;
}