Subscriber

public abstract class Subscriber extends AbstractChannel

Subscriber for messages of a specific type.

There can be many subscribers per message type.

Constructors

Link copied to clipboard
protected void Subscriber(ChannelId id)

Functions

Link copied to clipboard
public void addObserver(StreamObserver<ExternalMessage> observer)
Adds an observer to receive the subscription updates.
Link copied to clipboard
protected final void callObservers(ExternalMessage message)
Link copied to clipboard
public void close()
Link copied to clipboard
public boolean isStale()
Allows to understand whether this channel is stale and can be closed.
Link copied to clipboard
public Iterable<StreamObserver<ExternalMessage>> observers()
Obtains current observers registered in this instance of Subscriber which receive the subscription updates.
Link copied to clipboard
public void onMessage(ExternalMessage message)
Passes the given message to observers.
Link copied to clipboard
public void removeObserver(StreamObserver<ExternalMessage> observer)
Removes an existing observer and disconnects it from this subscription channel.

Inherited functions

Link copied to clipboard
public static ChannelId channelIdFor(TypeUrl messageType)
Converts the given message type into a ChannelId.
Link copied to clipboard
public ChannelId id()
Obtains the channel identifier.
Link copied to clipboard
public TypeUrl targetType()
Obtains the type of the messages transferred through this channel.