Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stopAfterLastMessage not working as expected. #301

Open
henzeb opened this issue Jul 21, 2024 · 1 comment
Open

stopAfterLastMessage not working as expected. #301

henzeb opened this issue Jul 21, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@henzeb
Copy link

henzeb commented Jul 21, 2024

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

@henzeb henzeb added the bug Something isn't working label Jul 21, 2024
@henzeb
Copy link
Author

henzeb commented Jul 21, 2024

seems something to do with a timeout. setting consumer_timeout_ms to 4000 seems to work. Either this needs to be addressed in the documentation or the default timeout needs an increase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants