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 4
4
"fmt"
5
5
"log"
6
6
"os"
7
+ "strings"
7
8
8
9
"github.com/streadway/amqp"
9
10
)
@@ -51,11 +52,11 @@ func main() {
51
52
}
52
53
53
54
func bodyFrom (args []string ) string {
54
- var body string
55
+ var s string
55
56
if (len (args ) < 2 ) || os .Args [1 ] == "" {
56
- body = "hello"
57
+ s = "hello"
57
58
} else {
58
- body = os . Args [ 1 ]
59
+ s = strings . Join ( args [ 1 :], " " )
59
60
}
60
- return body
61
+ return s
61
62
}
Original file line number Diff line number Diff line change @@ -23,6 +23,17 @@ func main() {
23
23
failOnError (err , "Failed to open a channel" )
24
24
defer ch .Close ()
25
25
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
+
26
37
q , err := ch .QueueDeclare (
27
38
"" , // name
28
39
false , // durable
You can’t perform that action at this time.
0 commit comments