2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.policy.drools.event.comm.bus.internal;
23 import java.util.List;
25 import org.openecomp.policy.drools.event.comm.Topic;
26 import org.openecomp.policy.drools.event.comm.bus.DmaapTopicSink;
27 import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
28 import org.openecomp.policy.common.logging.flexlogger.Logger;
31 * This implementation publishes events for the associated DMAAP topic,
32 * inline with the calling thread.
34 public class InlineDmaapTopicSink extends InlineBusTopicSink implements DmaapTopicSink {
36 protected static Logger logger =
37 FlexLogger.getLogger(InlineDmaapTopicSink.class);
39 protected final String userName;
40 protected final String password;
42 public InlineDmaapTopicSink(List<String> servers, String topic,
43 String apiKey, String apiSecret,
44 String userName, String password,
46 throws IllegalArgumentException {
48 super(servers, topic, apiKey, apiSecret, partitionKey);
50 this.userName = userName;
51 this.password = password;
58 new BusPublisher.DmaapPublisherWrapper(this.servers,
62 if (logger.isInfoEnabled())
63 logger.info("DMAAP SINK TOPIC created " + this);
70 public CommInfrastructure getTopicCommInfrastructure() {
71 return Topic.CommInfrastructure.DMAAP;
76 public String toString() {
77 StringBuilder builder = new StringBuilder();
78 builder.append("InlineDmaapTopicSink [userName=").append(userName).append(", password=").append(password)
79 .append(", getTopicCommInfrastructure()=").append(getTopicCommInfrastructure()).append(", toString()=")
80 .append(super.toString()).append("]");
81 return builder.toString();