summaryrefslogtreecommitdiffstats
path: root/event-client-kafka
diff options
context:
space:
mode:
authorWiktor Garbarek <wiktor.garbarek@nokia.com>2018-06-26 16:43:52 +0200
committerWiktor Garbarek <wiktor.garbarek@nokia.com>2018-06-26 16:43:52 +0200
commit53a7faa1310941eaff19eaafd8da52ec56de1e22 (patch)
tree25b9bccc94d7b3b0c7bd83a51ead4ce7775f97eb /event-client-kafka
parent95c897c3c85c305f676dc04adc2f167fecfc598b (diff)
Refactor of KafkaEventPublisher
Moved constructors; added annotation Change-Id: I0223df163a3dd759ff83e490d9d646e232a21a34 Issue-ID: AAI-1249 Signed-off-by: Wiktor Garbarek <wiktor.garbarek@nokia.com>
Diffstat (limited to 'event-client-kafka')
-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