2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.common.endpoints.event.comm.bus.internal;
24 import java.util.List;
26 import org.onap.policy.common.endpoints.event.comm.Topic;
27 import org.onap.policy.common.endpoints.event.comm.bus.UebTopicSink;
28 import org.slf4j.Logger;
29 import org.slf4j.LoggerFactory;
32 * This implementation publishes events for the associated UEB topic, inline with the calling
35 public class InlineUebTopicSink extends InlineBusTopicSink implements UebTopicSink {
40 private static Logger logger = LoggerFactory.getLogger(InlineUebTopicSink.class);
43 * Argument-based UEB Topic Writer instantiation. BusTopicParams contains below mentioned
46 * servers list of UEB servers available for publishing
47 * topic the topic to publish to
48 * apiKey the api key (optional)
49 * apiSecret the api secret (optional)
50 * partitionId the partition key (optional, autogenerated if not provided)
51 * useHttps does connection use HTTPS?
52 * allowSelfSignedCerts are self-signed certificates allow
53 * @param busTopicParams contains attributes needed
54 * @throws IllegalArgumentException if invalid arguments are detected
56 public InlineUebTopicSink(BusTopicParams busTopicParams) {
57 super(busTopicParams);
61 * Instantiation of internal resources
66 this.publisher = new BusPublisher.CambriaPublisherWrapper(BusTopicParams.builder()
67 .servers(this.servers)
70 .apiSecret(this.apiSecret)
71 .useHttps(this.useHttps)
72 .allowSelfSignedCerts(this.allowSelfSignedCerts)
74 logger.info("{}: UEB SINK created", this);
78 public String toString() {
79 StringBuilder builder = new StringBuilder();
80 builder.append("InlineUebTopicSink [getTopicCommInfrastructure()=").append(getTopicCommInfrastructure())
81 .append(", toString()=").append(super.toString()).append("]");
82 return builder.toString();
89 public CommInfrastructure getTopicCommInfrastructure() {
90 return Topic.CommInfrastructure.UEB;