roger v1.2.1 Roger.Partition View Source

Per-node partition registry

Roger implements multi-tenancy by dividing all its work between different “Partitions”. Each partition is identified by a unique ID. Partitions consist of a list of queues, which are defined by its type (an atom) and a max_workers value which sets the concurrency level. The RabbitMQ queue name is constructed of the partition ID + the queue type.

To spread out the work, partitions can be started in the cluster on multiple nodes. The partition’s queue configuration can be different between nodes - i.e. some node might be able to handle more concurrency than others.

Within the cluster, there is one global process (Roger.Partition.Global) which manages the partition’s state. In it, it manages job’s uniqueness, states of paused queues, et cetera.

Link to this section Summary

Functions

Reconfigure the given Roger partition

Start a Roger partition

Stop the given Roger partition

Link to this section Types

Link to this type queue_def() View Source
queue_def() :: {id :: String.t(), max_workers :: non_neg_integer()}

Link to this section Functions

Link to this function reconfigure(id, queues) View Source
reconfigure(id :: String.t(), queues :: [queue_def()]) ::
  :ok |
  {:error, :not_running}

Reconfigure the given Roger partition

Use this function to adjust the queues for the partition. The queues argument is complete: any queues that are not mentioned, are stopped and messages in them will no longer be processed on this node.

Link to this function start(id, queues) View Source
start(id :: String.t(), queues :: [queue_def()]) :: {:ok, pid()}

Start a Roger partition

Given a unique ID and a list of queues, starts the partition supervision structure. When the partition has already been started, this calls reconfigure/2 instead.

Link to this function stop(id) View Source
stop(id :: String.t()) :: :ok | {:error, :not_running}

Stop the given Roger partition