Feature uses features-parent as parent
[groupbasedpolicy.git] / renderers / opflex / src / main / java / org / opendaylight / groupbasedpolicy / renderer / opflex / jsonrpc / RpcBroker.java
1 /*
2  * Copyright (C) 2014 Cisco Systems, Inc.
3  *
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
7  *
8  * Authors : Thomas Bachman
9  */
10 package org.opendaylight.groupbasedpolicy.renderer.opflex.jsonrpc;
11
12 /**
13  * The {@link RpcBroker} provides a content-based pub/sub per RpcMessage
14  * type.  This allows clients to register for the messages they are interested
15  * in.
16  *
17  * @author tbachman
18  */
19 public interface RpcBroker {
20
21     /**
22      * The {@link RpcCallback} provides a callback interface for the
23      * {@link RpcBroker}. When the broker needs to publish a new
24      * {@link RpcMessage}, it invokes the callbacks that were
25      * registered for that message.
26      *
27      * @author tbachman
28      */
29     public interface RpcCallback {
30
31         /**
32          * Callback that's invoked when the {@link RpcMessage}
33          * request message is received
34          *
35          * @param endpoint The endpoint that received the messgae
36          * @param message The concrete {@link RpcMessage} received
37          */
38         public void callback(JsonRpcEndpoint endpoint, RpcMessage message);
39
40     }
41
42     /**
43      *
44      * Subscribe to a concrete {@link RpcMessage}
45      *
46      * @param message The concrete {@link RpcMessage} message to subscribe to
47      * @param callback The callback to invoke when the message is published
48      *
49      */
50     public void subscribe(RpcMessage message, RpcCallback callback);
51
52     /**
53      * Notification to call when a new {@link RpcMessage} request
54      * is received
55      *
56      * @param endpoint The endpoint that received this message
57      * @param message the concrete {@link RpcMessage}
58      */
59     public void publish(JsonRpcEndpoint endpoint, RpcMessage message);
60
61
62 }