333
return nil, handler.handleCommandProtocolMessage(ctx, command.GetProtocolMessageCommandAttributes(), msgs)
334
336
>
// TODO: need to handle migration between HSM and CHASM
337
>
338
>
handlerOpts := chasmworkflow.CommandHandlerOptions{
339
>
WorkflowTaskCompletedEventID: handler.workflowTaskCompletedID,
340
>
}
341
>
validator := commandValidator{sizeChecker: handler.sizeLimitChecker, commandType: command.GetCommandType()}
342
>
343
>
// Try CHASM command handler first, fall back to HSM if not supported.
344
>
handledByCHASM := false
345
>
if handler.mutableState.ChasmEnabled() {
346
>
if chasmHandler, ok := handler.chasmWorkflowRegistry.CommandHandler(command.GetCommandType()); ok {
347
>
handler.mutableState.EnsureChasmWorkflowComponent(ctx)
348
>
chasmWorkflow, chasmCtx, chasmErr := handler.mutableState.ChasmWorkflowComponent(ctx)
349
>
if chasmErr != nil {
350
return nil, chasmErr
351
}
353
>
// Fall back to the HSM handler either when the command type is not supported by CHASM (disabled
354
>
// feature flag) or when the targeted entity is not owned by the CHASM tree (e.g. an operation
355
>
// scheduled in HSM before the flag was flipped on).
356
>
handledByCHASM = !errors.Is(err, chasmworkflow.ErrCommandNotSupported) &&
357
>
!errors.Is(err, chasmworkflow.ErrCommandTargetNotFound)
358
}
359
}
361
hsmHandler, ok := handler.commandHandlerRegistry.Handler(command.GetCommandType())
362
if !ok {