Skip to content

Commit d004845

Browse files
committed
Add directory publishing and messages moving
1 parent c3bebb2 commit d004845

File tree

4 files changed

+327
-54
lines changed

4 files changed

+327
-54
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,24 @@ if it's not the case you can disable it with `json-content` paramater
7777

7878
rabbitmq-dump-queue -uri="amqp://user:[email protected]:5672/" -queue=incoming_1 -max-messages=50 -output-dir=/tmp -json-content=false
7979

80+
81+
If you want to post a directory with dumped rabbit messages you can run the following command (it will use the exchange in properties section of the json files):
82+
83+
rabbitmq-dump-queue -uri="amqp://user:[email protected]:5672/" -messages-to-post-dir=/tmp
84+
85+
If you want to post a directory with dumped rabbit messages and you want to tell to which exchange it should post you can run the following command (it will ignore exchange in the json files):
86+
87+
rabbitmq-dump-queue -uri="amqp://user:[email protected]:5672/" -messages-to-post-dir=/tmp -new-exchange=new_exchange
88+
89+
If you want to move the messages from one queue to some exchange you can do:
90+
91+
rabbitmq-dump-queue -uri="amqp://user:[email protected]:5672/" -queue=incoming_1 -max-messages=5000 -output-dir=/tmp -new-exchange=new_exchange -ack=true
92+
93+
94+
If you want to move the messages from one queue to some exchange in another server you can do:
95+
96+
rabbitmq-dump-queue -uri="amqp://user:[email protected]:5672/" -queue=incoming_1 -max-messages=5000 -output-dir=/tmp -new-exchange=new_exchange -new-uri="amqp://user:[email protected]:5672/" -ack=true
97+
8098
Running `rabbitmq-dump-queue -help` will list the available command-line
8199
options.
82100

ishidden_unix.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// +build !windows
2+
3+
package main
4+
5+
import (
6+
"log"
7+
"runtime"
8+
)
9+
10+
func isHidden(filename string) (bool, error) {
11+
if runtime.GOOS != "windows" {
12+
if filename[0:1] == "." {
13+
return true, nil
14+
}
15+
16+
return false, nil
17+
}
18+
19+
log.Fatal("Unable to check if file is hidden under this OS")
20+
return false, nil
21+
}

ishidden_windows.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// +build windows
2+
3+
package main
4+
5+
import (
6+
"log"
7+
"runtime"
8+
"syscall"
9+
)
10+
11+
func isHidden(filename string) (bool, error) {
12+
if runtime.GOOS == "windows" {
13+
pointer, err := syscall.UTF16PtrFromString(filename)
14+
if err != nil {
15+
return false, err
16+
}
17+
attributes, err := syscall.GetFileAttributes(pointer)
18+
if err != nil {
19+
return false, err
20+
}
21+
return attributes&syscall.FILE_ATTRIBUTE_HIDDEN != 0, nil
22+
}
23+
24+
log.Fatal("Unable to invoke GetFileAttributes() function or FILE_ATTRIBUTE_HIDDEN property")
25+
return false, nil
26+
}

0 commit comments

Comments
 (0)