329
includeAlreadySent bool,
330
workflowTaskStartedEventID int64,
332
>
var outgoingMessages []*protocolpb.Message
333
>
334
>
// TODO (alex-update): currently sequencing_id is simply pointing to the
335
>
// event before WorkflowTaskStartedEvent. SDKs are supposed to respect this
336
>
// and process messages (specifically, updates) after event with that ID.
337
>
// In the future, sequencing_id could point to some specific event
338
>
// (specifically, signal) after which the update should be processed.
339
>
// Currently, it is not possible due to buffered events reordering on server
340
>
// and events reordering in some SDKs.
341
>
sequencingEventID := &protocolpb.Message_EventId{EventId: workflowTaskStartedEventID - 1}
342
>
343
>
// Sort Updates by the time they were admitted to send them in deterministic order.
344
>
var sortedUpdates []*Update
345
>
for _, upd := range r.updates {
346
sortedUpdates = append(sortedUpdates, upd)
347
}
348
>
slices.SortStableFunc(sortedUpdates, func(u1, u2 *Update) int { return u1.admittedTime.Compare(u2.admittedTime) })
registry.go
349
351
outgoingMessage := upd.Send(includeAlreadySent, sequencingEventID)
352
if outgoingMessage != nil {