amqp 0.1.1 → 0.1.2
raw patch · 2 files changed
+18/−7 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Network.AMQP: msgContentType :: Message -> Maybe String
+ Network.AMQP: openConnection' :: String -> PortNumber -> String -> String -> String -> IO Connection
- Network.AMQP: Message :: ByteString -> Maybe DeliveryMode -> Maybe Timestamp -> Maybe String -> Message
+ Network.AMQP: Message :: ByteString -> Maybe DeliveryMode -> Maybe Timestamp -> Maybe String -> Maybe String -> Message
Files
- Network/AMQP.hs +17/−6
- amqp.cabal +1/−1
Network/AMQP.hs view
@@ -50,6 +50,7 @@ -- * Connection Connection, openConnection,+ openConnection', closeConnection, -- * Channel@@ -327,7 +328,7 @@ --TODO: add more of these to 'Message' (CHBasic- Nothing+ (fmap ShortString $ msgContentType msg) Nothing Nothing (fmap deliveryModeToInt $ msgDeliveryMode msg) -- delivery_mode @@ -473,13 +474,14 @@ msgBody :: BL.ByteString, -- ^ the content of your message msgDeliveryMode :: Maybe DeliveryMode, -- ^ see 'DeliveryMode' msgTimestamp :: Maybe Timestamp, -- ^ use in any way you like; this doesn't affect the way the message is handled- msgID :: Maybe String -- ^ use in any way you like; this doesn't affect the way the message is handled+ msgID :: Maybe String, -- ^ use in any way you like; this doesn't affect the way the message is handled+ msgContentType :: Maybe String } deriving Show -- | a 'Msg' with defaults set; you should override at least 'msgBody' newMsg :: Message -newMsg = Message (BL.empty) Nothing Nothing Nothing +newMsg = Message (BL.empty) Nothing Nothing Nothing Nothing ------------- ASSEMBLY ------------------------- -- an assembly is a higher-level object consisting of several frames (like in amqp 0-10)@@ -572,11 +574,16 @@ -- -- NOTE: If the login name, password or virtual host are invalid, this method will throw a 'ConnectionClosedException'. The exception will not contain a reason why the connection was closed, so you'll have to find out yourself. openConnection :: String -> String -> String -> String -> IO Connection -openConnection host vhost loginName loginPassword = do+openConnection host vhost loginName loginPassword =+ openConnection' host 5672 vhost loginName loginPassword++-- | same as 'openConnection' but allows you to specify a non-default port-number as the 2nd parameter +openConnection' :: String -> PortNumber -> String -> String -> String -> IO Connection+openConnection' host port vhost loginName loginPassword = do proto <- getProtocolNumber "tcp" sock <- socket AF_INET Stream proto addr <- inet_addr host- connect sock (SockAddrInet 5672 addr)+ connect sock (SockAddrInet port addr) NB.send sock $ toStrict $ BPut.runPut $ do BPut.putByteString $ BS.pack "AMQP" BPut.putWord8 1@@ -717,8 +724,12 @@ case message_id of (Just (ShortString s)) -> Just s _ -> Nothing+ contentType =+ case content_type of+ (Just (ShortString s)) -> Just s+ _ -> Nothing in- Message msgBody (fmap intToDeliveryMode delivery_mode) timestamp msgId + Message msgBody (fmap intToDeliveryMode delivery_mode) timestamp msgId contentType -- | The thread that is run for every channel channelReceiver :: Channel -> IO ()
amqp.cabal view
@@ -1,5 +1,5 @@ Name: amqp -Version: 0.1.1 +Version: 0.1.2 Synopsis: Client library for AMQP servers (currently only RabbitMQ) Description: Client library for AMQP servers (currently only RabbitMQ) License: BSD3