public interface StreamContext
Modifier and Type | Method and Description |
---|---|
OrderedConsumerContext |
createOrderedConsumer(OrderedConsumerConfiguration config)
Create an ordered consumer context for the context's stream.
|
ConsumerContext |
createOrUpdateConsumer(ConsumerConfiguration config)
Management function to create or update a consumer on this stream.
|
boolean |
deleteConsumer(java.lang.String consumerName)
Management function to deletes a consumer.
|
boolean |
deleteMessage(long seq)
Deletes a message, overwriting the message data with garbage
This can be considered an expensive (time-consuming) operation, but is more secure.
|
boolean |
deleteMessage(long seq,
boolean erase)
Deletes a message, optionally erasing the content of the message.
|
ConsumerContext |
getConsumerContext(java.lang.String consumerName)
Get a consumer context for the context's stream and specific named consumer.
|
ConsumerInfo |
getConsumerInfo(java.lang.String consumerName)
Gets the info for an existing consumer.
|
java.util.List<java.lang.String> |
getConsumerNames()
Return a list of consumers by name
|
java.util.List<ConsumerInfo> |
getConsumers()
Return a list of ConsumerInfo objects.
|
MessageInfo |
getFirstMessage(java.lang.String subject)
Get MessageInfo for the first message of the subject.
|
MessageInfo |
getLastMessage(java.lang.String subject)
Get MessageInfo for the last message of the subject.
|
MessageInfo |
getMessage(long seq)
Get MessageInfo for the message with the exact sequence in the stream.
|
MessageInfo |
getNextMessage(long seq,
java.lang.String subject)
Get MessageInfo for the message of the message sequence
is equal to or greater the requested sequence for the subject.
|
StreamInfo |
getStreamInfo()
Gets information about the stream for this context.
|
StreamInfo |
getStreamInfo(StreamInfoOptions options)
Gets information about the stream for this context.
|
java.lang.String |
getStreamName()
Gets the stream name that was used to create the context.
|
PurgeResponse |
purge()
Purge stream messages
|
PurgeResponse |
purge(PurgeOptions options)
Purge messages for a specific subject
|
java.lang.String getStreamName()
StreamInfo getStreamInfo() throws java.io.IOException, JetStreamApiException
java.io.IOException
- covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException
- the request had an error related to the data,
most likely the stream has been removed since the context was created.StreamInfo getStreamInfo(StreamInfoOptions options) throws java.io.IOException, JetStreamApiException
options
- the stream info options. If null, request will not return any optional data.java.io.IOException
- covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException
- the request had an error related to the data,
most likely the stream has been removed since the context was created.PurgeResponse purge() throws java.io.IOException, JetStreamApiException
java.io.IOException
- covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException
- the request had an error related to the dataPurgeResponse purge(PurgeOptions options) throws java.io.IOException, JetStreamApiException
options
- the purge optionsjava.io.IOException
- covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException
- the request had an error related to the dataConsumerContext getConsumerContext(java.lang.String consumerName) throws java.io.IOException, JetStreamApiException
consumerName
- the name of the consumerjava.io.IOException
- covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException
- the request had an error related to the dataConsumerContext createOrUpdateConsumer(ConsumerConfiguration config) throws java.io.IOException, JetStreamApiException
config
- the consumer configuration to use.java.io.IOException
- covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException
- the request had an error related to the dataOrderedConsumerContext createOrderedConsumer(OrderedConsumerConfiguration config) throws java.io.IOException, JetStreamApiException
config
- the configuration for the ordered consumerjava.io.IOException
- covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException
- the request had an error related to the databoolean deleteConsumer(java.lang.String consumerName) throws java.io.IOException, JetStreamApiException
consumerName
- the name of the consumer.java.io.IOException
- covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException
- the request had an error related to the data, for instance the consumer does not exist.ConsumerInfo getConsumerInfo(java.lang.String consumerName) throws java.io.IOException, JetStreamApiException
consumerName
- the name of the consumer.java.io.IOException
- covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException
- the request had an error related to the datajava.util.List<java.lang.String> getConsumerNames() throws java.io.IOException, JetStreamApiException
java.io.IOException
- covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException
- the request had an error related to the datajava.util.List<ConsumerInfo> getConsumers() throws java.io.IOException, JetStreamApiException
java.io.IOException
- covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException
- the request had an error related to the dataMessageInfo getMessage(long seq) throws java.io.IOException, JetStreamApiException
seq
- the sequence number of the messagejava.io.IOException
- covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException
- the request had an error related to the dataMessageInfo getLastMessage(java.lang.String subject) throws java.io.IOException, JetStreamApiException
subject
- the subject to get the last message for.java.io.IOException
- covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException
- the request had an error related to the dataMessageInfo getFirstMessage(java.lang.String subject) throws java.io.IOException, JetStreamApiException
subject
- the subject to get the first message for.java.io.IOException
- covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException
- the request had an error related to the dataMessageInfo getNextMessage(long seq, java.lang.String subject) throws java.io.IOException, JetStreamApiException
seq
- the first possible sequence number of the messagesubject
- the subject to get the next message for.java.io.IOException
- covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException
- the request had an error related to the databoolean deleteMessage(long seq) throws java.io.IOException, JetStreamApiException
seq
- the sequence number of the messagejava.io.IOException
- covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException
- the request had an error related to the databoolean deleteMessage(long seq, boolean erase) throws java.io.IOException, JetStreamApiException
seq
- the sequence number of the messageerase
- whether to erase the message (overwriting with garbage) or only mark it as erased.java.io.IOException
- covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException
- the request had an error related to the data