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

[BUG] CONFWARN on consumer with auto.offset.reset #75

Closed
therealsqvad opened this issue Feb 16, 2022 · 2 comments · Fixed by #76
Closed

[BUG] CONFWARN on consumer with auto.offset.reset #75

therealsqvad opened this issue Feb 16, 2022 · 2 comments · Fixed by #76
Assignees

Comments

@therealsqvad
Copy link

Describe the bug
CONFWARN occurs when starting $consumer->consume();

To Reproduce
Steps to reproduce the behavior:

  1. Start consumer with option auto.offset.reset
 $consumer = Kafka::createConsumer(['topic', 'topic2'], 'group1', $broker_addr)
            ->withOptions([
                'auto.offset.reset'                     => 'earliest'
            ])
            ->withHandler(function (ConsumedMessage $message) { })
            ->build();
 $consumer->consume();
  1. We get the warning "Configuration property auto.offset.reset is a consumer property and will be ignored by this producer instance". But we did not launch a producer, only a consumer
  2. We get the warning "Configuration property compression.codec is a producer property and will be ignored by this consumer instance". But we did not specify the option compression.codec

Why is the option compression.codec passed to getConsumerOptions , which is relevant only for the producer

'compression.codec' => config('kafka.compression', 'snappy'),

Why is a producer created when calling consume()?

$this->producer = app(KafkaProducer::class, [

Expected behavior
The consumer will start without errors or warnings.

Additional context
Logs:

%4|1645017413.959|CONFWARN|rdkafka#consumer-1| [thrd:app]: Configuration property compression.codec is a producer property and will be ignored by this consumer instance
%4|1645017413.963|CONFWARN|rdkafka#producer-2| [thrd:app]: Configuration property auto.offset.reset is a consumer property and will be ignored by this producer instance
@mateusjunges
Copy link
Owner

Hey @therealsqvad, i've created a pr to fix some issues i found while reading this.

Why is the option compression.codec passed to getConsumerOptions , which is relevant only for the producer

Since you passed the compression.codec via withOptions method, it is intended as a custom option, and it is passed to the consumer builder. The problem is that the consumer creates a new producer to send messages to the dead letter queue, and the producer was being created with the same config options. I added a filter to reject consumer options while creating a producer, and also to reject producer options while creating consumers.

Thanks for reporting.

@therealsqvad
Copy link
Author

@mateusjunges Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants