-
Notifications
You must be signed in to change notification settings - Fork 1
/
types.go
156 lines (127 loc) · 4.21 KB
/
types.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
package solace
import "unsafe"
type FWD_MODE uint32
type ACK_MODE uint32
type EVENT_TYPE uint32
type CONNECTIVITY_STATUS uint32
type DESTINATION_TYPE uint32
const (
// Fwd-Mode enumeration for guaranteed message delivery to consumers;
// see argument to func BindQueue()
FWD_MODE_STORE_FWD FWD_MODE = 1
FWD_MODE_CUT_THRU FWD_MODE = 2
)
const (
// Ack-Mode enumeration for consumer acknowledgement of guaranteed
// message; in the case of MANUAL_ACK, the consuming application
// is responsible for calling the AckMsg() function for messages
// it has succesfully consumed/processed and thus does not require
// redelivery. See argument to func BindQueue().
ACK_MODE_AUTO ACK_MODE = 1
ACK_MODE_MANUAL ACK_MODE = 2
)
const (
// Publisher Event Type enumeration for publisher-related guaranteed
// message events; possible events are message ACK and REJECT. See
// PubEvent struct member Type.
EVENT_TYPE_ACK EVENT_TYPE = 1
EVENT_TYPE_REJECT EVENT_TYPE = 2
)
const (
// Connectivity Event Type enumeration for session-related
// connectivity events; possible events triggered include connection
// UP/DOWN, RECONNECTING and RECONNECTED. See ConEvent struct member
// Type.
CONNECTIVITY_STATUS_UP CONNECTIVITY_STATUS = 1
CONNECTIVITY_STATUS_RECONNECTING CONNECTIVITY_STATUS = 2
CONNECTIVITY_STATUS_RECONNECTED CONNECTIVITY_STATUS = 3
CONNECTIVITY_STATUS_DOWN CONNECTIVITY_STATUS = 4
)
const (
// Destination enumeration for published messages over any transport;
// possible destinations are TOPIC or QUEUE. see SendDirect documentation
// and MsgEvent member DestType.
DESTINATION_TYPE_TOPIC DESTINATION_TYPE = 1
DESTINATION_TYPE_QUEUE DESTINATION_TYPE = 2
DESTINATION_TYPE_NONE DESTINATION_TYPE = 3
)
/*
ErrEvent is passed to a registered ErrHandler callback for each Solace
error-event received
*/
type ErrorEvent struct {
Session uint64
FunctionName string
ReturnCode int
RCStr string
SubCode int
SCStr string
ResponseCode int
ErrorStr string
}
/*
PubEvent is passed to a registered PubHandler callback for each
Solace publisher-event received such as message ACK or REJECT events; for
streaming publishers it can include publisher-provided correlation data.
*/
type PublisherEvent struct {
Session uint64
Type string
CorrelationData unsafe.Pointer
}
/*
ConEvent is passed to a registered ConHandler callback for each Solace
connectivity-event received such as disconnect/reconnecting/reconnected
events
*/
type ConnectionEvent struct {
Session uint64
Type string
}
/*
MessageEvent is passed to a registered MsgHandler callback for each Solace
message-event received, for either Guaranteed or Direct transports
*/
type MessageEvent struct {
Session uint64
DestinationType string
Destination string
ReplyToDestinationType string
ReplyToDestination string
Flow uint64
MessageID uint64
MessageType string
BinaryPayload []byte
BinaryPayloadLen uint
CorrelationID string
RequestID int
Redelivered bool
Discard bool
UserProperties string
}
type ISolace interface {
GetMessageChannel() chan MessageEvent
GetErrorChannel() chan ErrorEvent
GetConnectionChannel() chan ConnectionEvent
GetPublisherChannel() chan PublisherEvent
NotifyOnMessage(func(msg MessageEvent))
NotifyOnConnection(callback func(msg ConnectionEvent))
NotifyOnError(callback func(msg ErrorEvent))
NotifyOnPublisher(callback func(msg PublisherEvent))
Connect(host string, vpn string, user string, pass string, appName string, appDesc string, windowsize string, compression_level string)
Disconnect()
Subscribe(topic string)
Unsubscribe(topic string)
Publish(
destinationType DESTINATION_TYPE, target string,
replyToDestType DESTINATION_TYPE, replyTo string,
messageType string,
payload []byte,
userProperties map[string]interface{},
correlationID string,
correlationData int,
)
SubscribeQueue(queueName string, mode ACK_MODE)
UnsubscribeQueue(queueName string)
Ack(flow uint64, msgID uint64)
}