blob: e2036973920739af7698a47209f2fa9a0ff4c2ce [file] [log] [blame]
Shravan Ambati7d199542016-04-22 16:09:05 -07001/**
2 * Copyright 2016-present Open Networking Laboratory
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6
7 * http://www.apache.org/licenses/LICENSE-2.0
8
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15package org.onosproject.kafkaintegration.api;
16
17import org.onosproject.kafkaintegration.api.dto.EventSubscriber;
18import org.onosproject.kafkaintegration.api.dto.EventSubscriberGroupId;
19import org.onosproject.kafkaintegration.errors.InvalidApplicationException;
20import org.onosproject.kafkaintegration.errors.InvalidGroupIdException;
Shravan Ambatibb6b4452016-05-04 13:25:28 -070021
22import com.google.common.annotations.Beta;
Shravan Ambati7d199542016-04-22 16:09:05 -070023
24/**
25 * APIs for subscribing to Onos Event Messages.
26 */
Shravan Ambatibb6b4452016-05-04 13:25:28 -070027@Beta
Shravan Ambati7d199542016-04-22 16:09:05 -070028public interface EventExporterService {
29
30 /**
31 * Registers the external application to receive events generated in ONOS.
32 *
33 * @param appName Application Name
34 * @return unique consumer group identifier
35 */
36 EventSubscriberGroupId registerListener(String appName);
37
38 /**
39 * Removes the Registered Listener.
40 *
41 * @param appName Application Name
42 */
43 void unregisterListener(String appName);
44
45 /**
46 * Allows registered listener to subscribe for a specific event type.
47 *
48 * @param subscriber Subscription data containing the event type
Shravan Ambati7d199542016-04-22 16:09:05 -070049 * @throws InvalidGroupIdException
50 * @throws InvalidApplicationException
51 */
52 void subscribe(EventSubscriber subscriber)
Shravan Ambatibb6b4452016-05-04 13:25:28 -070053 throws InvalidGroupIdException, InvalidApplicationException;
Shravan Ambati7d199542016-04-22 16:09:05 -070054
55 /**
56 * Allows the registered listener to unsubscribe for a specific event.
57 *
58 * @param subscriber Subscription data containing the event type
59 * @throws InvalidGroupIdException
60 * @throws InvalidApplicationException
61 */
62 void unsubscribe(EventSubscriber subscriber)
63 throws InvalidGroupIdException, InvalidApplicationException;
64}