forked from adjust/rmq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_queue.go
82 lines (62 loc) · 1.64 KB
/
test_queue.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package rmq
import "time"
type TestQueue struct {
name string
LastDeliveries []string
}
func NewTestQueue(name string) *TestQueue {
queue := &TestQueue{name: name}
queue.Reset()
return queue
}
func (queue *TestQueue) String() string {
return queue.name
}
func (queue *TestQueue) Publish(payload string, priority int) bool {
queue.LastDeliveries = append(queue.LastDeliveries, payload)
return true
}
func (queue *TestQueue) PublishBytes(payload []byte, priority int) bool {
return queue.Publish(string(payload), priority)
}
func (queue *TestQueue) SetPushQueue(pushQueue Queue) {
}
func (queue *TestQueue) StartConsuming(prefetchLimit int, pollDuration time.Duration) bool {
return true
}
func (queue *TestQueue) StopConsuming() <-chan struct{} {
return nil
}
func (queue *TestQueue) AddConsumer(tag string, consumer Consumer) string {
return ""
}
func (queue *TestQueue) AddConsumerFunc(tag string, consumerFunc ConsumerFunc) string {
return ""
}
func (queue *TestQueue) AddBatchConsumer(tag string, batchSize int, consumer BatchConsumer) string {
return ""
}
func (queue *TestQueue) AddBatchConsumerWithTimeout(tag string, batchSize int, timeout time.Duration, consumer BatchConsumer) string {
return ""
}
func (queue *TestQueue) ReturnRejected(count int) int {
return 0
}
func (queue *TestQueue) ReturnAllRejected() int {
return 0
}
func (queue *TestQueue) PurgeReady() int {
return 0
}
func (queue *TestQueue) PurgeRejected() int {
return 0
}
func (queue *TestQueue) ReturnAllUnacked() int {
return 0
}
func (queue *TestQueue) Close() bool {
return false
}
func (queue *TestQueue) Reset() {
queue.LastDeliveries = []string{}
}