kafka_offset()

Decription:

Set offset(s) for specified partition(s) of the current topic in a consumer group.

Syntax:

kafka_offset(fd, offset)

kafka_offset(fd, offset,[partition1, partition2,…])

kafka_offset(fd, [partitionOffset1, partitionOffset2,…])

Note:

The external library function (See External Library Guide) sets offset for each partition of the current topic when only parameter offset is present, or sets offset(s) for specified partition(s) when parameter partition is absent. When there is parameter [partitionOffset1,…], the parameter corresponds to the sequence of partitions.

Parameter:

fd

A consumer object

offset

Offset of the consumer group

partition

Index numbers of partitions in a topic

partitionOffset

Offsets of partitions

Return value:

Boolean value

Example:

 

A

 

1

=kafka_open("D://kafka.properties","topic-test")

Connect to Kafka server.

2

=kafka_offset(A1,10)

Set offset for each partition in topic-test.

3

=kafka_offset(A1,10,[1,2])

Set offsets for partition1 and partition2 in topic-test.

4

=kafka_offset(A1,[2,13])

Set offset as 2 for partition0 and offset as 13 for partition1 in topic-test.