Shravan Ambati | 7d19954 | 2016-04-22 16:09:05 -0700 | [diff] [blame] | 1 | /** |
| 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 | */ |
| 15 | package org.onosproject.kafkaintegration.api; |
| 16 | |
| 17 | import org.onosproject.kafkaintegration.api.dto.EventSubscriber; |
| 18 | import org.onosproject.kafkaintegration.api.dto.EventSubscriberGroupId; |
| 19 | import org.onosproject.kafkaintegration.errors.InvalidApplicationException; |
| 20 | import org.onosproject.kafkaintegration.errors.InvalidGroupIdException; |
| 21 | import org.onosproject.kafkaintegration.errors.UnsupportedEventException; |
| 22 | |
| 23 | /** |
| 24 | * APIs for subscribing to Onos Event Messages. |
| 25 | */ |
| 26 | public interface EventExporterService { |
| 27 | |
| 28 | /** |
| 29 | * Registers the external application to receive events generated in ONOS. |
| 30 | * |
| 31 | * @param appName Application Name |
| 32 | * @return unique consumer group identifier |
| 33 | */ |
| 34 | EventSubscriberGroupId registerListener(String appName); |
| 35 | |
| 36 | /** |
| 37 | * Removes the Registered Listener. |
| 38 | * |
| 39 | * @param appName Application Name |
| 40 | */ |
| 41 | void unregisterListener(String appName); |
| 42 | |
| 43 | /** |
| 44 | * Allows registered listener to subscribe for a specific event type. |
| 45 | * |
| 46 | * @param subscriber Subscription data containing the event type |
| 47 | * @throws UnsupportedEventException |
| 48 | * @throws InvalidGroupIdException |
| 49 | * @throws InvalidApplicationException |
| 50 | */ |
| 51 | void subscribe(EventSubscriber subscriber) |
| 52 | throws UnsupportedEventException, InvalidGroupIdException, |
| 53 | InvalidApplicationException; |
| 54 | |
| 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 | } |