public interface JetStreamManagement
Modifier and Type | Method and Description |
---|---|
ConsumerInfo |
addOrUpdateConsumer(java.lang.String streamName,
ConsumerConfiguration config)
Loads or creates a consumer.
|
StreamInfo |
addStream(StreamConfiguration config)
Loads or creates a stream.
|
boolean |
deleteConsumer(java.lang.String streamName,
java.lang.String consumer)
Deletes a consumer.
|
boolean |
deleteMessage(java.lang.String streamName,
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(java.lang.String streamName,
long seq,
boolean erase)
Deletes a message, optionally erasing the content of the message.
|
boolean |
deleteStream(java.lang.String streamName)
Deletes an existing stream.
|
AccountStatistics |
getAccountStatistics()
Gets the account statistics for the logged in account.
|
ConsumerInfo |
getConsumerInfo(java.lang.String streamName,
java.lang.String consumer)
Gets the info for an existing consumer.
|
java.util.List<java.lang.String> |
getConsumerNames(java.lang.String streamName)
Return a list of consumers by name
|
java.util.List<ConsumerInfo> |
getConsumers(java.lang.String streamName)
Return a list of ConsumerInfo objects.
|
MessageInfo |
getFirstMessage(java.lang.String streamName,
java.lang.String subject)
Get MessageInfo for the first message of the subject.
|
MessageInfo |
getLastMessage(java.lang.String streamName,
java.lang.String subject)
Get MessageInfo for the last message of the subject.
|
MessageInfo |
getMessage(java.lang.String streamName,
long seq)
Get MessageInfo for the message with the exact sequence in the stream.
|
MessageInfo |
getNextMessage(java.lang.String streamName,
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(java.lang.String streamName)
Gets the info for an existing stream.
|
StreamInfo |
getStreamInfo(java.lang.String streamName,
StreamInfoOptions options)
Gets the info for an existing stream, and include subject or deleted details
as defined by StreamInfoOptions.
|
java.util.List<java.lang.String> |
getStreamNames()
Get the names of all streams.
|
java.util.List<java.lang.String> |
getStreamNames(java.lang.String subjectFilter)
Get a list of stream names that have subjects matching the subject filter.
|
java.util.List<StreamInfo> |
getStreams()
Return a list of StreamInfo objects.
|
java.util.List<StreamInfo> |
getStreams(java.lang.String subjectFilter)
Return a list of StreamInfo objects that have subjects matching the filter.
|
PurgeResponse |
purgeStream(java.lang.String streamName)
Purge stream messages
|
PurgeResponse |
purgeStream(java.lang.String streamName,
PurgeOptions options)
Purge messages for a specific subject
|
StreamInfo |
updateStream(StreamConfiguration config)
Updates an existing stream.
|
AccountStatistics getAccountStatistics() 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.lang.IllegalArgumentException
- the server is not JetStream enabledStreamInfo addStream(StreamConfiguration config) throws java.io.IOException, JetStreamApiException
config
- the stream 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 datajava.lang.IllegalArgumentException
- the configuration is missing or invalidStreamInfo updateStream(StreamConfiguration config) throws java.io.IOException, JetStreamApiException
config
- the stream 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 datajava.lang.IllegalArgumentException
- the configuration is missing or invalidboolean deleteStream(java.lang.String streamName) throws java.io.IOException, JetStreamApiException
streamName
- the stream name 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 dataStreamInfo getStreamInfo(java.lang.String streamName) throws java.io.IOException, JetStreamApiException
streamName
- the stream name 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 dataStreamInfo getStreamInfo(java.lang.String streamName, StreamInfoOptions options) throws java.io.IOException, JetStreamApiException
streamName
- the stream name to use.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 dataPurgeResponse purgeStream(java.lang.String streamName) throws java.io.IOException, JetStreamApiException
streamName
- the stream name 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 dataPurgeResponse purgeStream(java.lang.String streamName, PurgeOptions options) throws java.io.IOException, JetStreamApiException
streamName
- the stream name to use.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 dataConsumerInfo addOrUpdateConsumer(java.lang.String streamName, ConsumerConfiguration config) throws java.io.IOException, JetStreamApiException
streamName
- name of the streamconfig
- 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 databoolean deleteConsumer(java.lang.String streamName, java.lang.String consumer) throws java.io.IOException, JetStreamApiException
streamName
- name of the streamconsumer
- 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 dataConsumerInfo getConsumerInfo(java.lang.String streamName, java.lang.String consumer) throws java.io.IOException, JetStreamApiException
streamName
- name of the streamconsumer
- the consumer name 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 datajava.util.List<java.lang.String> getConsumerNames(java.lang.String streamName) throws java.io.IOException, JetStreamApiException
streamName
- the name of the stream.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(java.lang.String streamName) throws java.io.IOException, JetStreamApiException
streamName
- the name of the stream.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> getStreamNames() 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<java.lang.String> getStreamNames(java.lang.String subjectFilter) throws java.io.IOException, JetStreamApiException
subjectFilter
- the subject. Wildcards are allowed.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<StreamInfo> getStreams() 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<StreamInfo> getStreams(java.lang.String subjectFilter) throws java.io.IOException, JetStreamApiException
subjectFilter
- the filter to limit the streams by subjects. Wildcards allowed.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(java.lang.String streamName, long seq) throws java.io.IOException, JetStreamApiException
streamName
- the name of the stream.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 streamName, java.lang.String subject) throws java.io.IOException, JetStreamApiException
streamName
- the name of the stream.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 streamName, java.lang.String subject) throws java.io.IOException, JetStreamApiException
streamName
- the name of the stream.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(java.lang.String streamName, long seq, java.lang.String subject) throws java.io.IOException, JetStreamApiException
streamName
- the name of the stream.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(java.lang.String streamName, long seq) throws java.io.IOException, JetStreamApiException
streamName
- name of the streamseq
- 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(java.lang.String streamName, long seq, boolean erase) throws java.io.IOException, JetStreamApiException
streamName
- name of the streamseq
- 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