public interface Bus
Bus provides a publish-subscribe service where multiple applications
register for receiving messages of different types that they are interested.
To operate on a Bus, an application must get a handle to the
Bus using BusFactory.getBus(Class).
Application can then subscribe for the message types it is interested in
receiving notifications on the bus using
registerListener(Set, BusListener)
Application can push a message to the post(BusMessage).
Applications receives messages posted from then on, onto the Bus
via the registered BusListener.processBusMsg(BusMessage)
for all message types it has registered. When any application pushes a
message,all subscribers to that message type (including the application that
pushed the message, if it has subscribed) will be notified.
| Modifier and Type | Method and Description |
|---|---|
void |
ackMessage(long msgId,
BusListener listener)
Acknowledge for message received.
|
boolean |
changeMessageOwner(BusMessage msg,
BusListener listener)
Take ownership of an existing BusMessage.
|
void |
delete(long msgId)
Delete a Bus message.
|
List<BusMessage> |
getMessages(Set<Integer> msgTypes)
Get the list of messages of the specified types that are currently
posted on the Bus.
|
List<BusMessage> |
getMessagesByOwner(List<BusListenerId> appNameInst,
Set<Integer> msgTypes)
Get the list of messages of the specified types posted by given owners
on the Bus.
|
long |
post(BusMessage msg)
Push a message to the Bus
|
long |
post(BusMessage msg,
BusListener listener)
Push a message to the Bus.
|
void |
registerListener(Set<Integer> msgTypes,
BusListener listener)
Register listener for the message types on the Bus
Notifications will be sent to the listener for messages posted to the
Bus from then
|
void |
unregisterListener(BusListener listener)
Unregister listener for all message types on the Bus
No notifications will be sent to the listener for any messages posted to
the Bus from then on.
|
void |
unregisterListener(Set<Integer> msgTypes,
BusListener listener)
Unregister listener on the Bus for the specified message types.
|
void ackMessage(long msgId,
BusListener listener)
throws ServiceNotAvailableException,
InterruptedException
msgId - message ID to acknowledgelistener - Bus listener objectInterruptedException - Operation interrupted exceptionServiceNotAvailableException - Bus service is not upvoid registerListener(Set<Integer> msgTypes, BusListener listener)
msgTypes - message typeslistener - Bus listener objectvoid unregisterListener(Set<Integer> msgTypes, BusListener listener)
msgTypes - message typeslistener - Bus listener objectvoid unregisterListener(BusListener listener)
listener - Bus listener objectlong post(BusMessage msg) throws ServiceNotAvailableException, IOException, InterruptedException
msg - message to be pushedServiceNotAvailableException - Bus service is downInterruptedException - Operation interrupted exceptionIOException - IO Exception while data serializationlong post(BusMessage msg, BusListener listener) throws ServiceNotAvailableException, IOException, InterruptedException
msg - message to be pushedlistener - Bus listener objectServiceNotAvailableException - Bus service is downIOException - IO Exception while data serializationInterruptedException - Operation interrupted exceptionvoid delete(long msgId)
throws ServiceNotAvailableException,
InterruptedException
msgId - Bus message id to be deletedServiceNotAvailableException - Bus service is downInterruptedException - Operation interrupted exceptionList<BusMessage> getMessages(Set<Integer> msgTypes) throws ServiceNotAvailableException, InterruptedException
msgTypes - list of message types to be retrievedServiceNotAvailableException - Bus service is downInterruptedException - Operation interrupted exceptionList<BusMessage> getMessagesByOwner(List<BusListenerId> appNameInst, Set<Integer> msgTypes) throws ServiceNotAvailableException, InterruptedException
appNameInst - list of message owner's name and instancemsgTypes - list of message types to be retrievedServiceNotAvailableException - Bus service is downInterruptedException - Operation interrupted exceptionboolean changeMessageOwner(BusMessage msg, BusListener listener) throws ServiceNotAvailableException, InterruptedException
msg - message to change ownershiplistener - listener of the new ownertrue on success, false otherwiseServiceNotAvailableException - Bus service is downInterruptedException - Operation interrupted exceptionCopyright © 2014. All Rights Reserved.