Interface Peer
Represents a DataSource peer.
You do not have to implement this interface yourself. Peer
instances will be
retrieved from classes such as RequestEvent
or
DiscardEvent
, which will be passed to your implementation
of DataProvider
via the
DataProvider.onRequest(com.caplin.datasource.publisher.RequestEvent)
and
DataProvider.onDiscard(com.caplin.datasource.publisher.DiscardEvent)
methods.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Invoked when the DataSource is stopped.int
getIndex()
Gets the index of this peer.getLabel()
Gets the label of this peer.default String
int
Gets the current number of queued messages on the peer.getName()
Gets the name of this peer.Gets the status that the peer has changed state to.void
Stops this peer from making connections to its remote peer.void
Allows this peer to make connections to its remote peer.void
shutdown()
Invoked when this peer is dynamic and is removed.
-
Method Details
-
getIndex
int getIndex()Gets the index of this peer.
Generally a DataSource application should not care about the index of the peer. However, the index does provide a unique identifier of the peer whilst the DataSource application is running.
- Returns:
- The index.
-
getName
String getName()Gets the name of this peer. This is the name of the peer that the DataSource application is connected to.
It is possible for the name of the peer to change - the name returned here is provided by the remote peer which is user configurable on the remote peer.
- Returns:
- The name.
-
getLabel
String getLabel()Gets the label of this peer. This is the label of the peer that the DataSource application is connected to.
It is possible for the label of the peer to change - the label returned here is provided by the remote peer which is user configurable on the remote peer.
- Returns:
- The name.
-
setStatusUp
void setStatusUp()Allows this peer to make connections to its remote peer. -
setStatusDown
void setStatusDown()Stops this peer from making connections to its remote peer.
If the remote peer is connected, this method disconnects it.
-
getPeerStatus
PeerStatus getPeerStatus()Gets the status that the peer has changed state to.- Returns:
- The status.
-
getMessageQueueSize
int getMessageQueueSize()Gets the current number of queued messages on the peer.- Returns:
- The status.
-
shutdown
void shutdown()Invoked when this peer is dynamic and is removed. -
close
void close()Invoked when the DataSource is stopped. -
getLoggingId
-