Class SuperStreamBuilder
java.lang.Object
org.springframework.rabbit.stream.config.SuperStreamBuilder
Builds a Spring AMQP Super Stream using a fluent API.
Based on Streams documentation
- Since:
- 3.1
- Author:
- Sergei Kurenchuk, Gary Russell
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds a final Super Stream.initialClusterSize
(int count) Set initial replication factor for each partition.Set the maximum age retention per stream, which will remove the oldest data.maxLength
(long bytes) Set the maximum log size as the retention configuration for each stream, which will truncate the log based on the data size.maxSegmentSize
(long bytes) Set the maximum size limit for segment file.Set the stream name.partitions
(int partitions) Set the partitions number.routingKeyStrategy
(BiFunction<String, Integer, List<String>> routingKeyStrategy) Set a strategy to determine routing keys to use for the partitions.static SuperStreamBuilder
superStream
(String name) Creates a builder for Super Stream.static SuperStreamBuilder
superStream
(String name, int partitions) Creates a builder for Super Stream.withArgument
(String key, Object value) Set extra argument which is not covered by builder's methods.
-
Constructor Details
-
SuperStreamBuilder
public SuperStreamBuilder()
-
-
Method Details
-
superStream
Creates a builder for Super Stream.- Parameters:
name
- stream name- Returns:
- the builder
-
superStream
Creates a builder for Super Stream.- Parameters:
name
- stream namepartitions
- partitions number- Returns:
- the builder
-
maxAge
Set the maximum age retention per stream, which will remove the oldest data.- Parameters:
maxAge
- valid units: Y, M, D, h, m, s. For example: "7D" for a week- Returns:
- the builder
-
maxLength
Set the maximum log size as the retention configuration for each stream, which will truncate the log based on the data size.- Parameters:
bytes
- the max total size in bytes- Returns:
- the builder
-
maxSegmentSize
Set the maximum size limit for segment file.- Parameters:
bytes
- the max segments size in bytes- Returns:
- the builder
-
initialClusterSize
Set initial replication factor for each partition.- Parameters:
count
- number of nodes per partition- Returns:
- the builder
-
withArgument
Set extra argument which is not covered by builder's methods.- Parameters:
key
- argument namevalue
- argument value- Returns:
- the builder
-
name
Set the stream name.- Parameters:
name
- the stream name.- Returns:
- the builder
-
partitions
Set the partitions number.- Parameters:
partitions
- the partitions number- Returns:
- the builder
-
routingKeyStrategy
public SuperStreamBuilder routingKeyStrategy(BiFunction<String, Integer, List<String>> routingKeyStrategy) Set a strategy to determine routing keys to use for the partitions. The first parameter is the queue name, the second the number of partitions, the returned list must have a size equal to the partitions.- Parameters:
routingKeyStrategy
- the strategy- Returns:
- the builder
-
build
Builds a final Super Stream.- Returns:
- the Super Stream instance
-