Skip to main content

CloudEventHandler

@webda/cloudevents


Variable: CloudEventHandler

const CloudEventHandler: {(value, context): void | AnyMethod; (...args): (value, context) => void | AnyMethod; }

Defined in: cloudevents/src/services/cloudeventsreceiver.service.ts:201

Declare a method of a service as the handler of a CloudEvent type

The method receives (event, context) like a CloudEventHandlerFunction; the CloudEventsReceiver discovers it on every service when it initializes, like the Router discovers @Route.

class Orders extends Service {
⁣@CloudEventHandler("com.acme.order.created")
async onOrderCreated(event: CloudEvent<Order>) { ... }
}

Call Signature​

(value, context): void | AnyMethod

Parameters​

value​

AnyMethod

context​

ClassMethodDecoratorContext

Returns​

void | AnyMethod

Call Signature​

(...args): (value, context) => void | AnyMethod

Parameters​

args​

...[type: string]

Returns​

(value, context) => void | AnyMethod

Param​

type

exact type of the events the method handles