import Data.Default.Class
import Data.Maybe
+import Data.Text (Text)
import Data.Version (showVersion)
+import Network.AMQP.Types
import Paths_amqp_utils (version)
import System.Console.GetOpt
, inputFile :: String
, lineMode :: Bool
, confirm :: Bool
+ , msgtimestamp :: Maybe Timestamp
+ , msgid :: Maybe Text
+ , msgtype :: Maybe Text
+ , msguserid :: Maybe Text
+ , msgappid :: Maybe Text
+ , msgclusterid :: Maybe Text
+ , msgcontenttype :: Maybe Text
+ , msgcontentencoding :: Maybe Text
+ , msgreplyto :: Maybe Text
+ , msgprio :: Maybe Octet
+ , msgcorrid :: Maybe Text
+ , msgexp :: Maybe Text
}
instance Default Args where
"/dev/stdin"
False
False
+ Nothing
+ Nothing
+ Nothing
+ Nothing
+ Nothing
+ Nothing
+ Nothing
+ Nothing
+ Nothing
+ Nothing
+ Nothing
+ Nothing
-- | Common options
cOptions :: [OptDescr (Args -> Args)]
confirmSelect chan False
addConfirmationListener chan confirmCallback
else return ()
- let publishOneMsg f = do
- r <-
- publishMsg
- chan
- (T.pack $ currentExchange args)
- (T.pack $ rKey args)
- newMsg {msgBody = f, msgDeliveryMode = Just Persistent}
- printparam "sent" $ fmap show r
+ let publishOneMsg = publishOneMsg' chan args
X.catch
(if isDir
then do
(\exception ->
printparam' "exception in handleFile" $
show (exception :: X.SomeException))
+
+-- | Publish one message with our settings
+publishOneMsg' :: Channel -> Args -> BL.ByteString -> IO ()
+publishOneMsg' c a f = do
+ r <-
+ publishMsg
+ c
+ (T.pack $ currentExchange a)
+ (T.pack $ rKey a)
+ newMsg { msgBody = f
+ , msgDeliveryMode = Just Persistent
+ , msgTimestamp = msgtimestamp a
+ , msgID = msgid a
+ , msgType = msgtype a
+ , msgUserID = msguserid a
+ , msgApplicationID = msgappid a
+ , msgClusterID = msgclusterid a
+ , msgContentType = msgcontenttype a
+ , msgContentEncoding = msgcontentencoding a
+ , msgReplyTo = msgreplyto a
+ , msgPriority = msgprio a
+ , msgCorrelationID = msgcorrid a
+ , msgExpiration = msgexp a
+ -- , msgHeaders =
+ }
+ printparam "sent" $ fmap show r