roger v1.0.0 Roger.Partition

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.

Summary

Functions

Reconfigure the given Roger partition

Start a Roger partition

Stop the given Roger partition

Types

queue_def()
queue_def :: {id :: String.t, max_workers :: non_neg_integer}

Functions

reconfigure(id, queues)
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.

start(id, queues)
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.

stop(id)
stop(id :: String.t) :: :ok | {:error, :not_running}

Stop the given Roger partition