| Portability | unknown |
|---|---|
| Stability | experimental |
| Maintainer | berens.paul@gmail.com |
| Safe Haskell | None |
Network.NSQ
Description
This is a haskell client for the NSQ message queue service.
TODO:
- Start implementing a more through client
- Write some form of tests
- More through docs, the initial docs sucks.
- type MsgId = ByteString
- type Topic = Text
- type Channel = Text
- data Message
- data Command
- data FrameType
- = FTResponse
- | FTError
- | FTMessage
- | FTUnknown Int32
- data ErrorType
- = Invalid
- | BadBody
- | BadTopic
- | BadChannel
- | BadMessage
- | PubFailed
- | MPubFailed
- | FinFailed
- | ReqFailed
- | TouchFailed
- data OptionalSetting
- data TLS
- data Compression
- = NoCompression
- | Snappy
- | Deflate Word8
- data Identification = Identification {}
- data IdentifyMetadata = IdentifyMetadata {}
- data NSQConnection = NSQConnection {}
- message :: Parser Message
- decode :: ByteString -> Maybe Message
- encode :: Command -> ByteString
- defaultIdentify :: Text -> Text -> IdentifyMetadata
- defaultUserAgent :: Text
- encodeMetadata :: IdentifyMetadata -> ByteString
- defaultConfig :: String -> IO NSQConnection
- establish :: NSQConnection -> TQueue Message -> TQueue Command -> IO ()
Documentation
type MsgId = ByteStringSource
Message Id, it is a 16-byte hexdecimal string encoded as ASCII
The message and replies back from the server.
Constructors
| OK | Everything is allright. |
| Heartbeat | |
| CloseWait | Server has closed the connection. |
| Error ByteString | The server sent back an error. |
| Message Int64 Word16 MsgId ByteString | A message to be processed. The values are: Nanosecond Timestamp, number of attempts, Message Id, and the content of the message to be processed. |
| CatchAllMessage FrameType ByteString | Catch-all message for future expansion. This currently includes the reply from |
NSQ Command
Constructors
| Protocol | The protocol version |
| NOP | No-op, usually used in reply to a |
| Identify IdentifyMetadata | Client Identification + possible features negotiation. |
| Sub Topic Channel Bool | Subscribe to a specified 'Topic'/'Channel', use |
| Pub Topic ByteString | Publish a message to the specified |
| MPub Topic [ByteString] | Publish multiple messages to a specified |
| Rdy Word64 | Update |
| Fin MsgId | Finish a message. |
| Req MsgId Word64 | Re-queue a message (failure to process), Timeout is in milliseconds. |
| Touch MsgId | Reset the timeout for an in-flight message. |
| Cls | Cleanly close the connection to the NSQ daemon. |
| Command ByteString | Catch-all command for future expansion/custom commands. |
Frame Type of the incoming data from the NSQ daemon.
Types of error that the server can return in response to an Command
data NSQConnection Source
Per Connection configuration * Per nsqd (connection) state (rdy, load balance, etc) * Per topic state (channel related info and which nsqd connection) * Global? state (do we have any atm? maybe configuration?) TODO: consider using monad-journal logger for pure code tracing
Constructors
| NSQConnection | |
Fields
| |
decode :: ByteString -> Maybe MessageSource
encode :: Command -> ByteStringSource
defaultIdentify :: Text -> Text -> IdentifyMetadataSource