public class StreamManagerClientImpl extends Object implements StreamManagerClient
Modifier and Type | Method and Description |
---|---|
long |
appendMessage(String stream,
byte[] data)
Append a message into the specified message stream.
|
void |
close()
Close the client socket.
|
void |
createMessageStream(MessageStreamDefinition definition)
Create a message stream with a given definition.
|
void |
deleteMessageStream(String stream)
Delete a message stream, including the data.
|
MessageStreamInfo |
describeMessageStream(String stream)
Describe a message stream to get metadata including the stream's definition, size, and exporter statuses.
|
List<String> |
listStreams()
List the streams in StreamManager.
|
List<Message> |
readMessages(String stream,
ReadMessagesOptions options)
Read message(s) from a chosen stream with options.
|
void |
updateMessageStream(MessageStreamDefinition definition)
Updates a message stream with a given definition.
|
public void createMessageStream(MessageStreamDefinition definition) throws StreamManagerException
createMessageStream
in interface StreamManagerClient
definition
- the message stream definitionStreamManagerException
- StreamManagerExceptionpublic void updateMessageStream(MessageStreamDefinition definition) throws StreamManagerException
updateMessageStream
in interface StreamManagerClient
definition
- the message stream definitionStreamManagerException
- StreamManagerExceptionpublic void deleteMessageStream(String stream) throws StreamManagerException
deleteMessageStream
in interface StreamManagerClient
stream
- stream nameStreamManagerException
- StreamManagerExceptionpublic MessageStreamInfo describeMessageStream(String stream) throws StreamManagerException
describeMessageStream
in interface StreamManagerClient
stream
- stream nameStreamManagerException
- StreamManagerExceptionpublic long appendMessage(String stream, byte[] data) throws StreamManagerException
appendMessage
in interface StreamManagerClient
stream
- The name of the stream.data
- The binary payload of the message.StreamManagerException
- StreamManagerExceptionpublic List<Message> readMessages(String stream, ReadMessagesOptions options) throws StreamManagerException
Default options used when reading from the stream: desiredStartSequenceNumber: 0, minMessageCount: 1, maxMessageCount: 1, readTimeoutMillis: 0 // Where 0 here represents that the server will immediately return the messages // or an exception if there were not enough messages available.
If desiredStartSequenceNumber is specified in the options and is less than the current beginning of the stream, returned messages will start at the beginning of the stream and not necessarily the desiredStartSequenceNumber.
readMessages
in interface StreamManagerClient
stream
- the name of the stream.options
- the options of readMessages() operation.StreamManagerException
- if any error is returned from the serverpublic List<String> listStreams() throws StreamManagerException
listStreams
in interface StreamManagerClient
StreamManagerException
- if any error is returned from the server.public void close()
close
in interface AutoCloseable