跳转到内容
简体中文

KafkaOptionsBuilder

此内容尚不支持你的语言。

Defined in: src/io/broker/KafkaOptions.ts:57

new KafkaOptionsBuilder(): KafkaOptionsBuilder

KafkaOptionsBuilder

BrokerOptionsBuilder<KafkaOptionsType>.constructor

build(): Partial<T>

Defined in: src/util/OptionsBuilder.ts:51

Snapshot the set fields as an independent Partial<T> (own props only).

Partial<T>

BrokerOptionsBuilder.build


withBrokers(brokers): this

Defined in: src/io/broker/KafkaOptions.ts:64

Bootstrap servers ('kafka-1:9092,kafka-2:9092' or array).

string | readonly string[]

this


withCircuitBreaker(failureThreshold, resetMs): this

Defined in: src/io/broker/BrokerOptions.ts:125

Circuit breaker around connect attempts.

number

number

this

BrokerOptionsBuilder.withCircuitBreaker


withClientId(clientId): this

Defined in: src/io/broker/KafkaOptions.ts:69

Stable client id reported to the broker.

string

this


withConsumer(consumer): this

Defined in: src/io/broker/KafkaOptions.ts:89

Consumer options. groupId is required to start a consumer.

KafkaCommitMode

Offset-commit policy. Default 'auto' — kafkajs auto-commits after the handler returns (at-least-once). See KafkaCommitMode for the 'manual' (exactly-once-with- processing) shape.

number

Max time in ms the manual-commit pump waits for an external commit / nack before giving up on a message and letting kafkajs reject it (which triggers a rebalance and re-delivery). Only used when commitMode === 'manual'. Default 30s.

boolean

string

this


withOutboundBuffer(limit): this

Defined in: src/io/broker/BrokerOptions.ts:130

Outbound buffer size (messages held while disconnected). Default 1000; 0 = fail-fast.

number

this

BrokerOptionsBuilder.withOutboundBuffer


withProducer(producer): this

Defined in: src/io/broker/KafkaOptions.ts:84

Producer options (idempotence / auto-topic-creation).

boolean

boolean

this


withReconnect(policy): this

Defined in: src/io/broker/BrokerOptions.ts:120

Reconnect policy (or false to disable auto-reconnect).

false | { factor?: number; initialDelayMs?: number; maxAttempts?: number; maxDelayMs?: number; } | undefined

false


{ factor?: number; initialDelayMs?: number; maxAttempts?: number; maxDelayMs?: number; }

number

number

number

Cap on retry attempts. Default: Infinity (retry forever).

number


undefined

this

BrokerOptionsBuilder.withReconnect


withSasl(sasl): this

Defined in: src/io/broker/KafkaOptions.ts:74

SASL credentials.

"plain" | "scram-sha-256" | "scram-sha-512"

string

string

this


withSsl(on?): this

Defined in: src/io/broker/KafkaOptions.ts:79

Enable TLS. Default false.

boolean = true

this


withTarget(target): this

Defined in: src/io/broker/KafkaOptions.ts:94

Subscriber that receives every consumed record.

ActorRef<KafkaRecord>

this


withTopics(topics): this

Defined in: src/io/broker/KafkaOptions.ts:99

Topics the consumer subscribes to at connect time.

readonly string[]

this


static create(): KafkaOptionsBuilder

Defined in: src/io/broker/KafkaOptions.ts:59

Start a fresh builder. Equivalent to new KafkaOptionsBuilder().

KafkaOptionsBuilder