
public class JGroupsBusMessagingLayer extends Object implements BusMessagingLayer, HasClusterDisconnectionNotifications
MessagingLayer.| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_DISPATCHER |
static String |
DEFAULT_UDP_PROTOCOL |
| Modifier and Type | Method and Description |
|---|---|
void |
addClusterMembershipListener(ClusterDisconnectionsListener listener) |
void |
addMessageListener(String agentName,
BusMessageForwarder forwarder,
Bus... buses)
Sets up callback configuration for a topic and subsystem.
|
void |
close()
Close the Transport Layer.
|
void |
closeFor(String agentName,
Bus... buses)
close entry points for a bus for an agent.
|
void |
connect(MessagingAccessLayer accessLayer)
Connects a MessagingAccessLayer object on the buses by using its name as a
unique identifier.
|
void |
disconnect(MessagingAccessLayer accessLayers)
Remove the entry point to the buses for the given MessagingAccessLayer.
|
Set<String> |
getRegisteredLocalAgents(Bus... buses)
Get the list of local agents currently connected to the buses.
|
void |
register(String agentName,
Bus... buses)
Creates low level communication entry points for a subsystem.
|
void |
removeClusterMembershipListener(ClusterDisconnectionsListener listener) |
void |
removeMessageListener(String agentName,
BusMessageForwarder forwarder,
Bus... buses)
Removes a message listener from the forwarder list.
|
<T extends BusMessage> |
sendMessage(String senderAgent,
Bus bus,
T message)
Sends a message on a bus for a given MessagingAccessLayer.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetRegisteredLocalAgents, parseDestinationclearpublic static final String DEFAULT_UDP_PROTOCOL
public static final String DEFAULT_DISPATCHER
public void close()
throws IOException
BusMessagingLayerclose in interface Closeableclose in interface AutoCloseableclose in interface BusMessagingLayerIOExceptionpublic void connect(MessagingAccessLayer accessLayer) throws DuplicateAgentNameException, IOException
MessagingLayerconnect in interface MessagingLayeraccessLayer - The layer to be connected on the busesDuplicateAgentNameException - if the name of MessagingAccessLayer is not unique on the busesIOExceptionpublic void disconnect(MessagingAccessLayer accessLayers)
MessagingLayerdisconnect in interface MessagingLayeraccessLayers - The layer to be connected on the busespublic void addClusterMembershipListener(ClusterDisconnectionsListener listener)
addClusterMembershipListener in interface HasClusterDisconnectionNotificationspublic void removeClusterMembershipListener(ClusterDisconnectionsListener listener)
removeClusterMembershipListener in interface HasClusterDisconnectionNotificationspublic <T extends BusMessage> void sendMessage(String senderAgent, Bus bus, T message)
MessagingLayersendMessage in interface MessagingLayerT - the type of message sent on the bussenderAgent - provides the name as the origin of the messagebus - the bus on which to send the messagemessage - the messagepublic Set<String> getRegisteredLocalAgents(Bus... buses)
BusMessagingLayergetRegisteredLocalAgents in interface BusMessagingLayerbuses - The buses for which we are seeking the connected agents.
If empty it will report agents connected to all buses.public void register(String agentName, Bus... buses) throws IOException, DuplicateAgentNameException
BusMessagingLayerregister in interface BusMessagingLayeragentName - name of the sending/receiving point as will be known by transport
null or empty string means that the local agent will receive all messages
(whatever the destination of the message is : "anonymous agent")
if an agent with same name is already locally registered for these buses nothing happens (the call is
idempotent), but if another agent has the same name on the network a DuplicateBusNameException
may be fired (this is an optional behaviour) but this exception is reported only to the corresponding
BusMembershipListenerbuses - list of buses we want to connect to, if empty connects to all busesIOException - if connection impossible,DuplicateAgentNameExceptionpublic void addMessageListener(String agentName, BusMessageForwarder forwarder, Bus... buses)
BusMessagingLayeraddMessageListener in interface BusMessagingLayeragentName - if empty adds a forwarder to "anonymous" agent that receives all messagesforwarder - code that handles the incoming messagesbuses - if empty the forwarder listens to all buses.public void removeMessageListener(String agentName, BusMessageForwarder forwarder, Bus... buses)
BusMessagingLayerremoveMessageListener in interface BusMessagingLayerbuses - if empty forwarder is removed from all busespublic void closeFor(String agentName, Bus... buses)
BusMessagingLayercloseFor in interface BusMessagingLayeragentName - (if empty voids the "anonymous" agent capabilitiesbuses - if empty all registered buses for the agent will be closedCopyright © 2021 LSST. All rights reserved.