spring-cloud / spring-cloud/spring-cloud-stream

Can't convert Binder to KafkaMessageChannelBinder!!!!!!!

Open
#3,135 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

waiting-on-feedback
Dominant language
Java
Stars
1.1k
Forks
646
Avg merge
2d 3h
Merged PRs (30d)
8

Description

Iunconvertible types; cannot cast 'org.springframework.cloud.stream.binder.Binder<capture<?>,org.springframework.cloud.stream.binder.ConsumerProperties,org.springframework.cloud.stream.binder.ProducerProperties>' to 'org.springframework.cloud.stream.binder.kafka.KafkaMessageChannelBinder'

@Bean
public BinderCustomizer kafkaBinderCustomizer() {
    return (binder, binderName) -> {
        if (binder instanceof KafkaMessageChannelBinder) {
            KafkaMessageChannelBinder kafkaBinder = (KafkaMessageChannelBinder) binder;
        }
    };
}

When I debug the following code, the type of binder is KafkaMessageChannelBinder in debugger :)

@Bean
public BinderCustomizer kafkaBinderCustomizer() {
    return (binder, binderName) -> {
        System.out.println("hello world");
    };
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the BinderCustomizer callback and compare its Binder<?, ConsumerProperties, ProducerProperties> signature with KafkaMessageChannelBinder. Reproduce the compiler error from the shown configuration and inspect how the Kafka binder is exposed at runtime. Done means the documented customization path handles the Kafka binder without the reported incompatible cast.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kafka, spring
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.