blob: 87ed221542e1ac63f5699ca1f0d59801b4eaab1a [file] [log] [blame]
tom1d416c52014-09-29 20:55:24 -07001package org.onlab.onos.store.cluster.messaging;
2
3import org.onlab.onos.cluster.NodeId;
4
5import java.util.Set;
6
7/**
8 * Service for assisting communications between controller cluster nodes.
9 */
10public 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}