hats-0.1.0.1: Haskell client for the NATS messaging system

Copyright(c) 2016 Patrik Sandahl
LicenseMIT
MaintainerPatrik Sandahl <patrik.sandahl@gmail.com>
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Network.Nats.Types

Description

Base types for the library's API. JSON support is implemented with Data.Aeson.

Synopsis

Documentation

type Topic = ByteString Source #

The type of a topic where to publish, or to subscribe on. Type alias for ByteString.

type Payload = ByteString Source #

The type of a message payload. Type alias for ByteString.

type Sid = Int64 Source #

The numeric id for a subscription. An id shall be unique within a NATS client. The value of the id will be generated automatically by the API. Type alias for Int64.

type QueueGroup = ByteString Source #

A Topic subscriber can be part of a queue group, an entity for load balancing in NATS. Type alias for ByteString.

data NatsException Source #

Exceptions generated from within this library.

Constructors

HandshakeException

An exception caused by errors during the NATS connection handshake. Will not popup on user level, only handled internally.

ConnectionGiveUpException

An exception thrown when all the configured connection attempts are consumed and the connection manager has been given up.

AuthorizationException

The NATS server currently connected to has said that there are authorization violations. Don't try to survive, just tell the user that there are such errors.

URIError !String

An exception caused by invalid URI strings given to the withNats function.

newtype MsgQueue Source #

A message queue, a queue of Msgs handled by a TQueue.

Constructors

MsgQueue (TQueue Msg) 

data Msg Source #

A NATS message as received by the user. The message itself is opaque to the user, but the fields can be read by the API functions topic, replyTo, sid, payload, jsonPayload and jsonPayload'

Constructors

Msg !Topic !(Maybe Topic) !Sid !Payload 

Instances

Eq Msg Source # 

Methods

(==) :: Msg -> Msg -> Bool #

(/=) :: Msg -> Msg -> Bool #

Show Msg Source # 

Methods

showsPrec :: Int -> Msg -> ShowS #

show :: Msg -> String #

showList :: [Msg] -> ShowS #

topic :: Msg -> Topic Source #

Read the complete topic on which a message was received.

replyTo :: Msg -> Maybe Topic Source #

Read the reply-to topic from a received message.

sid :: Msg -> Sid Source #

Read the subscription id for the subscription on which this message was received.

payload :: Msg -> Payload Source #

Read the raw payload from a received message.

jsonPayload :: FromJSON a => Msg -> Maybe a Source #

Decode a message's payload as JSON. Is using decode for the decoding.

jsonPayload' :: FromJSON a => Msg -> Maybe a Source #

Decode a message's payload as JSON. Is using decode' for the decoding.