Vert.x Kafka consumer.
You receive Kafka records by providing a @see \io\vertx\jphp\kafka\client\consumer\KafkaConsumer::handler. As messages arrive the handler will be called with the records.
The @see \io\vertx\jphp\kafka\client\consumer\KafkaConsumer::pause and @see \io\vertx\jphp\kafka\client\consumer\KafkaConsumer::resume provides global control over reading the records from the consumer.
The @see \io\vertx\jphp\kafka\client\consumer\KafkaConsumer::pause and @see \io\vertx\jphp\kafka\client\consumer\KafkaConsumer::resume provides finer grained control over reading records for specific Topic/Partition, these are Kafka's specific operations.
package |
Default |
---|
__construct()
assign( $arg0, $arg1 = null) : $this
param $topicPartition [TopicPartition | array] partition which want assigned assign($topicPartition)
Manually assign a list of partition to this consumer.
param $topicPartitions [array] partitions which want assigned assign($topicPartitions)
Manually assign a partition to this consumer.
Due to internal buffering of messages, when reassigning
the old partition may remain in effect
(as observed by the record handler)}
until some time after the given completionHandler
is called. In contrast, the once the given completionHandler
is called the @see \io\vertx\jphp\kafka\client\consumer\KafkaConsumer::batchHandler will only see messages
consistent with the new partition.
param $topicPartition [TopicPartition | array] partition which want assigned
param $completionHandler [callable] handler called on operation completed
assign($topicPartition, $completionHandler)
Manually assign a list of partition to this consumer.
Due to internal buffering of messages, when reassigning
the old set of partitions may remain in effect
(as observed by the record handler)}
until some time after the given completionHandler
is called. In contrast, the once the given completionHandler
is called the @see \io\vertx\jphp\kafka\client\consumer\KafkaConsumer::batchHandler will only see messages
consistent with the new set of partitions.
param $topicPartitions [array] partitions which want assigned
param $completionHandler [callable] handler called on operation completed
assign($topicPartitions, $completionHandler)
array | TopicPartition
callable
$this
current KafkaConsumer instance
assignment( $arg0) : $this
callable
$this
current KafkaConsumer instance
batchHandler( $arg0) : $this
callable
$this
current KafkaConsumer instance
beginningOffsets( $arg0, $arg1) : void
array | TopicPartition
callable
close( $arg0 = null) : void
close()
Close the consumer
param $completionHandler [callable] handler called on operation completed close($completionHandler)
callable
commit( $arg0 = null) : void
commit()
Commit current offsets for all the subscribed list of topics and partition.
param $completionHandler [callable] handler called on operation completed commit($completionHandler)
callable
committed( $arg0, $arg1) : void
array | TopicPartition
callable
create( $arg0, $arg1, $arg2 = null, $arg3 = null) : \io\vertx\jphp\kafka\client\consumer\KafkaConsumer<K,V>
param $vertx [Vertx] Vert.x instance to use param $config [array] Kafka consumer configuration create($vertx, $config)
Create a new KafkaConsumer instance
param $vertx [Vertx] Vert.x instance to use param $config [array] Kafka consumer configuration param $keyType [string] class type for the key deserialization param $valueType [string] class type for the value deserialization create($vertx, $config, $keyType, $valueType)
Vertx
array
string
string
\io\vertx\jphp\kafka\client\consumer\KafkaConsumer
an instance of the KafkaConsumer
endHandler( $arg0) : $this
callable
$this
endOffsets( $arg0, $arg1) : void
array | TopicPartition
callable
exceptionHandler( $arg0) : $this
callable
$this
fetch( $arg0) : $this
integer
$this
a reference to this, so the API can be used fluently
handler( $arg0) : $this
callable
$this
offsetsForTimes( $arg0, $arg1, $arg2) : void
array | TopicPartition
integer
callable
partitionsAssignedHandler( $arg0) : $this
callable
$this
current KafkaConsumer instance
partitionsFor( $arg0, $arg1) : $this
string
callable
$this
current KafkaConsumer instance
partitionsRevokedHandler( $arg0) : $this
callable
$this
current KafkaConsumer instance
pause( $arg0 = null, $arg1 = null) : $this
Suspend fetching from the requested partition.
param $topicPartition [TopicPartition | array] topic partition from which suspend fetching pause($topicPartition)
Suspend fetching from the requested partitions.
param $topicPartitions [array] topic partition from which suspend fetching pause($topicPartitions)
Suspend fetching from the requested partition.
Due to internal buffering of messages,
the will
continue to observe messages from the given topicPartition
until some time after the given completionHandler
is called. In contrast, the once the given completionHandler
is called the @see \io\vertx\jphp\kafka\client\consumer\KafkaConsumer::batchHandler will not see messages
from the given topicPartition
.
param $topicPartition [TopicPartition | array] topic partition from which suspend fetching
param $completionHandler [callable] handler called on operation completed
pause($topicPartition, $completionHandler)
Suspend fetching from the requested partitions.
Due to internal buffering of messages,
the will
continue to observe messages from the given topicPartitions
until some time after the given completionHandler
is called. In contrast, the once the given completionHandler
is called the @see \io\vertx\jphp\kafka\client\consumer\KafkaConsumer::batchHandler will not see messages
from the given topicPartitions
.
param $topicPartitions [array] topic partition from which suspend fetching
param $completionHandler [callable] handler called on operation completed
pause($topicPartitions, $completionHandler)
array | TopicPartition
callable
$this
paused( $arg0) : void
callable
poll( $arg0, $arg1) : void
integer
callable
pollTimeout( $arg0) : \io\vertx\jphp\kafka\client\consumer\KafkaConsumer<K,V>
Setting timeout to a lower value results in a more 'responsive' client, because it will block for a shorter period if no data is available in the assigned partition and therefore allows subsequent actions to be executed with a shorter delay. At the same time, the client will poll more frequently and thus will potentially create a higher load on the Kafka Broker.
integer
\io\vertx\jphp\kafka\client\consumer\KafkaConsumer
position( $arg0, $arg1) : void
array | TopicPartition
callable
resume( $arg0 = null, $arg1 = null) : $this
Resume specified partition which have been paused with pause.
param $topicPartition [TopicPartition | array] topic partition from which resume fetching resume($topicPartition)
Resume specified partitions which have been paused with pause.
param $topicPartitions [array] topic partition from which resume fetching resume($topicPartitions)
Resume specified partition which have been paused with pause.
param $topicPartition [TopicPartition | array] topic partition from which resume fetching param $completionHandler [callable] handler called on operation completed resume($topicPartition, $completionHandler)
Resume specified partitions which have been paused with pause.
param $topicPartitions [array] topic partition from which resume fetching param $completionHandler [callable] handler called on operation completed resume($topicPartitions, $completionHandler)
array | TopicPartition
callable
$this
seek( $arg0, $arg1, $arg2 = null) : $this
param $topicPartition [TopicPartition | array] topic partition for which seek param $offset [integer] offset to seek inside the topic partition seek($topicPartition, $offset)
Overrides the fetch offsets that the consumer will use on the next poll.
Due to internal buffering of messages,
the will
continue to observe messages fetched with respect to the old offset
until some time after the given completionHandler
is called. In contrast, the once the given completionHandler
is called the @see \io\vertx\jphp\kafka\client\consumer\KafkaConsumer::batchHandler will only see messages
consistent with the new offset.
param $topicPartition [TopicPartition | array] topic partition for which seek
param $offset [integer] offset to seek inside the topic partition
param $completionHandler [callable] handler called on operation completed
seek($topicPartition, $offset, $completionHandler)
array | TopicPartition
integer
callable
$this
current KafkaConsumer instance
seekToBeginning( $arg0, $arg1 = null) : $this
param $topicPartition [TopicPartition | array] topic partition for which seek seekToBeginning($topicPartition)
Seek to the first offset for each of the given partitions.
param $topicPartitions [array] topic partition for which seek seekToBeginning($topicPartitions)
Seek to the first offset for each of the given partition.
Due to internal buffering of messages,
the will
continue to observe messages fetched with respect to the old offset
until some time after the given completionHandler
is called. In contrast, the once the given completionHandler
is called the @see \io\vertx\jphp\kafka\client\consumer\KafkaConsumer::batchHandler will only see messages
consistent with the new offset.
param $topicPartition [TopicPartition | array] topic partition for which seek
param $completionHandler [callable] handler called on operation completed
seekToBeginning($topicPartition, $completionHandler)
Seek to the first offset for each of the given partitions.
Due to internal buffering of messages,
the will
continue to observe messages fetched with respect to the old offset
until some time after the given completionHandler
is called. In contrast, the once the given completionHandler
is called the @see \io\vertx\jphp\kafka\client\consumer\KafkaConsumer::batchHandler will only see messages
consistent with the new offset.
param $topicPartitions [array] topic partition for which seek
param $completionHandler [callable] handler called on operation completed
seekToBeginning($topicPartitions, $completionHandler)
array | TopicPartition
callable
$this
current KafkaConsumer instance
seekToEnd( $arg0, $arg1 = null) : $this
param $topicPartition [TopicPartition | array] topic partition for which seek seekToEnd($topicPartition)
Seek to the last offset for each of the given partitions.
param $topicPartitions [array] topic partition for which seek seekToEnd($topicPartitions)
Seek to the last offset for each of the given partition.
Due to internal buffering of messages,
the will
continue to observe messages fetched with respect to the old offset
until some time after the given completionHandler
is called. In contrast, the once the given completionHandler
is called the @see \io\vertx\jphp\kafka\client\consumer\KafkaConsumer::batchHandler will only see messages
consistent with the new offset.
param $topicPartition [TopicPartition | array] topic partition for which seek
param $completionHandler [callable] handler called on operation completed
seekToEnd($topicPartition, $completionHandler)
Seek to the last offset for each of the given partitions.
Due to internal buffering of messages,
the will
continue to observe messages fetched with respect to the old offset
until some time after the given completionHandler
is called. In contrast, the once the given completionHandler
is called the @see \io\vertx\jphp\kafka\client\consumer\KafkaConsumer::batchHandler will only see messages
consistent with the new offset.
param $topicPartitions [array] topic partition for which seek
param $completionHandler [callable] handler called on operation completed
seekToEnd($topicPartitions, $completionHandler)
array | TopicPartition
callable
$this
current KafkaConsumer instance
subscribe( $arg0, $arg1 = null) : $this
param $topic [string] topic to subscribe to subscribe($topic)
Subscribe to the given list of topics to get dynamically assigned partitions.
param $topics [array] topics to subscribe to subscribe($topics)
Subscribe to the given topic to get dynamically assigned partitions.
Due to internal buffering of messages, when changing the subscribed topic
the old topic may remain in effect
(as observed by the record handler})
until some time after the given completionHandler
is called. In contrast, the once the given completionHandler
is called the @see \io\vertx\jphp\kafka\client\consumer\KafkaConsumer::batchHandler will only see messages
consistent with the new topic.
param $topic [string] topic to subscribe to
param $completionHandler [callable] handler called on operation completed
subscribe($topic, $completionHandler)
Subscribe to the given list of topics to get dynamically assigned partitions.
Due to internal buffering of messages, when changing the subscribed topics
the old set of topics may remain in effect
(as observed by the record handler})
until some time after the given completionHandler
is called. In contrast, the once the given completionHandler
is called the @see \io\vertx\jphp\kafka\client\consumer\KafkaConsumer::batchHandler will only see messages
consistent with the new set of topics.
param $topics [array] topics to subscribe to
param $completionHandler [callable] handler called on operation completed
subscribe($topics, $completionHandler)
string | array
callable
$this
current KafkaConsumer instance
subscription( $arg0) : $this
callable
$this
current KafkaConsumer instance
unsubscribe( $arg0 = null) : $this
unsubscribe()
Unsubscribe from topics currently subscribed with subscribe.
param $completionHandler [callable] handler called on operation completed unsubscribe($completionHandler)
callable
$this
current KafkaConsumer instance