summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--event-client-kafka/src/main/java/org/onap/aai/event/client/KafkaEventConsumer.java20
1 files changed, 11 insertions, 9 deletions
diff --git a/event-client-kafka/src/main/java/org/onap/aai/event/client/KafkaEventConsumer.java b/event-client-kafka/src/main/java/org/onap/aai/event/client/KafkaEventConsumer.java
index 1deb90a..e08639b 100644
--- a/event-client-kafka/src/main/java/org/onap/aai/event/client/KafkaEventConsumer.java
+++ b/event-client-kafka/src/main/java/org/onap/aai/event/client/KafkaEventConsumer.java
@@ -49,6 +49,7 @@ public class KafkaEventConsumer implements EventConsumer {
private static Logger log = LoggerFactory.getInstance().getLogger(KafkaEventConsumer.class);
+ @FunctionalInterface
public interface KafkaConsumerFactory {
public KafkaConsumer<String, String> createConsumer(Properties props);
}
@@ -58,15 +59,6 @@ public class KafkaEventConsumer implements EventConsumer {
private final KafkaConsumer<String, String> consumer;
/**
- * Replace the consumer factory (intended to be used for testing purposes only).
- *
- * @param consumerFactory
- */
- static void setConsumerFactory(KafkaConsumerFactory consumerFactory) {
- KafkaEventConsumer.consumerFactory = consumerFactory;
- }
-
- /**
*
* @param hosts - A list of host/port pairs to use for establishing the initial connection to the Kafka cluster. The
* client will make use of all servers irrespective of which servers are specified here for
@@ -89,6 +81,16 @@ public class KafkaEventConsumer implements EventConsumer {
consumer.subscribe(Arrays.asList(topic));
}
+ /**
+ * Replace the consumer factory (intended to be used for testing purposes only).
+ *
+ * @param consumerFactory
+ */
+ static void setConsumerFactory(KafkaConsumerFactory consumerFactory) {
+ KafkaEventConsumer.consumerFactory = consumerFactory;
+ }
+
+ @Override
public void close() {
consumer.close();
}