Class SuperStreamBuilder

java.lang.Object
org.springframework.rabbit.stream.config.SuperStreamBuilder

public class SuperStreamBuilder extends Object
Builds a Spring AMQP Super Stream using a fluent API. Based on Streams documentation
Since:
3.1
Author:
Sergei Kurenchuk, Gary Russell
  • Constructor Details

    • SuperStreamBuilder

      public SuperStreamBuilder()
  • Method Details

    • superStream

      public static SuperStreamBuilder superStream(String name)
      Creates a builder for Super Stream.
      Parameters:
      name - stream name
      Returns:
      the builder
    • superStream

      public static SuperStreamBuilder superStream(String name, int partitions)
      Creates a builder for Super Stream.
      Parameters:
      name - stream name
      partitions - partitions number
      Returns:
      the builder
    • maxAge

      public SuperStreamBuilder maxAge(String 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

      public SuperStreamBuilder 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.
      Parameters:
      bytes - the max total size in bytes
      Returns:
      the builder
    • maxSegmentSize

      public SuperStreamBuilder maxSegmentSize(long bytes)
      Set the maximum size limit for segment file.
      Parameters:
      bytes - the max segments size in bytes
      Returns:
      the builder
    • initialClusterSize

      public SuperStreamBuilder initialClusterSize(int count)
      Set initial replication factor for each partition.
      Parameters:
      count - number of nodes per partition
      Returns:
      the builder
    • withArgument

      public SuperStreamBuilder withArgument(String key, Object value)
      Set extra argument which is not covered by builder's methods.
      Parameters:
      key - argument name
      value - argument value
      Returns:
      the builder
    • name

      public SuperStreamBuilder name(String name)
      Set the stream name.
      Parameters:
      name - the stream name.
      Returns:
      the builder
    • partitions

      public SuperStreamBuilder partitions(int 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

      public SuperStream build()
      Builds a final Super Stream.
      Returns:
      the Super Stream instance