[CloseWrite, MoveIn]
(inputFile args)
(handleEvent publishOneMsg (suffix args) (inputFile args))
- hr $ "watching " ++ (inputFile args)
+ hr $ "BEGIN watching " ++ (inputFile args)
_ <- forever $ threadDelay 1000000
removeWatch wd
+ hr $ "END watching " ++ (inputFile args)
else do
- hr $ "sending " ++ (inputFile args)
+ hr $ "BEGIN sending"
messageFile <- BL.readFile (inputFile args)
if (lineMode args)
then mapM_ (publishOneMsg Nothing) (BL.lines messageFile)
- else publishOneMsg (Just (inputFile args)) messageFile)
+ else publishOneMsg (Just (inputFile args)) messageFile
+ hr "END sending")
(\exception -> printparam' "exception" $ show (exception :: X.SomeException))
-- all done. wait and close.
if (confirm args)
- then waitForConfirms chan >>= return . show >> return ()
+ then waitForConfirms chan >>= (printparam' "confirmed") . show
else return ()
closeConnection conn
+ hr "connection closed"
-- | The handler for publisher confirms
confirmCallback :: (Word64, Bool, AckType) -> IO ()
else return ()
handleFile f [] x =
X.catch
- (hr ("sending " ++ x) >> BL.readFile x >>= f (Just x))
+ (BL.readFile x >>= f (Just x))
(\exception ->
printparam' "exception in handleFile" $
show (exception :: X.SomeException))
-- | Publish one message with our settings
publishOneMsg' :: Channel -> Args -> Maybe String -> BL.ByteString -> IO ()
publishOneMsg' c a fn f = do
+ printparam "sending" fn
(mtype, mencoding) <-
if (magic a) && isJust fn
then do