Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

 
MessageBus defines the interface of the message bus facility, it implements a simple publish/subscribe pattern, publishers and subscribers can linked by sharing a common topic,  topic can be in hierarchy mode, a subscriber at higher hierarchy mode can receive messages from all topics that are below. 

MessageBusBase

A simple message bus implementation

MessageHandler

...

in-memory message bus implementation. PublishScope defines two available scope value, PublishScope.LOCAL means to broadcast message to all subscribed components running within the local management server. PublishScope.GLOBAL means to publish messages to all management servers across the cluster.

Since majority of time to access internal message bus data structure will be READs, MessageBusBase uses a special MessageBusBase.Gate to implement Read/Write lock behave for the sake of performance in multi-threaded running environment. 

MessageHandler

Java annotation for subscriber to specify a message handler. Used together with MessageDispatcher. Message subscribers can declare a message handler in following pattern.

Code Block
class FooSubscriber {

    @MessageHandler(topic="Host")
    public void processHostMessage(String sender, String topic, Object args) {
    ...
}

Subscribers using this pattern can be written in POJO(Plain-Old-Java-Object) style, eliminate the needs to implement the MessageSubscriber interface. To register such object into message bus, we use a decoration object as following

Code Block
MessageDispatcher decoratedSubscriber = new MessageDispatcher(FooSubscriber);

_messageBus.subscriber("Host", decoratedSubscriber);

MessageDispatcher

For message subscriber to use to dispatch received messages to annotated message handlers

...

To detect interested messages on message bus.

2) Job facility

AsyncJobManagerImpl

...