| Copyright | (c) 2016 Patrik Sandahl |
|---|---|
| License | MIT |
| Maintainer | Patrik Sandahl <patrik.sandahl@gmail.com> |
| Stability | experimental |
| Portability | portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Network.Nats.Types
Description
Base types for the library's API. JSON support is implemented with Data.Aeson.
- type Topic = ByteString
- type Payload = ByteString
- type Sid = Int64
- type QueueGroup = ByteString
- data NatsException
- newtype MsgQueue = MsgQueue (TQueue Msg)
- data Msg = Msg !Topic !(Maybe Topic) !Sid !Payload
- topic :: Msg -> Topic
- replyTo :: Msg -> Maybe Topic
- sid :: Msg -> Sid
- payload :: Msg -> Payload
- jsonPayload :: FromJSON a => Msg -> Maybe a
- jsonPayload' :: FromJSON a => Msg -> Maybe a
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.
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
|
Instances
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'
Read the subscription id for the subscription on which this message was received.