-
Notifications
You must be signed in to change notification settings - Fork 0
/
delivery.go
168 lines (136 loc) · 3.7 KB
/
delivery.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
package rabbitmq
import (
"time"
amqp "github.com/rabbitmq/amqp091-go"
)
type RabbitDelivery interface {
// Ack acknowledges processing of a Delivery.
Ack(multiple bool) error
// Nack negatively acknowledges a Delivery.
Nack(multiple bool, requeue bool) error
// Reject rejects a delivery.
Reject(requeue bool) error
// Body returns the message body.
Body() []byte
// Acknowledger provides acknowledgement information.
Acknowledger() amqp.Acknowledger
// Header returns the message header.
Header() amqp.Table
// ContentType returns the message content type.
ContentType() string
// ContentEncoding returns the message content encoding.
ContentEncoding() string
// DeliveryMode returns the delivery mode.
DeliveryMode() uint8
// Priority returns the message priority.
Priority() uint8
// CorelationId returns the correlation id.
CorelationId() string
// ReplyTo returns the reply to value.
ReplyTo() string
// Expiration returns the message expiration.
Expiration() string
// MessageId returns the message id.
MessageId() string
// Timestamp returns the message timestamp.
Timestamp() time.Time
// Type returns the message type.
Type() string
// UserId returns the creating user id.
UserId() string
// AppId returns the creating application id.
AppId() string
// ConsumerTag returns the consumer tag.
ConsumerTag() string
// MessageCount returns the number of messages pending acknowledgement.
MessageCount() uint32
// DeliveryTag returns the delivery tag.
DeliveryTag() uint64
// Redelivered returns true if this message is being redelivered.
Redelivered() bool
// Exchange returns the exchange this message was published to.
Exchange() string
// RoutingKey returns the routing key used when publishing this message.
RoutingKey() string
}
func NewDelivery(d amqp.Delivery) RabbitDelivery {
return &rabbitDelivery{d: d}
}
type rabbitDelivery struct {
d amqp.Delivery
}
func (r *rabbitDelivery) Priority() uint8 {
return r.d.Priority
}
func (r *rabbitDelivery) Header() amqp.Table {
return r.d.Headers
}
func (r *rabbitDelivery) DeliveryMode() uint8 {
return r.d.DeliveryMode
}
func (r *rabbitDelivery) CorelationId() string {
return r.d.CorrelationId
}
func (r *rabbitDelivery) ContentType() string {
return r.d.ContentType
}
func (r *rabbitDelivery) ContentEncoding() string {
return r.d.ContentEncoding
}
func (r *rabbitDelivery) Body() []byte {
return r.d.Body
}
func (r *rabbitDelivery) Acknowledger() amqp.Acknowledger {
return r.d.Acknowledger
}
func (r *rabbitDelivery) Ack(multiple bool) error {
return r.d.Ack(multiple)
}
func (r *rabbitDelivery) Nack(multiple, requeue bool) error {
return r.d.Nack(multiple, requeue)
}
func (r *rabbitDelivery) Reject(requeue bool) error {
return r.d.Reject(requeue)
}
func (r *rabbitDelivery) MessageId() string {
return r.d.MessageId
}
func (r *rabbitDelivery) AppId() string {
return r.d.AppId
}
func (r *rabbitDelivery) Timestamp() time.Time {
return r.d.Timestamp
}
func (r *rabbitDelivery) Type() string {
return r.d.Type
}
func (r *rabbitDelivery) UserId() string {
return r.d.UserId
}
func (r *rabbitDelivery) ConsumerTag() string {
return r.d.ConsumerTag
}
func (r *rabbitDelivery) DeliveryTag() uint64 {
return r.d.DeliveryTag
}
func (r *rabbitDelivery) Redelivered() bool {
return r.d.Redelivered
}
func (r *rabbitDelivery) Exchange() string {
return r.d.Exchange
}
func (r *rabbitDelivery) RoutingKey() string {
return r.d.RoutingKey
}
func (r *rabbitDelivery) CorrelationId() string {
return r.d.CorrelationId
}
func (r *rabbitDelivery) ReplyTo() string {
return r.d.ReplyTo
}
func (r *rabbitDelivery) Expiration() string {
return r.d.Expiration
}
func (r *rabbitDelivery) MessageCount() uint32 {
return r.d.MessageCount
}