onEvent
onEvent<
TSchema>(contract,handler,options?):EventHandlerDeclaration
Defined in: packages/hoppity/src/handlers/onEvent.ts:16
Declares a typed event handler for use in the service config handlers array.
The handler’s content parameter type is inferred from the contract’s schema, so passing a handler whose content type doesn’t match the event schema is a compile-time error rather than a runtime surprise.
Type Parameters
Section titled “Type Parameters”TSchema
Section titled “TSchema”TSchema extends ZodTypeAny
Parameters
Section titled “Parameters”contract
Section titled “contract”EventContract<any, any, TSchema>
The EventContract to handle
handler
Section titled “handler”EventHandler<TSchema>
The handler function
options?
Section titled “options?”Optional queue/redelivery/dead-letter overrides