com.soento.logback.kafka.delivery.DeliveryStrategy Maven / Gradle / Ivy
package com.soento.logback.kafka.delivery;
import org.apache.kafka.clients.producer.Producer;
import org.apache.kafka.clients.producer.ProducerRecord;
/**
* Interface for DeliveryStrategies.
* @since 0.0.1
*/
public interface DeliveryStrategy {
/**
* Sends a message to a kafka producer and somehow deals with failures.
*
* @param producer the backing kafka producer
* @param record the prepared kafka message (ready to ship)
* @param event the originating logging event
* @param failedDeliveryCallback a callback that handles messages that could not be delivered with best-effort.
* @param the key type of a persisted log message.
* @param the value type of a persisted log message.
* @param the type of the logging event.
* @return {@code true} if the message could be sent successfully, {@code false} otherwise.
*/
boolean send(Producer producer, ProducerRecord record, E event, FailedDeliveryCallback failedDeliveryCallback);
}