All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.panhongan.util.kafka.KafkaProducerSendFailedCallback Maven / Gradle / Ivy

There is a newer version: 0.1.8
Show newest version
package com.github.panhongan.util.kafka;

import org.apache.kafka.clients.producer.Callback;
import org.apache.kafka.clients.producer.RecordMetadata;

public class KafkaProducerSendFailedCallback implements Callback {

	private MessageLocalWriter local_writer = null;
	
	private String topic = null;
	
	private String message = null;
	
	private int partition_id = 0;
	
	public KafkaProducerSendFailedCallback(MessageLocalWriter local_writer, 
			String topic, int partition_id, String message) {
		this.local_writer = local_writer;
		this.topic = topic;
		this.message = message;
		this.partition_id = partition_id;
	}

	@Override
	public void onCompletion(RecordMetadata metadata, Exception e) {
		if (e != null) {
			if (local_writer != null) {
				local_writer.processMessage(topic, partition_id, message);
			}
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy