forked from jjeffery/stomp
-
Notifications
You must be signed in to change notification settings - Fork 97
/
Copy pathack.go
48 lines (41 loc) · 1.16 KB
/
ack.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
package stomp
import (
"github.com/go-stomp/stomp/v3/frame"
)
// The AckMode type is an enumeration of the acknowledgement modes for a
// STOMP subscription.
type AckMode int
// String returns the string representation of the AckMode value.
func (a AckMode) String() string {
switch a {
case AckAuto:
return frame.AckAuto
case AckClient:
return frame.AckClient
case AckClientIndividual:
return frame.AckClientIndividual
}
panic("invalid AckMode value")
}
// ShouldAck returns true if this AckMode is an acknowledgement
// mode which requires acknowledgement. Returns true for all values
// except AckAuto, which returns false.
func (a AckMode) ShouldAck() bool {
switch a {
case AckAuto:
return false
case AckClient, AckClientIndividual:
return true
}
panic("invalid AckMode value")
}
const (
// No acknowledgement is required, the server assumes that the client
// received the message.
AckAuto AckMode = iota
// Client acknowledges messages. When a client acknowledges a message,
// any previously received messages are also acknowledged.
AckClient
// Client acknowledges message. Each message is acknowledged individually.
AckClientIndividual
)