-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Client library for Stomp brokers. -- -- Stomp is a client library for communicating with message servers -- through the STOMP protocol -- (http:stomp.github.com/stomp-specification-1.1.html) @package Stomp @version 0.1 -- | A client library for Stomp serevers implementing stomp 1.1 -- specification. See -- http:stomp.github.com/stomp-specification-1.1.html -- -- Example: -- --
-- import Network.Stomp -- import qualified Data.ByteString.Lazy.Char8 as B -- -- main = do -- -- connect to a stomp broker -- con <- connect "stomp://guest:guest@127.0.0.1:61613" vers headers -- putStrLn $ "Accepted versions: " ++ show (versions con) -- -- -- start consumer and subscribe to the queue -- startConsumer con callback -- subscribe con "/queue/test" "0" [] -- -- -- send the messages to the queue -- send con "/queue/test" [] (B.pack "message1") -- send con "/queue/test" [] (B.pack "message2") -- -- -- wait -- getLine -- -- -- unsubscribe and disconnect -- unsubscribe con "0" [] -- disconnect con [] -- where -- vers = [(1,0),(1,1)] -- headers = [] -- -- callback :: Frame -> IO () -- callback (Frame (SC MESSAGE) hs body) = do -- putStrLn $ "received message: " ++ (B.unpack body) -- putStrLn $ "headers: " ++ show hs -- callback f = putStrLn $ "received frame: " ++ show f --module Network.Stomp -- | Stomp frame commands data Command CC :: ClientCommand -> Command SC :: ServerCommand -> Command -- | Client frame commands data ClientCommand SEND :: ClientCommand SUBSCRIBE :: ClientCommand UNSUBSCRIBE :: ClientCommand BEGIN :: ClientCommand COMMIT :: ClientCommand ABORT :: ClientCommand ACK :: ClientCommand NACK :: ClientCommand DISCONNECT :: ClientCommand CONNECT :: ClientCommand STOMP :: ClientCommand -- | Broker frame commands data ServerCommand CONNECTED :: ServerCommand MESSAGE :: ServerCommand RECEIPT :: ServerCommand ERROR :: ServerCommand -- | Stomp frame record data Frame Frame :: Command -> [Header] -> ByteString -> Frame command :: Frame -> Command headers :: Frame -> [Header] body :: Frame -> ByteString -- | A record used to communicate with Stomp brokers data Connection type StompUri = String type Host = String type Destination = String type MessageId = String type Transaction = String type Subscription = String type Version = (Int, Int) data StompException ConnectionError :: String -> StompException InvalidUri :: String -> StompException InvalidFrame :: String -> StompException BrokerError :: String -> StompException StompIOError :: IOException -> StompException -- | connect to the stomp (1.0, 1.1) broker using uri connect :: StompUri -> [Version] -> [Header] -> IO Connection -- | connect to the stomp 1.1 broker using uri stomp :: StompUri -> [Header] -> IO Connection -- | connect to the stomp (1.0, 1.1) broker using hostname and port connect' :: Host -> PortNumber -> [Version] -> [Header] -> IO Connection -- | connect to the stomp 1.0 broker using hostname and port stomp' :: Host -> PortNumber -> [Header] -> IO Connection -- | closes stomp connection disconnect :: Connection -> [Header] -> IO () send :: Connection -> Destination -> [Header] -> ByteString -> IO () -- | subscribe to the destination to receive stomp frames subscribe :: Connection -> Destination -> Subscription -> [Header] -> IO () -- | unsubscribe from destination given the subscription id unsubscribe :: Connection -> Subscription -> [Header] -> IO () -- | acknowledge the consumption of a message from a subscription ack :: Connection -> Subscription -> MessageId -> [Header] -> IO () -- | acknowledge the rejection of a message from a subscription nack :: Connection -> Subscription -> MessageId -> [Header] -> IO () -- | start a transaction begin :: Connection -> Transaction -> [Header] -> IO () -- | commit a transaction commit :: Connection -> Transaction -> [Header] -> IO () -- | rollback a transaction abort :: Connection -> Transaction -> [Header] -> IO () -- | create consume frames thread startConsumer :: Connection -> (Frame -> IO ()) -> IO () -- | reads incoming frame from handle receiveFrame :: Connection -> IO Frame -- | set exception handler callback to process the exception in the -- consumer/heartbeats threads setExcpHandler :: Connection -> (StompException -> IO ()) -> IO () -- | fork send heartbeat thread startSendBeat :: Connection -> IO () -- | fork receive heartbeat thread startRecvBeat :: Connection -> IO () -- | send heartbeat timeout sendTimeout :: Connection -> Int -- | receive heaertbeat timeout recvTimeout :: Connection -> Int -- | last frame sent time lastSend :: Connection -> MVar UTCTime -- | last frame received time lastRecv :: Connection -> MVar UTCTime -- | accepted stomp versions versions :: Connection -> [Version] instance Typeable StompException instance Show ClientCommand instance Read ClientCommand instance Eq ClientCommand instance Show ServerCommand instance Read ServerCommand instance Eq ServerCommand instance Show Command instance Read Command instance Eq Command instance Show Frame instance Show StompException instance Eq StompException instance Exception StompException