There was an error while loading. Please reload this page.
1 parent 1f6dc30 commit 8752dc3Copy full SHA for 8752dc3
go/new_task.go
@@ -25,10 +25,20 @@ func main() {
25
failOnError(err, "Failed to open a channel")
26
defer ch.Close()
27
28
+q, err := ch.QueueDeclare(
29
+"task_queue", // name
30
+true, // durable
31
+false, // delete when unused
32
+false, // exclusive
33
+false, // no-wait
34
+nil, // arguments
35
+)
36
+failOnError(err, "Failed to declare a queue")
37
+
38
body := bodyFrom(os.Args)
39
err = ch.Publish(
40
"", // exchange
-"task_queue", // routing key
41
+q.Name, // routing key
42
false, // mandatory
43
false,
44
amqp.Publishing{
@@ -37,6 +47,7 @@ func main() {
47
Body: []byte(body),
48
})
49
failOnError(err, "Failed to publish a message")
50
+log.Printf(" [x] Sent %s", body)
51
}
52
53
func bodyFrom(args []string) string {
0 commit comments