Skip to content

Commit 558bcb0

Browse files
committed
Subscription improvements
1 parent c757e5a commit 558bcb0

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

broker/client.go

+9-6
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,14 @@ func (c *openBOSClient) getOntologyVersion() (int32, error) {
220220
}
221221

222222
type subscriptionCreateDTO struct {
223-
MinSendTime int32 `json:"minSendTime"` // [ms]Minimum time between two events. To avoid events flushing. Highly recommended. If zero, events will be sent on the fly (NOT recommended). Min value: 1 mn (60 000)
223+
// MinSendTime : 5 mn. You have event with minimum 5 mn between events.
224+
// If you do not have an event for the last 10 mn, then if an event occur it will be send immediately
225+
// AlignSendTime. Same. But two differences.
226+
// First event will be send on align time. That is 10h 10h5, 10h10 etc ...
227+
// If you do not have an event for the last 10 mn, then if an event occur it will be send on the next rounded 5mn hour
228+
MinSendTime int32 `json:"minSendTime"` // [ms]Minimum time between two events. To avoid events flushing. Highly recommended. If zero, events will be sent on the fly (NOT recommended). Min value: 1 mn (60 000). Set either this or AlignSendTime
229+
AlignSendTime int32 `json:"alignSendTime"` // [ms]Align time between two events. Min value: 1 mn. Set either this or MinSendTime
224230
MaxSendTime int32 `json:"maxSendTime"` // [ms]Maximum time between two events. Can be used to ensure the client application that the connection is alive. If nothing must be sent, the edge will send an empty event. Min value: 1 mn
225-
AlignSendTime int32 `json:"alignSendTime"` // [ms]Align time between two events. Min value: 1 mn
226231
Timestamp *string `json:"timestamp,omitempty"` // UTC date. To receive only datapoints or properties that change since the timestamp.
227232
WebHookURL *string `json:"webhookURL,omitempty"` // URL of the webhook.
228233
WebHookRetries int32 `json:"webhookRetryCount"` // Interval of retries (in seconds) when an error occurs while sending an event.
@@ -249,7 +254,6 @@ func (c *openBOSClient) subscribeToOntologyChanges(configID int64) (*subscriptio
249254
sub := subscriptionCreateDTO{
250255
MinSendTime: 60000,
251256
MaxSendTime: 240000,
252-
AlignSendTime: 120000,
253257
WebHookURL: common.Ptr(webhookURL),
254258
WebHookRetries: 15,
255259
WebHookRetryDelay: 2,
@@ -287,8 +291,8 @@ func (c *openBOSClient) subscribeToDataChanges(configID int64) error {
287291
}
288292

289293
sub := subscriptionCreateDTO{
294+
// MinSendTime: 60000,
290295
MaxSendTime: 240000,
291-
AlignSendTime: 60000,
292296
WebHookURL: common.Ptr(webhookURL),
293297
WebHookRetries: 15,
294298
WebHookRetryDelay: 2,
@@ -611,9 +615,8 @@ func (c *openBOSClient) subscribeToAlarmChanges(configID int64) error {
611615
}
612616

613617
sub := subscriptionCreateDTO{
614-
MinSendTime: 60000,
618+
// MinSendTime: 60000,
615619
MaxSendTime: 240000,
616-
AlignSendTime: 120000,
617620
WebHookURL: common.Ptr(webhookURL),
618621
WebHookRetries: 15,
619622
WebHookRetryDelay: 2,

0 commit comments

Comments
 (0)