diff options
author | Patrick Brady <patrick.brady@att.com> | 2019-10-29 15:35:20 -0700 |
---|---|---|
committer | Takamune Cho <takamune.cho@att.com> | 2019-11-08 17:20:07 +0000 |
commit | b16ce237d780314ea8bbaf17cdb432bc694ee7e7 (patch) | |
tree | 4deb7fc697d7b2e539fff5d8eb490a2b0cffbef0 /appc-service-communicator | |
parent | 790ddb83355800cc037ea1ea3ca8610bb78018d5 (diff) |
Fix dg-common bundle error
Fix a dg-common blueprint error that was caused by the
changes with the new appc-service-communicator.
Added an interface for the EventSender, and created a blueprint file
to publish the interface as a service.
Change-Id: I37248fcbfa7cfa75e62965dad811b648c336b5e2
Signed-off-by: Patrick Brady <patrick.brady@att.com>
Issue-ID: APPC-1744
Diffstat (limited to 'appc-service-communicator')
3 files changed, 51 insertions, 1 deletions
diff --git a/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/event/EventSender.java b/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/event/EventSender.java index c15670838..24442ac8b 100644 --- a/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/event/EventSender.java +++ b/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/event/EventSender.java @@ -37,7 +37,7 @@ import java.util.Date; import java.util.Map; -public class EventSender +public class EventSender implements EventSenderInterface { private final EELFLogger LOG = EELFManager.getInstance().getLogger(EventSender.class); public static final String PROPERTY_PREFIX = "dmaap.event"; @@ -50,6 +50,7 @@ public class EventSender messagingConnector = new MessagingConnector(); } + @Override public boolean sendEvent(MessageDestination destination, EventMessage msg) { String jsonStr = msg.toJson(); String id = msg.getEventHeader().getEventId(); @@ -58,6 +59,7 @@ public class EventSender return messagingConnector.publishMessage(propertyPrefix, id, jsonStr); } + @Override public boolean sendEvent(MessageDestination destination, EventMessage msg, String eventTopicName) { String jsonStr = msg.toJson(); String id = msg.getEventHeader().getEventId(); @@ -66,6 +68,7 @@ public class EventSender return messagingConnector.publishMessage(propertyPrefix, id, eventTopicName, jsonStr); } + @Override public boolean sendEvent(MessageDestination destination, Map<String, String> params, SvcLogicContext ctx) throws APPCException { if (params == null) { @@ -94,4 +97,5 @@ public class EventSender return sendEvent(destination, eventMessage); } + } diff --git a/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/event/EventSenderInterface.java b/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/event/EventSenderInterface.java new file mode 100644 index 000000000..b5bb71de9 --- /dev/null +++ b/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/event/EventSenderInterface.java @@ -0,0 +1,14 @@ +package org.onap.appc.srvcomm.messaging.event; + +import java.util.Map; + +import org.onap.appc.exceptions.APPCException; +import org.onap.appc.srvcomm.messaging.MessageDestination; +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin; + +public interface EventSenderInterface extends SvcLogicJavaPlugin { + boolean sendEvent(MessageDestination destination, EventMessage msg); + boolean sendEvent(MessageDestination destination, EventMessage msg,String eventTopicName); + boolean sendEvent(MessageDestination destination, Map<String, String> params, SvcLogicContext ctx) throws APPCException; +} diff --git a/appc-service-communicator/appc-service-communicator-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/appc-service-communicator/appc-service-communicator-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml new file mode 100644 index 000000000..603a5bfcc --- /dev/null +++ b/appc-service-communicator/appc-service-communicator-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============LICENSE_START======================================================= + ONAP : APPC + ================================================================================ + Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + ============================================================================= + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ============LICENSE_END========================================================= + --> + + +<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"> + <bean id="eventSenderBean" class="org.onap.appc.srvcomm.messaging.event.EventSender" scope="singleton"> + </bean> + + <service id="eventSenderService" interface="org.onap.appc.srvcomm.messaging.event.EventSenderInterface" ref="eventSenderBean" /> + +</blueprint> |