Class ConsumerGroupNode

java.lang.Object
org.acemq.workloads.scenario.ConsumerGroupNode
All Implemented Interfaces:
Node

public final class ConsumerGroupNode extends Object implements Node
The consumers on one queue.

Switching this off is not the same as removing it: the queue keeps filling and the run measures what a backlog costs, which is usually the question somebody had.

  • Method Details

    • concurrency

      public ConsumerGroupNode concurrency(int concurrency)
      Parameters:
      concurrency - how many consumers on this queue
      Returns:
      this group
    • prefetch

      public ConsumerGroupNode prefetch(int prefetch)
      How many unacknowledged messages each consumer may hold.

      The number most often wrong in production, in both directions: too low and a consumer waits a round trip between messages; too high and one consumer takes work it cannot get through while others idle. Measuring is the only way to know which side you are on.

      Parameters:
      prefetch - the window
      Returns:
      this group
    • handlerTime

      public ConsumerGroupNode handlerTime(Duration handlerTime)
      Parameters:
      handlerTime - how long the handler pretends to work for
      Returns:
      this group
    • failureRate

      public ConsumerGroupNode failureRate(double fraction)
      Parameters:
      fraction - how often the handler throws, from 0 to 1
      Returns:
      this group
    • enabled

      public ConsumerGroupNode enabled(boolean enabled)
      Parameters:
      enabled - whether these consumers run
      Returns:
      this group
    • none

      public ConsumerGroupNode none()
      Returns:
      this group, switched off, so the queue grows
    • retry

      public ConsumerGroupNode retry(org.acemq.amqp.api.RetryPolicy policy)
      Retries failures on the library's ladder; see ConsumerSpec.retry.
      Parameters:
      policy - the schedule, or null to dead-letter a failure on its first attempt
      Returns:
      this node
    • retry

      public org.acemq.amqp.api.RetryPolicy retry()
      Returns:
      the retry policy, or null
    • saga

      public ConsumerGroupNode saga(SagaLoad load)
      Runs a saga for every message; see ConsumerSpec.saga.
      Parameters:
      load - the saga's shape, or null for none
      Returns:
      this node
    • saga

      public SagaLoad saga()
      Returns:
      the saga, or null
    • pipeline

      public ConsumerGroupNode pipeline(String name, List<PipelineStage> steps)
      Consumes through a pipeline whose first step's queue is this one; see ConsumerSpec.pipeline(java.util.List). The queue's name must be {name}.{first step}, which is the queue the library declares for it.
      Parameters:
      name - the pipeline's name, which is also its exchange
      steps - the steps, in order, or empty for none
      Returns:
      this node
    • pipelineName

      public String pipelineName()
      Returns:
      the pipeline's name, or null
    • pipeline

      public List<PipelineStage> pipeline()
      Returns:
      the pipeline's steps, empty when there is none
    • name

      public String name()
      Specified by:
      name in interface Node
      Returns:
      what this node is called
    • queueName

      public String queueName()
      Returns:
      the queue these consumers read
    • concurrency

      public int concurrency()
    • prefetch

      public int prefetch()
    • handlerTime

      public Duration handlerTime()
    • failureRate

      public double failureRate()
    • isEnabled

      public boolean isEnabled()
      Specified by:
      isEnabled in interface Node
      Returns:
      whether it takes part in the run
    • toString

      public String toString()
      Overrides:
      toString in class Object