Interface Peer
-
public interface Peer
Represents a DataSource peer.
You do not have to implement this interface yourself.
Peer
instances will be retrieved from classes such asRequestEvent
orDiscardEvent
, which will be passed to your implementation ofDataProvider
via theDataProvider.onRequest(com.caplin.datasource.publisher.RequestEvent)
andDataProvider.onDiscard(com.caplin.datasource.publisher.DiscardEvent)
methods.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
int
getIndex()
Gets the index of this peer.String
getLabel()
Gets the label of this peer.int
getMessageQueueSize()
Gets the current number of queued messages on the peer.String
getName()
Gets the name of this peer.PeerStatus
getPeerStatus()
Gets the status that the peer has changed state to.void
setStatusDown()
Stops this peer from making connections to its remote peer.void
setStatusUp()
Allows this peer to make connections to its remote peer.void
shutdown()
Shutdown the peer.
-
-
-
Method Detail
-
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()
Shutdown the peer.
-
close
void close()
-
-