Portability | portable |
---|---|
Stability | experimental |
Safe Haskell | None |
This module provides Conduit interfaces for the stomp-queue library. The interfaces create or receive streams of messages instead of single messages. This approach aims to simplify the integration of messaging into applications by means of well-defined streaming interfaces.
- qSource :: MonadResource m => Reader i -> Int -> Producer m (Message i)
- qSink :: MonadResource m => Writer o -> Type -> [Header] -> Consumer o m ()
- qMultiSource :: MonadResource m => Reader i -> Int -> Producer m (Message i)
- qMultiSink :: MonadResource m => Writer o -> Type -> [Header] -> Consumer o m ()
Plain message streams
qSource :: MonadResource m => Reader i -> Int -> Producer m (Message i)
Reads from a Reader
queue with timeout
and returns a Producer
of type Message
i.
The function ends iff the timeout expires and loops infinitely otherwise.
Parameters:
-
Reader
i: The input interface, a StompReader
. - Int: Timeout in microseconds
qSink :: MonadResource m => Writer o -> Type -> [Header] -> Consumer o m ()
Writes a stream of messages to a Writer
queue
and returns a Consumer
of type o.
The function terminates, when the stream ends.
Parameters:
-
Writer
o: The output interface, a StompWriter
. -
Type
: The mime type of the message content. - [
Header
]: Headers to add to each message.
Multipart messages as streams
qMultiSource :: MonadResource m => Reader i -> Int -> Producer m (Message i)
Reads from a Reader
queue with timeout
and returns a Producer
of type Message
i.
The function ends when the timeout expires
or after having received a segment that is marked as the last one.
Note that multipart messages are not foreseen by the standard.
qMultiSink
and qMultiSource
use a header named "__last__"
to label the last segment of a multipart message.
For parameters, please refer to qSource
.
qMultiSink :: MonadResource m => Writer o -> Type -> [Header] -> Consumer o m ()
Writes a multipart message to a Writer
queue
and returns a Consumer
of type o.
The function terminates, when the stream ends.
The last segment is sent with the header ("__last__", "true").
Note that multipart messages are not foreseen by the standard.
For parameters, please refer to qSink
.