Package com.rabbitmq.stream
Interface Environment
-
- All Superinterfaces:
AutoCloseable
public interface Environment extends AutoCloseable
TheEnvironmentis the main entry point to a node or a cluster of nodes.ProducerandConsumerinstances are created from anEnvironmentinstance. AnEnvironmentcan also create and delete streams.Applications are supposed to use a single
Environmentinstance to interact with a cluster.Use
builder()to configure and create anEnvironmentinstance.Environmentinstances are expected to be thread-safe.- See Also:
EnvironmentBuilder
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static EnvironmentBuilderbuilder()Create a builder to configure and create anEnvironmentvoidclose()Close the environment and its resources.ConsumerBuilderconsumerBuilder()Create aConsumerBuilderto configure and create aConsumervoiddeleteStream(String stream)Delete a streamvoiddeleteSuperStream(String superStream)Delete a super stream.ProducerBuilderproducerBuilder()Create aProducerBuilderto configure and create aProducer.StreamStatsqueryStreamStats(String stream)Query statistics on a stream.StreamCreatorstreamCreator()Return aStreamCreatorto configure and create a stream.booleanstreamExists(String stream)Return whether a stream exists or not.
-
-
-
Method Detail
-
builder
static EnvironmentBuilder builder()
Create a builder to configure and create anEnvironment- Returns:
- the environment builder
- See Also:
EnvironmentBuilder
-
streamCreator
StreamCreator streamCreator()
Return aStreamCreatorto configure and create a stream.- Returns:
- the stream creator
- See Also:
StreamCreator
-
deleteStream
void deleteStream(String stream)
Delete a stream- Parameters:
stream- the stream to delete- Since:
- 0.15.0
-
deleteSuperStream
void deleteSuperStream(String superStream)
Delete a super stream.Requires RabbitMQ 3.13.0 or more.
- Parameters:
superStream- the super stream to delete
-
queryStreamStats
StreamStats queryStreamStats(String stream)
Query statistics on a stream.Requires RabbitMQ 3.11 or more.
- Parameters:
stream- the stream to get statistics from- Returns:
- statistics on the stream
- Throws:
UnsupportedOperationException- if the broker does not support this command
-
streamExists
boolean streamExists(String stream)
Return whether a stream exists or not.- Parameters:
stream- the stream to check the existence- Returns:
- true if stream exists, false if it does not exist
- Throws:
StreamException- if response code is different fromConstants.RESPONSE_CODE_OKorConstants.RESPONSE_CODE_STREAM_DOES_NOT_EXIST
-
producerBuilder
ProducerBuilder producerBuilder()
Create aProducerBuilderto configure and create aProducer.- Returns:
- the producer builder
- See Also:
ProducerBuilder
-
consumerBuilder
ConsumerBuilder consumerBuilder()
Create aConsumerBuilderto configure and create aConsumer- Returns:
- the consumer builder
- See Also:
ConsumerBuilder
-
close
void close()
Close the environment and its resources.- Specified by:
closein interfaceAutoCloseable
-
-