2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2022 Nordix Foundation.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 * ============LICENSE_END=========================================================
19 package org.onap.policy.common.endpoints.event.comm.bus;
21 import java.util.List;
22 import java.util.Properties;
23 import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams;
26 * KAFKA Topic Sink Factory.
28 public interface KafkaTopicSinkFactory {
31 * Instantiates a new KAFKA Topic Writer.
33 * @param busTopicParams parameters object
34 * @return an KAFKA Topic Sink
36 KafkaTopicSink build(BusTopicParams busTopicParams);
39 * Creates an KAFKA Topic Writer based on properties files.
41 * @param properties Properties containing initialization values
43 * @return an KAFKA Topic Writer
44 * @throws IllegalArgumentException if invalid parameters are present
46 List<KafkaTopicSink> build(Properties properties);
49 * Instantiates a new KAFKA Topic Writer.
51 * @param servers list of servers
52 * @param topic topic name
54 * @return an KAFKA Topic Writer
55 * @throws IllegalArgumentException if invalid parameters are present
57 KafkaTopicSink build(List<String> servers, String topic);
60 * Destroys an KAFKA Topic Writer based on a topic.
62 * @param topic topic name
63 * @throws IllegalArgumentException if invalid parameters are present
65 void destroy(String topic);
68 * Destroys all KAFKA Topic Writers.
73 * gets an KAFKA Topic Writer based on topic name.
75 * @param topic the topic name
77 * @return an KAFKA Topic Writer with topic name
78 * @throws IllegalArgumentException if an invalid topic is provided
79 * @throws IllegalStateException if the KAFKA Topic Reader is an incorrect state
81 KafkaTopicSink get(String topic);
84 * Provides a snapshot of the KAFKA Topic Writers.
86 * @return a list of the KAFKA Topic Writers
88 List<KafkaTopicSink> inventory();