method KafkaBroker.prototype.request
Since 0.1.0
KafkaBroker.prototype.request<TReq, TRes>(
topic: string,
message: TReq,
options?: RequestOptions
): Promise<TRes>

Sends a request and awaits its single correlated reply.

Replies arrive on the shared reply topic (KafkaOptions.replyTopic, default 'messaging.replies'), which must exist — this broker creates no topics, because IKafkaFactory exposes no admin surface. Either pre-create it or enable auto.create.topics.enable; otherwise the underlying producer error surfaces from this call rather than hanging until the timeout.

Type Parameters

TReq

The request payload type

TRes

The reply payload type

Parameters

topic: string

Destination topic a responder is listening on

message: TReq

The request payload

optional
options: RequestOptions

Reply timeout behavior

Return Type

Promise<TRes>

The reply payload

Throws

RequestTimeoutError

When no reply arrives within timeoutMs

RemoteHandlerError

When the responder throws

Usage

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