From ffbeaa0281eeb2a812ba9d37b8e2cfde7849d0c3 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Fri, 8 Apr 2016 10:43:29 -0400 Subject: [PATCH] Remove `ProducerListenerInvokingCallback` The `ProducerListenerInvokingCallback` logic has been absorbed by the `KafkaTemplate` inner `Callback` implementation to meet the `ListenableFuture` requirements --- .../ProducerListenerInvokingCallback.java | 66 ------------------- 1 file changed, 66 deletions(-) delete mode 100644 spring-kafka/src/main/java/org/springframework/kafka/support/ProducerListenerInvokingCallback.java diff --git a/spring-kafka/src/main/java/org/springframework/kafka/support/ProducerListenerInvokingCallback.java b/spring-kafka/src/main/java/org/springframework/kafka/support/ProducerListenerInvokingCallback.java deleted file mode 100644 index 1e37e344..00000000 --- a/spring-kafka/src/main/java/org/springframework/kafka/support/ProducerListenerInvokingCallback.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2015-2016 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.kafka.support; - -import org.apache.kafka.clients.producer.Callback; -import org.apache.kafka.clients.producer.RecordMetadata; - -import org.springframework.util.Assert; - -/** - * Adapts the {@link org.apache.kafka.clients.producer.Callback} interface of the - * {@link org.apache.kafka.clients.producer.Producer} to a {@link ProducerListener}. - * - * @param the key type. - * @param the value type. - * - * @author Marius Bogoevici - * @author Gary Russell - */ -public class ProducerListenerInvokingCallback implements Callback { - - private final String topic; - - private final Integer partition; - - private final K key; - - private final V value; - - private final ProducerListener producerListener; - - public ProducerListenerInvokingCallback(String topic, Integer partition, K key, V value, - ProducerListener producerListener) { - Assert.notNull(producerListener, "must not be null"); - this.topic = topic; - this.partition = partition; - this.key = key; - this.value = value; - this.producerListener = producerListener; - } - - @Override - public void onCompletion(RecordMetadata metadata, Exception exception) { - if (exception != null) { - this.producerListener.onError(this.topic, this.partition, this.key, this.value, exception); - } - else { - this.producerListener.onSuccess(this.topic, this.partition, this.key, this.value, metadata); - } - } - -}