Class NamedConsumerStrategy

java.lang.Object
com.eventstore.dbclient.NamedConsumerStrategy

public class NamedConsumerStrategy extends Object
Named consumer strategies for use with persistent subscriptions.
  • Field Details

    • DISPATCH_TO_SINGLE

      public static final NamedConsumerStrategy DISPATCH_TO_SINGLE
      Distributes events to a single client until the buffer size is reached. After which the next client is selected in a round-robin style, and the process is repeated.
    • ROUND_ROBIN

      public static final NamedConsumerStrategy ROUND_ROBIN
      Distributes events to all client evenly. If the client buffer-size is reached, the client is ignored until events are (not) acknowledged.
    • PINNED

      public static final NamedConsumerStrategy PINNED
      For use with an indexing projection such as the system $by_category projection. EventStoreDB inspects event for its source stream id, hashing the id to one of 1024 buckets assigned to individual clients. When a client disconnects, its buckets are assigned to other clients. When a client connects, it is assigned some existing buckets. This naively attempts to maintain a balanced workload. The main goal of this strategy is to decrease the likelihood of concurrency and ordering issues while maintaining load balancing. This not a guarantee, and you should handle the usual ordering and concurrency issues.
  • Method Details

    • isDispatchToSingle

      public boolean isDispatchToSingle()
      Checks if it's a DispatchToSingle strategy.
    • isRoundRobin

      public boolean isRoundRobin()
      Checks if it's a RoundRobin strategy.
    • isPinned

      public boolean isPinned()
      Checks if it's a Pinned strategy.
    • isNamed

      public boolean isNamed(String named)
      Checks if the strategy's name matches the string passed as a parameter.
    • toString

      public String toString()
      Overrides:
      toString in class Object