|
1 | 1 | package main |
2 | 2 |
|
3 | 3 | import ( |
| 4 | + "encoding/json" |
4 | 5 | "flag" |
5 | 6 | "fmt" |
6 | | - "github.com/streadway/amqp" |
7 | 7 | "io/ioutil" |
8 | | - "encoding/json" |
9 | 8 | "os" |
10 | 9 | "path" |
| 10 | + |
| 11 | + "github.com/streadway/amqp" |
11 | 12 | ) |
12 | 13 |
|
13 | 14 | var ( |
14 | 15 | uri = flag.String("uri", "amqp://guest:guest@localhost:5672/", "AMQP URI") |
15 | 16 | queue = flag.String("queue", "", "Ephemeral AMQP queue name") |
16 | 17 | maxMessages = flag.Uint("max-messages", 1000, "Maximum number of messages to dump") |
17 | 18 | outputDir = flag.String("output-dir", ".", "Directory in which to save the dumped messages") |
18 | | - full = flag.Bool("full", false, "Dump the message, its properties and headers") |
| 19 | + full = flag.Bool("full", false, "Dump the message, its properties and headers") |
19 | 20 | verbose = flag.Bool("verbose", false, "Print progress") |
20 | 21 | ) |
21 | 22 |
|
@@ -93,17 +94,17 @@ func SaveMessageToFile(body []byte, outputDir string, counter uint) error { |
93 | 94 |
|
94 | 95 | func GetProperties(msg amqp.Delivery) map[string]interface{} { |
95 | 96 | props := map[string]interface{}{ |
96 | | - "app_id": msg.AppId, |
| 97 | + "app_id": msg.AppId, |
97 | 98 | "content_encoding": msg.ContentEncoding, |
98 | | - "content_type": msg.ContentType, |
99 | | - "correlation_id": msg.CorrelationId, |
100 | | - "delivery_mode": msg.DeliveryMode, |
101 | | - "expiration": msg.Expiration, |
102 | | - "message_id": msg.MessageId, |
103 | | - "priority": msg.Priority, |
104 | | - "reply_to": msg.ReplyTo, |
105 | | - "type": msg.Type, |
106 | | - "user_id": msg.UserId, |
| 99 | + "content_type": msg.ContentType, |
| 100 | + "correlation_id": msg.CorrelationId, |
| 101 | + "delivery_mode": msg.DeliveryMode, |
| 102 | + "expiration": msg.Expiration, |
| 103 | + "message_id": msg.MessageId, |
| 104 | + "priority": msg.Priority, |
| 105 | + "reply_to": msg.ReplyTo, |
| 106 | + "type": msg.Type, |
| 107 | + "user_id": msg.UserId, |
107 | 108 | } |
108 | 109 |
|
109 | 110 | if !msg.Timestamp.IsZero() { |
|
0 commit comments