Package com.rabbitmq.stream
Interface Environment
- All Superinterfaces:
AutoCloseable
The
Environment
is the main entry point to a node or a cluster of nodes. Producer
and Consumer
instances are created from an Environment
instance. An Environment
can also create and delete streams.
Applications are supposed to use a single Environment
instance to interact with a
cluster.
Use builder()
to configure and create an Environment
instance.
Environment
instances are expected to be thread-safe.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic EnvironmentBuilder
builder()
Create a builder to configure and create anEnvironment
void
close()
Close the environment and its resources.Create aConsumerBuilder
to configure and create aConsumer
void
deleteStream
(String stream) Delete a streamvoid
deleteSuperStream
(String superStream) Delete a super stream.Create aProducerBuilder
to configure and create aProducer
.queryStreamStats
(String stream) Query statistics on a stream.Return aStreamCreator
to configure and create a stream.boolean
streamExists
(String stream) Return whether a stream exists or not.
-
Method Details
-
builder
Create a builder to configure and create anEnvironment
- Returns:
- the environment builder
- See Also:
-
streamCreator
StreamCreator streamCreator()Return aStreamCreator
to configure and create a stream.- Returns:
- the stream creator
- See Also:
-
deleteStream
Delete a stream- Parameters:
stream
- the stream to delete- Since:
- 0.15.0
-
deleteSuperStream
Delete a super stream.Requires RabbitMQ 3.13.0 or more.
- Parameters:
superStream
- the super stream to delete
-
queryStreamStats
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
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_OK
orConstants.RESPONSE_CODE_STREAM_DOES_NOT_EXIST
-
producerBuilder
ProducerBuilder producerBuilder()Create aProducerBuilder
to configure and create aProducer
.- Returns:
- the producer builder
- See Also:
-
consumerBuilder
ConsumerBuilder consumerBuilder()Create aConsumerBuilder
to configure and create aConsumer
- Returns:
- the consumer builder
- See Also:
-
close
void close()Close the environment and its resources.- Specified by:
close
in interfaceAutoCloseable
-