TsgcWSPClient_KafkaMethods › Subscribe

Subscribe Method

Subscribes to one or more topics.

Syntax

procedure Subscribe(const aTopics: array of string);

Parameters

Remarks

Starts consuming the given topics. When a GroupId is configured in KafkaOptions, the client joins the consumer group and the broker assigns partitions to it. When no GroupId is set, the client assigns all partitions of the topics to itself. After subscribing, call Poll to fetch records or handle them in the OnKafkaMessage event. Use Unsubscribe to stop consuming.

Example

oKafka.Subscribe(['my-topic']);

Back to Methods