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

Kafka Reactive Binder does not work with multiple bindings #2965

Open
akoufa opened this issue Jun 25, 2024 · 1 comment
Open

Kafka Reactive Binder does not work with multiple bindings #2965

akoufa opened this issue Jun 25, 2024 · 1 comment

Comments

@akoufa
Copy link

akoufa commented Jun 25, 2024

When using the Kafka Reactive Binder to consume messages from two different Kafka Cluster the app start fails with onfigReactiveWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context

I have a similar setup like the following:

spring:
  cloud:
    stream:
      binders:
        kafka1:
          type: kafka
          environment:
            spring:
              cloud:
                stream:
                  kafka:
                    binder:
                      brokers: kafka-cluster-1:9092
                      configuration:
                        security.protocol: SSL
                        ssl.truststore.location: /path/to/truststore.jks
                        ssl.truststore.password: yourpassword
        kafka2:
          type: kafka
          environment:
            spring:
              cloud:
                stream:
                  kafka:
                    binder:
                      brokers: kafka-cluster-2:9092
                      configuration:
                        security.protocol: SSL
                        ssl.truststore.location: /path/to/truststore.jks
                        ssl.truststore.password: yourpassword

      bindings:
        input1-in-0:
          destination: topic1
          binder: kafka1
        input2-in-0:
          destination: topic2
          binder: kafka2

and

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-stream</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-stream-binder-kafka-reactive</artifactId>
</dependency>

I tried to add the dependency:

  <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-stream-binder-kafka</artifactId>
    </dependency>

so that the configuration works but then the reactive part is ignored and it seems that the messages are consumed on a non reactive thread container-0-C-1 instead of nc-read-local-1 .

@sobychacko sobychacko added this to the 4.2.0-M1 milestone Jun 25, 2024
@sobychacko
Copy link
Contributor

Reactive Kafka binder does not have support for multi binders (or at least we haven't tested this yet). We can add this as an enhancement item for the next release. If you are up to it, we welcome any PR contributions.

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

No branches or pull requests

3 participants