2 * Copyright © 2021 Orange, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.transportpce.dmaap.client.impl;
10 import org.opendaylight.mdsal.binding.api.NotificationService;
11 import org.opendaylight.transportpce.dmaap.client.listener.NbiNotificationsListenerImpl;
12 import org.opendaylight.yang.gen.v1.nbi.notifications.rev201130.NbiNotificationsListener;
13 import org.opendaylight.yangtools.concepts.ListenerRegistration;
14 import org.slf4j.Logger;
15 import org.slf4j.LoggerFactory;
17 public class DmaapClientProvider {
18 private static final Logger LOG = LoggerFactory.getLogger(DmaapClientProvider.class);
19 private ListenerRegistration<NbiNotificationsListener> listenerRegistration;
20 private NotificationService notificationService;
21 private final String baseUrl;
22 private final String username;
23 private final String password;
25 public DmaapClientProvider(NotificationService notificationService, String baseUrl,
26 String username, String password) {
27 this.notificationService = notificationService;
28 this.baseUrl = baseUrl;
29 this.username = username;
30 this.password = password;
34 * Method called when the blueprint container is created.
37 LOG.info("DmaapClientProvider Session Initiated");
38 listenerRegistration = notificationService.registerNotificationListener(
39 new NbiNotificationsListenerImpl(baseUrl, username, password));
43 * Method called when the blueprint container is destroyed.
46 listenerRegistration.close();
47 LOG.info("DmaapClientProvider Closed");