forked from assembla/cony
-
Notifications
You must be signed in to change notification settings - Fork 2
/
cony.go
51 lines (43 loc) · 1.12 KB
/
cony.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
// Package cony is a high-level wrapper around http://github.com/streadway/amqp library,
// for working declaratively with AMQP. Cony will manage AMQP
// connect/reconnect to AMQP broker, along with recovery of consumers.
package cony
import (
"sync"
"github.com/streadway/amqp"
)
// Queue hold definition of AMQP queue
type Queue struct {
Name string
Durable bool
AutoDelete bool
Exclusive bool
Args amqp.Table
l sync.Mutex
}
// Exchange hold definition of AMQP exchange
type Exchange struct {
Name string
Kind string
Durable bool
AutoDelete bool
Args amqp.Table
}
// Binding used to declare binding between AMQP Queue and AMQP Exchange
type Binding struct {
Queue *Queue
Exchange Exchange
Key string
Args amqp.Table
}
type mqDeleter interface {
deletePublisher(*Publisher)
deleteConsumer(*Consumer)
}
type mqChannel interface {
Close() error
Consume(string, string, bool, bool, bool, bool, amqp.Table) (<-chan amqp.Delivery, error)
NotifyClose(chan *amqp.Error) chan *amqp.Error
Publish(string, string, bool, bool, amqp.Publishing) error
Qos(int, int, bool) error
}