public interface Message
The byte[] returned by getData() is not shared with any library code
and is safe to manipulate.
NOTICE: This interface is intended only to be implemented internally,
although since it is public it is technically available to anyone and
breaking changes should be avoided. For instance:
- Signatures should not be changed.
- If methods are added, a default implementation should be provided.
| Modifier and Type | Method and Description |
|---|---|
void |
ack()
ack acknowledges a JetStream messages received from a Consumer, indicating the message
should not be received again later.
|
void |
ackSync(java.time.Duration timeout)
ack acknowledges a JetStream messages received from a Consumer, indicating the message
should not be received again later.
|
default long |
consumeByteCount()
The number of bytes the server counts for the message when calculating byte counts.
|
Connection |
getConnection()
the connection which can be used for publishing, will be null if the subscription is null
|
byte[] |
getData()
the data from the message
|
io.nats.client.impl.Headers |
getHeaders()
the headers object for the message
|
java.lang.String |
getReplyTo()
the subject the application is expected to send a reply message on
|
java.lang.String |
getSID()
the id associated with the subscription, used by the connection when processing an incoming
message from the server
|
io.nats.client.support.Status |
getStatus()
the status object message if this is a status message
|
java.lang.String |
getSubject()
the subject that this message was sent to
|
Subscription |
getSubscription()
the Subscription associated with this message, may be owned by a Dispatcher
|
boolean |
hasHeaders()
true if there are headers
|
void |
inProgress()
Indicates that this message is being worked on and reset redelivery timer in the server.
|
boolean |
isJetStream()
Checks if a message is from JetStream or is a standard message.
|
boolean |
isStatusMessage()
true if there is status
|
boolean |
isUtf8mode()
Deprecated.
because the mode doesn't matter
if is utf8Mode
|
io.nats.client.impl.AckType |
lastAck()
the last ack that was done with this message
the last ack or null
|
io.nats.client.impl.NatsJetStreamMetaData |
metaData()
Gets the metadata associated with a JetStream message.
|
void |
nak()
nak acknowledges a JetStream message has been received but indicates that the message
is not completely processed and should be sent again later.
|
void |
nakWithDelay(java.time.Duration nakDelay)
nak acknowledges a JetStream message has been received but indicates that the message
is not completely processed and should be sent again later, after at least the delay amount.
|
void |
nakWithDelay(long nakDelayMillis)
nak acknowledges a JetStream message has been received but indicates that the message
is not completely processed and should be sent again later, after at least the delay amount.
|
void |
term()
term instructs the server to stop redelivery of this message without acknowledging it as
successfully processed.
|
java.lang.String getSubject()
java.lang.String getReplyTo()
boolean hasHeaders()
io.nats.client.impl.Headers getHeaders()
boolean isStatusMessage()
io.nats.client.support.Status getStatus()
byte[] getData()
@Deprecated boolean isUtf8mode()
Subscription getSubscription()
java.lang.String getSID()
Connection getConnection()
io.nats.client.impl.NatsJetStreamMetaData metaData()
io.nats.client.impl.AckType lastAck()
void ack()
void ackSync(java.time.Duration timeout)
throws java.util.concurrent.TimeoutException,
java.lang.InterruptedException
timeout - the duration to wait for an ack confirmationjava.util.concurrent.TimeoutException - if a timeout was specified and the NATS server does not return a responsejava.lang.InterruptedException - if the thread is interruptedvoid nak()
void nakWithDelay(java.time.Duration nakDelay)
nakDelay - tell the server how long to delay before processing the ackvoid nakWithDelay(long nakDelayMillis)
nakDelayMillis - tell the server how long to delay before processing the ackvoid term()
void inProgress()
boolean isJetStream()
default long consumeByteCount()