amqp-worker-2.0.0: Type-safe AMQP workers
Safe HaskellSafe-Inferred
LanguageHaskell2010

Network.AMQP.Worker.Queue

Synopsis

Documentation

data Queue msg Source #

A queue is an inbox for messages to be delivered

Constructors

Queue (Key Bind msg) QueueName 

Instances

Instances details
Show (Queue msg) Source # 
Instance details

Defined in Network.AMQP.Worker.Queue

Methods

showsPrec :: Int -> Queue msg -> ShowS #

show :: Queue msg -> String #

showList :: [Queue msg] -> ShowS #

Eq (Queue msg) Source # 
Instance details

Defined in Network.AMQP.Worker.Queue

Methods

(==) :: Queue msg -> Queue msg -> Bool #

(/=) :: Queue msg -> Queue msg -> Bool #

queue :: MonadIO m => Connection -> QueuePrefix -> Key a msg -> m (Queue msg) Source #

Create a queue to receive messages matching the Key with a name prefixed via queueName.

q <- Worker.queue conn "main" $ key "messages" & any1
Worker.worker conn def q onError onMessage

queueNamed :: MonadIO m => Connection -> QueueName -> Key a msg -> m (Queue msg) Source #

Create a queue to receive messages matching the binding key. Each queue with a unique name will be delivered a separate copy of the messsage. Workers will load balance if operating on the same queue, or on queues with the same name

queueName :: QueuePrefix -> Key a msg -> QueueName Source #

Name a queue with a prefix and the binding key name. Useful for seeing at a glance which queues are receiving which messages

-- "main messages.new"
queueName "main" (key "messages" & word "new")

bindQueue :: MonadIO m => Connection -> Queue msg -> m () Source #

Queues must be bound before you publish messages to them, or the messages will not be saved. Use queue or queueNamed instead