2 * ============LICENSE_START=======================================================
3 * Copyright (c) 2024 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.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.cps.ncmp.api.impl.events.cmsubscription;
23 import lombok.RequiredArgsConstructor;
24 import org.onap.cps.ncmp.api.impl.events.cmsubscription.producer.CmNotificationSubscriptionDmiInEventProducer;
25 import org.onap.cps.ncmp.api.impl.events.cmsubscription.producer.CmNotificationSubscriptionNcmpOutEventProducer;
26 import org.onap.cps.ncmp.events.cmnotificationsubscription_merge1_0_0.ncmp_to_dmi.CmNotificationSubscriptionDmiInEvent;
27 import org.onap.cps.ncmp.events.cmsubscription_merge1_0_0.ncmp_to_client.CmNotificationSubscriptionNcmpOutEvent;
28 import org.springframework.stereotype.Component;
31 @RequiredArgsConstructor
32 public class CmNotificationSubscriptionEventsHandler {
33 private final CmNotificationSubscriptionNcmpOutEventProducer cmNotificationSubscriptionNcmpOutEventProducer;
34 private final CmNotificationSubscriptionDmiInEventProducer cmNotificationSubscriptionDmiInEventProducer;
37 * Publish the event to the client who requested the subscription with key as subscription id and event is Cloud
40 * @param subscriptionId Cm Subscription id
41 * @param eventType Type of event
42 * @param cmNotificationSubscriptionNcmpOutEvent Cm Notification Subscription Event for the
44 * @param isScheduledEvent Determines if the event is to be scheduled
47 public void publishCmNotificationSubscriptionNcmpOutEvent(final String subscriptionId, final String eventType,
48 final CmNotificationSubscriptionNcmpOutEvent
49 cmNotificationSubscriptionNcmpOutEvent,
50 final boolean isScheduledEvent) {
51 cmNotificationSubscriptionNcmpOutEventProducer.publishCmNotificationSubscriptionNcmpOutEvent(subscriptionId,
52 eventType, cmNotificationSubscriptionNcmpOutEvent, isScheduledEvent);
56 * Publish the event to the provided dmi plugin with key as subscription id and the event is in Cloud Event format.
58 * @param subscriptionId Cm Subscription id
59 * @param dmiPluginName Dmi Plugin Name
60 * @param eventType Type of event
61 * @param cmNotificationSubscriptionDmiInEvent Cm Notification Subscription event for Dmi
63 public void publishCmNotificationSubscriptionDmiInEvent(final String subscriptionId, final String dmiPluginName,
64 final String eventType,
65 final CmNotificationSubscriptionDmiInEvent
66 cmNotificationSubscriptionDmiInEvent) {
67 cmNotificationSubscriptionDmiInEventProducer.publishCmNotificationSubscriptionDmiInEvent(subscriptionId,
68 dmiPluginName, eventType, cmNotificationSubscriptionDmiInEvent);