Skip to content

onCommand

onCommand<TSchema>(contract, handler, options?): CommandHandlerDeclaration

Defined in: packages/hoppity/src/handlers/onCommand.ts:15

Declares a typed command handler for use in the service config handlers array.

Same type-inference behavior as onEvent — the contract’s schema drives the handler’s content type.

TSchema extends ZodTypeAny

CommandContract<any, any, TSchema>

The CommandContract to handle

CommandHandler<TSchema>

The handler function

HandlerOptions

Optional queue/redelivery/dead-letter overrides

CommandHandlerDeclaration