View Source MongoQueue.Config (MongoQueue v0.0.1)

Configuration for a queue.

struct-properties

Struct Properties

  • conn - A MongoDB connection, from the mongodb_driver package.
  • collection - The name of the collection to use for the queue.
  • visibility_timeout - The amount of time in seconds that a message is invisible after it has been received from the queue.
  • delay - The amount of time in seconds that a message is delayed before it is available to be received from the queue.

Link to this section Summary

Functions

Merges the given options into the configuration.

Creates a new queue configuration.

Link to this section Types

@type t() :: %MongoQueue.Config{
  collection: binary(),
  conn: Mongo.conn(),
  delay: non_neg_integer(),
  visibility_timeout: non_neg_integer()
}

Link to this section Functions

@spec merge(t(), Keyword.t() | map()) :: t()

Merges the given options into the configuration.

examples

Examples

iex> MongoQueue.Config.new(conn, "my_queue") |> MongoQueue.Config.merge(visibility_timeout: 60)
%MongoQueue.Config{
  conn: #PID<0.123.0>,
  collection: "my_queue",
  visibility_timeout: 60,
  delay: 0
}
Link to this function

new(conn, collection, opts \\ [])

View Source
@spec new(Mongo.conn(), binary(), Keyword.t()) :: t()

Creates a new queue configuration.

examples

Examples

iex> MongoQueue.Config.new(conn, "my_queue")
%MongoQueue.Config{
  conn: #PID<0.123.0>,
  collection: "my_queue",
  visibility_timeout: 30,
  delay: 0
}