-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haskell API for NATS messaging system -- -- This library is a Haskell driver for NATS http://nats.io. NATS -- is a fast and lightweight publish-subscribe messaging system. This -- version supports authentication but does not support SSL as the -- current version of gnatsd (go server 0.5.6) does not support it -- either. @package nats-queue @version 0.1.2.1 module Network.Nats -- | Control structure representing a connection to NATS server data Nats data NatsSID -- | Connect to a NATS server connect :: String -> IO Nats -- | Connect to NATS server using custom settings connectSettings :: NatsSettings -> IO Nats -- | Host settings; may have different username/password for each host data NatsHost NatsHost :: String -> Int -> String -> String -> NatsHost [natsHHost] :: NatsHost -> String [natsHPort] :: NatsHost -> Int -- | Username for authentication [natsHUser] :: NatsHost -> String -- | Password for authentication [natsHPass] :: NatsHost -> String -- | Advanced settings for connecting to NATS server data NatsSettings NatsSettings :: [NatsHost] -> (Nats -> (String, Int) -> IO ()) -> (Nats -> String -> IO ()) -> NatsSettings [natsHosts] :: NatsSettings -> [NatsHost] -- | Called when a client has successfully re-connected. This callback is -- called synchronously before the processing of incoming messages -- begins. It is not called when the client connects the first time, as -- such connection is synchronous. [natsOnReconnect] :: NatsSettings -> Nats -> (String, Int) -> IO () -- | Called when a client is disconnected. [natsOnDisconnect] :: NatsSettings -> Nats -> String -> IO () defaultSettings :: NatsSettings -- | NATS communication error data NatsException type MsgCallback = NatsSID SID of subscription -> String Subject -> ByteString Message -> Maybe String Reply subject -> IO () -- | Subscribe to a channel, optionally specifying queue group subscribe :: Nats -> String -> Maybe String -> MsgCallback -> IO NatsSID -- | Unsubscribe from a channel unsubscribe :: Nats -> NatsSID -> IO () -- | Publish a message publish :: Nats -> String -> ByteString -> IO () -- | Synchronous request/response communication to obtain one message request :: Nats -> String -> ByteString -> IO ByteString -- | Synchronous request/response for obtaining many messages in certain -- timespan requestMany :: Nats -> String -> ByteString -> Int -> IO [ByteString] -- | Disconnect from a NATS server disconnect :: Nats -> IO () instance GHC.Show.Show Network.Nats.Subject instance GHC.Show.Show Network.Nats.NatsSvrMessage instance GHC.Show.Show Network.Nats.NatsHost instance GHC.Classes.Eq Network.Nats.NatsSID instance GHC.Classes.Ord Network.Nats.NatsSID instance GHC.Num.Num Network.Nats.NatsSID instance Data.Aeson.Types.Class.ToJSON Network.Nats.NatsServerInfo instance Data.Aeson.Types.Class.FromJSON Network.Nats.NatsServerInfo instance GHC.Show.Show Network.Nats.NatsSID instance GHC.Read.Read Network.Nats.NatsSID instance Data.Aeson.Types.Class.FromJSON Network.Nats.NatsHost instance GHC.Show.Show Network.Nats.NatsServerInfo instance Data.Aeson.Types.Class.ToJSON Network.Nats.NatsConnectionOptions instance Data.Aeson.Types.Class.FromJSON Network.Nats.NatsConnectionOptions instance GHC.Show.Show Network.Nats.NatsConnectionOptions instance GHC.Show.Show Network.Nats.NatsException instance GHC.Exception.Exception Network.Nats.NatsException module Network.Nats.Json -- | Subscribe to a channel, optionally specifying queue group If the JSON -- cannot be properly parsed, the message is ignored subscribe :: FromJSON a => Nats -> String -> Maybe String -> (NatsSID -> String -> a -> Maybe String -> IO ()) -> IO NatsSID -- | Publish a message publish :: ToJSON a => Nats -> String -> a -> IO () requestMany :: (ToJSON a, FromJSON b) => Nats -> String -> a -> Int -> IO [b]