stomp-conduit-0.0.2: Stompl Conduit Client

Portabilityportable
Stabilityexperimental
Safe HaskellNone

Network.Mom.Stompl.Client.Conduit

Contents

Description

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.

Synopsis

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 Stomp Reader.
  • 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 Stomp Writer.
  • 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.