T - the Publisher may only publish messages of this typepublic interface Publisher<T> extends TopicParticipant
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(PublisherListener<T> listener)
Add a new lifecycle listener to the
Publisher. |
boolean |
getLatchMode() |
int |
getNumberOfSubscribers()
Get the number of
Subscribers currently connected to the
Publisher. |
boolean |
hasSubscribers() |
T |
newMessage()
Create a new message.
|
void |
publish(T message)
Publishes a message.
|
void |
setLatchMode(boolean enabled) |
void |
shutdown()
Shuts down and unregisters the
Publisher using the default timeout
for PublisherListener.onShutdown(Publisher) callbacks. |
void |
shutdown(long timeout,
java.util.concurrent.TimeUnit unit)
Shuts down and unregisters the
Publisher. |
getTopicMessageType, getTopicNamevoid setLatchMode(boolean enabled)
enabled - true if published messages should be latched,
false otherwiseboolean getLatchMode()
true if published messages will be latched, false
otherwiseT newMessage()
void publish(T message)
Publisher has been associated with.message - the message to publishboolean hasSubscribers()
true if getNumberOfSubscribers() > 0, false
otherwiseint getNumberOfSubscribers()
Subscribers currently connected to the
Publisher.
This counts the number of Subscriber registered. If a
Subscriber does not shutdown properly it will not be unregistered
and thus will contribute to this count.
Subscribers currently connected to the
Publishervoid shutdown(long timeout,
java.util.concurrent.TimeUnit unit)
Publisher. Shutdown is delayed by at
most the specified timeout to allow
PublisherListener.onShutdown(Publisher) callbacks to complete.
PublisherListener.onShutdown(Publisher) callbacks are executed in
separate threads.
void shutdown()
Publisher using the default timeout
for PublisherListener.onShutdown(Publisher) callbacks.
PublisherListener.onShutdown(Publisher) callbacks are executed in
separate threads.
shutdown(long, TimeUnit)void addListener(PublisherListener<T> listener)
Publisher.listener - the PublisherListener to add