summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTian Lee <TianL@amdocs.com>2018-06-26 15:02:48 +0000
committerGerrit Code Review <gerrit@onap.org>2018-06-26 15:02:48 +0000
commit5482cee27404b6d545a3f1e9714d0076e811b4bd (patch)
tree044da6183e118833815de3754637d5f1a0236678
parent6d30dcbdc6d8a4b2633f47f5076335d5a06518b3 (diff)
parent53a7faa1310941eaff19eaafd8da52ec56de1e22 (diff)
Merge "Refactor of KafkaEventPublisher"
-rw-r--r--event-client-kafka/src/main/java/org/onap/aai/event/client/KafkaEventPublisher.java19
1 files changed, 10 insertions, 9 deletions
diff --git a/event-client-kafka/src/main/java/org/onap/aai/event/client/KafkaEventPublisher.java b/event-client-kafka/src/main/java/org/onap/aai/event/client/KafkaEventPublisher.java
index 2b98e27..098f1f8 100644
--- a/event-client-kafka/src/main/java/org/onap/aai/event/client/KafkaEventPublisher.java
+++ b/event-client-kafka/src/main/java/org/onap/aai/event/client/KafkaEventPublisher.java
@@ -42,6 +42,7 @@ public class KafkaEventPublisher implements EventPublisher {
private static Logger log = LoggerFactory.getInstance().getLogger(KafkaEventPublisher.class);
+ @FunctionalInterface
public interface KafkaProducerFactory {
public KafkaProducer<String, String> createProducer(Properties props);
}
@@ -54,15 +55,6 @@ public class KafkaEventPublisher implements EventPublisher {
private final String topic;
/**
- * Replace the producer factory (intended to be used for testing purposes only).
- *
- * @param producerFactory
- */
- static void setProducerFactory(KafkaProducerFactory producerFactory) {
- KafkaEventPublisher.producerFactory = producerFactory;
- }
-
- /**
*
* @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
@@ -109,6 +101,15 @@ public class KafkaEventPublisher implements EventPublisher {
}
/**
+ * Replace the producer factory (intended to be used for testing purposes only).
+ *
+ * @param producerFactory
+ */
+ static void setProducerFactory(KafkaProducerFactory producerFactory) {
+ KafkaEventPublisher.producerFactory = producerFactory;
+ }
+
+ /**
* Closes the publisher.
*/
@Override