tom | 1d416c5 | 2014-09-29 20:55:24 -0700 | [diff] [blame^] | 1 | package org.onlab.onos.store.cluster.messaging; |
| 2 | |
| 3 | import org.onlab.onos.cluster.NodeId; |
| 4 | |
| 5 | import java.util.Set; |
| 6 | |
| 7 | /** |
| 8 | * Service for assisting communications between controller cluster nodes. |
| 9 | */ |
| 10 | public interface ClusterCommunicationService { |
| 11 | |
| 12 | /** |
| 13 | * Sends a message to the specified controller node. |
| 14 | * |
| 15 | * @param message message to send |
| 16 | * @param toNodeId node identifier |
| 17 | * @return true if the message was sent sucessfully; false if there is |
| 18 | * no stream or if there was an error |
| 19 | */ |
| 20 | boolean send(ClusterMessage message, NodeId toNodeId); |
| 21 | |
| 22 | /** |
| 23 | * Adds a new subscriber for the specified message subject. |
| 24 | * |
| 25 | * @param subject message subject |
| 26 | * @param subscriber message subscriber |
| 27 | */ |
| 28 | void addSubscriber(MessageSubject subject, MessageSubscriber subscriber); |
| 29 | |
| 30 | /** |
| 31 | * Removes the specified subscriber from the given message subject. |
| 32 | * |
| 33 | * @param subject message subject |
| 34 | * @param subscriber message subscriber |
| 35 | */ |
| 36 | void removeSubscriber(MessageSubject subject, MessageSubscriber subscriber); |
| 37 | |
| 38 | /** |
| 39 | * Returns the set of subscribers for the specified message subject. |
| 40 | * |
| 41 | * @param subject message subject |
| 42 | * @return set of message subscribers |
| 43 | */ |
| 44 | Set<MessageSubscriber> getSubscribers(MessageSubject subject); |
| 45 | |
| 46 | } |