Skip to content

stopAfterLastMessage not working as expected. #301

@henzeb

Description

@henzeb

Describe the bug
stopAfterLastMessage does not work as expected. I expected it to consume all messages from the last offset it had consumed, but instead it just stops the process.

To Reproduce
Steps to reproduce the behavior:

  1. create the topic test_topic
  2. publish a few messages to this topic
  3. now listen to this topic using the following code:
Kafka::consumer()
            ->subscribe('test_topic')
            ->withMaxMessages(50)
            ->stopAfterLastMessage()
            ->withHandler(
                function(ConsumerMessage $message){
                    dump($message->getBody());
                }
            )->build()
            ->consume();

Expected behavior
I expect to see the messages I sent in step 2 to show up and then the process ends.

Actual behavior
Stops the process without even consuming the messages.

Additional context
PHP 8.2
latest rdkafka extension version
latest laravel-kafka version

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions