SDN Controller Programming Guide

68
Distributed Bus
In distributed environment applications tend to communicate with each other. Applications might
be co-located on the same controller node or they may exist on different nodes of the same
controller cluster. Bus infrastructure provides a way to accomplish this kind of distributed
communication mechanism. Note that communication can occur between the nodes of a controller
cluster and not across the controller cluster nodes.
Distributed Bus provides publish-subscribe system where several applications on different controller
nodes can register for various types of bus messages, send and receives messages without
worrying about delivery failures or out of order delivery. When an application pushes a message,
all the subscribers to that message type are notified through Bus irrespective of their location in the
controller cluster.
Distributed Bus provides support for 3 types of messages:
NO_ACK message
ONE_ACK messages
ALL_ACK messages
With NO_ACK type of messages, message post is successful as soon as the message is written
onto the bus, not caring about listeners receiving the message and processing it. With ONE_ACK
and ALL_ACK type of messages, registered listeners of the message are expected to acknowledge
the receipt of the message.
While posting ONE_ACK or ALL_ACK message, application need to register a notification
handler for the message delivery status processing. ONE_ACK message status listener is invoked
with success response if at least 1 listener responds to the message receipt. With ALL_ACK
message all the registered listeners are expected to ACK. Message generating application is
notified of the ACK status along with the list of listeners ACKed/NON-ACKed. Listener signifies
an application instance that registered for the specific ONE_ACK/ALL_ACK message type. In case
of ONE_ACK and ALL_ACK messages, If the desired number of listeners do not ack, timeout
occurs and failure is notified to the sender along with the listener list.
Applications can make use of the methods exposed by the following interfaces to work with
Distributed Bus.
HAService extends BusFactory interface and hence methods of this interface shall be accessed via
HAService in the HP VAN SDN Controller environment.
BusFactory Interfaceacts as a book keeper for various types of bus types. A bus type can
be created or queried through the methods of this interface.
Bus Interfaceprovides the methods to operate on a specific bus type. Using this interface
methods an application can perform operations like post a message, read messages, delete a
message, register/unregister a listener, acknowledge a ONE_ACK/ALL_ACK message etc.,
BusListener Interfaceneeds to be implemented by the bus message listener application.
While registering for bus messages, application needs to pass the object that implements
BusListener interface. On seeing a bus message of application interest, method of the registered
listener busListener.processBusMessage (BusMessage) is invoked by Bus infrastructure. The order of
notification depends on the priority level of the listener (as per BusListener.getListenerPriority()).
Listener with lower priority value gets notified first.