File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed
Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change 44 "fmt"
55 "log"
66 "os"
7+ "strings"
78
89 "github.com/streadway/amqp"
910)
@@ -51,11 +52,11 @@ func main() {
5152}
5253
5354func bodyFrom (args []string ) string {
54- var body string
55+ var s string
5556 if (len (args ) < 2 ) || os .Args [1 ] == "" {
56- body = "hello"
57+ s = "hello"
5758 } else {
58- body = os . Args [ 1 ]
59+ s = strings . Join ( args [ 1 :], " " )
5960 }
60- return body
61+ return s
6162}
Original file line number Diff line number Diff line change @@ -23,6 +23,17 @@ func main() {
2323 failOnError (err , "Failed to open a channel" )
2424 defer ch .Close ()
2525
26+ err = ch .ExchangeDeclare (
27+ "logs" , // name
28+ "fanout" , // type
29+ true , // durable
30+ false , // auto-deleted
31+ false , // internal
32+ false , // no-wait
33+ nil , // arguments
34+ )
35+ failOnError (err , "Failed to declare an exchange" )
36+
2637 q , err := ch .QueueDeclare (
2738 "" , // name
2839 false , // durable
You can’t perform that action at this time.
0 commit comments