2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2019 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 org.onap.policy.common.endpoints.event.comm.Topic;
25 import org.onap.policy.common.endpoints.event.comm.bus.UebTopicSink;
26 import org.slf4j.Logger;
27 import org.slf4j.LoggerFactory;
30 * This implementation publishes events for the associated UEB topic, inline with the calling
33 public class InlineUebTopicSink extends InlineBusTopicSink implements UebTopicSink {
38 private static Logger logger = LoggerFactory.getLogger(InlineUebTopicSink.class);
41 * Argument-based UEB Topic Writer instantiation. BusTopicParams contains below mentioned
44 * <p>servers list of UEB servers available for publishing
45 * topic the topic to publish to
46 * apiKey the api key (optional)
47 * apiSecret the api secret (optional)
48 * partitionId the partition key (optional, autogenerated if not provided)
49 * useHttps does connection use HTTPS?
50 * allowSelfSignedCerts are self-signed certificates allow
51 * @param busTopicParams contains attributes needed
52 * @throws IllegalArgumentException if invalid arguments are detected
54 public InlineUebTopicSink(BusTopicParams busTopicParams) {
55 super(busTopicParams);
59 * Instantiation of internal resources.
64 this.publisher = new BusPublisher.CambriaPublisherWrapper(BusTopicParams.builder()
65 .servers(this.servers)
66 .topic(this.effectiveTopic)
68 .apiSecret(this.apiSecret)
69 .useHttps(this.useHttps)
70 .allowSelfSignedCerts(this.allowSelfSignedCerts)
72 logger.info("{}: UEB SINK created", this);
76 public String toString() {
77 StringBuilder builder = new StringBuilder();
78 builder.append("InlineUebTopicSink [getTopicCommInfrastructure()=").append(getTopicCommInfrastructure())
79 .append(", toString()=").append(super.toString()).append("]");
80 return builder.toString();
84 public CommInfrastructure getTopicCommInfrastructure() {
85 return Topic.CommInfrastructure.UEB;