935
transitionCount int64,
936
task hsm.Task,
938
>
ser, ok := stateMachineRegistry.TaskSerializer(task.Type())
939
>
if !ok {
940
return serviceerror.NewInternalf("no task serializer for %v", task.Type())
941
}
943
>
if err != nil {
944
return err
945
}
946
>
ppath := make([]*persistencespb.StateMachineKey, len(subStateMachinePath))
task_generator.go
947
>
for i, k := range subStateMachinePath {
948
>
ppath[i] = &persistencespb.StateMachineKey{
949
>
Type: k.Type,
950
>
Id: k.ID,
951
>
}
952
>
}
953
>
machineLastUpdateVersionedTransition := node.InternalRepr().GetLastUpdateVersionedTransition()
954
>
955
>
currentVersionedTransition := mutableState.CurrentVersionedTransition()
956
>
ref := &persistencespb.StateMachineRef{
957
>
Path: ppath,
958
>
MutableStateVersionedTransition: currentVersionedTransition,
959
>
MachineInitialVersionedTransition: node.InternalRepr().GetInitialVersionedTransition(),
960
>
MachineLastUpdateVersionedTransition: machineLastUpdateVersionedTransition,
961
>
MachineTransitionCount: transitionCount,
962
>
}
963
>
964
>
// Task is invalid at generation time.
965
>
// This may happen during replication when multiple event batches are applied in a single transaction.
966
>
if err := task.Validate(ref, node); err != nil {
967
return nil
968
}
969
971
>
Ref: ref,
972
>
Type: task.Type(),
973
>
Data: data,
974
>
}
975
>
// NOTE: at the moment deadline is mutually exclusive with destination.
976
>
// This will change when we add the outbound timer queue.
977
>
if task.Deadline() != hsm.Immediate {
978
if task.Destination() != "" {
979
// TODO: support outbound timer tasks.