method KafkaBroker.prototype.respond
Since 0.1.0
KafkaBroker.prototype.respond<TReq, TRes>(
topic: string,
handler: RequestHandler<TReq, TRes>,
): Promise<ISubscription>

Registers a responder for a request topic. The handler's resolved value is sent back to the caller, correlated to the originating request.

Type Parameters

TReq

The request payload type

TRes

The reply payload type

Parameters

topic: string

The request topic to respond on

Invoked per request; its result is returned to the caller

optional
options: SubscribeOptions

Consumer group behavior (load-balance competing responders)

Return Type

Promise<ISubscription>

The active subscription

Usage

import { KafkaBroker } from "messaging-plugin/src/index.ts";