T
- the Subscriber
may only subscribe to messages of this typepublic interface Subscriber<T> extends TopicParticipant
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
TOPIC_MESSAGE_TYPE_WILDCARD
The message type given when a
Subscriber chooses not to commit to a
specific message type. |
Modifier and Type | Method and Description |
---|---|
void |
addMessageListener(org.ros.message.MessageListener<T> messageListener)
Adds a
MessageListener with a limit of 1. |
void |
addMessageListener(org.ros.message.MessageListener<T> messageListener,
int limit)
Adds a
MessageListener to be called when new messages are received. |
void |
addSubscriberListener(SubscriberListener<T> listener)
Add a new lifecycle listener to the subscriber.
|
boolean |
getLatchMode() |
void |
shutdown()
Shuts down and unregisters the
Subscriber using the default timeout
for SubscriberListener.onShutdown(Subscriber) callbacks. |
void |
shutdown(long timeout,
java.util.concurrent.TimeUnit unit)
Shuts down and unregisters the
Subscriber . |
getTopicMessageType, getTopicName
static final java.lang.String TOPIC_MESSAGE_TYPE_WILDCARD
Subscriber
chooses not to commit to a
specific message type.void addMessageListener(org.ros.message.MessageListener<T> messageListener, int limit)
MessageListener
to be called when new messages are received.
The MessageListener
will be executed serially in its own thread. If
the MessageListener
processes new messages slower than they arrive,
new messages will be queued up to the specified limit. Older messages are
removed from the buffer when the buffer limit is exceeded.
messageListener
- this MessageListener
will be called when new messages are
receivedlimit
- the maximum number of messages to buffervoid addMessageListener(org.ros.message.MessageListener<T> messageListener)
MessageListener
with a limit of 1.void shutdown(long timeout, java.util.concurrent.TimeUnit unit)
Subscriber
. using the default
timeout Shutdown is delayed by at most the specified timeout to allow
SubscriberListener.onShutdown(Subscriber)
callbacks to complete.
SubscriberListener.onShutdown(Subscriber)
callbacks are executed in
separate threads.
void shutdown()
Subscriber
using the default timeout
for SubscriberListener.onShutdown(Subscriber)
callbacks.
SubscriberListener.onShutdown(Subscriber)
callbacks are executed in
separate threads.
shutdown(long, TimeUnit)
void addSubscriberListener(SubscriberListener<T> listener)
listener
- The listener to add.boolean getLatchMode()
true
if the Publisher
of this Subscriber
's
topic is latched, false
otherwise