-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haskell API for NATS messaging system -- @package nats-queue @version 0.1.2.0 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 connected. This callback is -- called synchronously before the processing of incoming messages -- begins. natsOnConnect :: 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 -> String -> ByteString -> Maybe String -> 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 Num NatsSID instance Ord NatsSID instance Eq NatsSID instance Show NatsSvrMessage instance Show Subject instance Read NatsSID instance Show NatsSID instance FromJSON NatsServerInfo instance ToJSON NatsServerInfo instance Show NatsServerInfo instance FromJSON NatsConnectionOptions instance ToJSON NatsConnectionOptions instance Typeable NatsException instance Show NatsException instance Show NatsConnectionOptions instance Exception 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]