forked from rabbitmq/rabbitmq-tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsend.hs
More file actions
20 lines (15 loc) · 625 Bytes
/
send.hs
File metadata and controls
20 lines (15 loc) · 625 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{-# OPTIONS -XOverloadedStrings #-}
import Network.AMQP
import qualified Data.ByteString.Lazy.Char8 as BL
main :: IO ()
main = do
conn <- openConnection "127.0.0.1" "/" "guest" "guest"
ch <- openChannel conn
declareQueue ch newQueue {queueName = "hello",
queueAutoDelete = False,
queueDurable = False}
publishMsg ch "" "hello"
(newMsg {msgBody = (BL.pack "Hello World!"),
msgDeliveryMode = Just NonPersistent})
putStrLn " [x] Sent 'Hello World!'"
closeConnection conn