Skip to content

Feature request: pause/resume support #120

Closed
@Ycallaer

Description

@Ycallaer

Hi all,
I've got a question about the difference in behaviour of consumer.poll(0).
If you check the java doc for the consumer ( https://kafka.apache.org/0100/javadoc/index.html?org/apache/kafka/clients/consumer/KafkaConsumer.html) it states the following for the poll(0) function:

If 0, returns immediately with any records that are available currently in the buffer, else returns empty

I tried to do the same in python but when executing the code it already gives me the next record.
Sample of the code I am using:
`

                    future_response= executor.submit(do_processing,msg.value(),self.logger, kafka_key.generated_uuid,False,False)

                    is_running = True
                    while is_running == True:
                        is_running=future_response.running()
                        self.logger.info("Still waiting for the future to finish. Going into sleep")
                        msgx=consumer.poll(0)
                        time.sleep(0.5)

`
If I do a print statement of msgx.value() in the while loop it gives me the next record.
Why is there a difference in implementation ?
Is there a way to do manual heartbeating in python?

Since the future might take a while to get the result I want to avoid to set session.timeout.ms to a very high value.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions