mongodb-queue-0.4.0.1: message queue using MongoDB

Safe HaskellNone

Database.MongoDB.Queue

Contents

Synopsis

Documentation

emit :: (MonadIO m, Applicative m) => QueueEmitter -> Document -> Action m ()Source

emit a message for a worker

nextFromQueuePoll :: (MonadIO m, MonadBaseControl IO m) => PollBroker -> Action m DocumentSource

Get the next message from the queue. First marks the message as handled.

Uses polling rather than a tailable cursor

Do not call this from multiple threads against the same PollBroker

nextFromQueueTail :: (MonadIO m, MonadBaseControl IO m) => TailBroker -> Action m DocumentSource

Get the next message from the queue. First marks the message as handled.

Uses a tailable cursor rather than polling

Do not call this from multiple threads against the same TailBroker

queue emitters

createEmitter :: (Applicative m, MonadIO m) => Action m QueueEmitterSource

create a QueueEmitter

mkEmitter :: (Applicative m, MonadIO m) => EmitterOpts -> Action m QueueEmitterSource

create an emitter with non-default configuration

queue consumers

createPollBroker :: (MonadIO m, Applicative m) => Action m PollBrokerSource

same as createTailBroker, but uses a polling technique instead of tailable cursors Use default settings and poll with a 10 ms delay

createTailBroker :: (MonadIO m, Applicative m) => Action m TailBrokerSource

creates a TailBroker create a single TailBroker per process (per queue collection) call nextFromQueueTail with the TailBroker to get the next message

TailBroker is designed to have 1 instance per process (and 1 process per machine) To handle multiple messages at once immediately hand off messages from nextFromQueueTail to worker threads (this library does not help you create worker threads)

mkTailBroker :: (MonadIO m, Applicative m) => WorkerOpts -> Action m TailBrokerSource

create a tailable cursor worker with non-default configuration

mkPollBrokerSource

Arguments

:: (MonadIO m, Applicative m) 
=> WorkerOpts 
-> Int

polling interval in us (uses threadDelay)

-> Action m PollBroker 

create an worker with non-default configuration