spring-cloud / spring-cloud-stream-binder-kafka

Spring Cloud Stream binders for Apache Kafka and Kafka Streams
Apache License 2.0
331 stars 301 forks source link

Binding application-id is failing after adding spring-cloud-starter-* dependency. #1106

Closed yaboong closed 3 years ago

yaboong commented 3 years ago

I am writing this at the request of @sobychacko from spring-cloud-stream gitter.

Like I said in the title, after adding spring-cloud-starter-config and spring-cloud-starter-bootstrap to use {cipher} for encryption, binding application-id is failing.

The exception message informs that "DLQ support is not available for anonymous subscriptions" but behind the scene, the real cause is a failure of binding application-id property which makes it an anonymous subscription.

Caused by: org.springframework.context.ApplicationContextException: Failed to start bean 'inputBindingLifecycle'; nested exception is java.lang.IllegalArgumentException: DLQ support is not available for anonymous subscriptions

For a more specific explanation, I cloned kafka-streams-word-count and modified properties to have the same configuration I use in my project.

The repository is this.

Three tags are attached to commits.

  1. tags/original-example (exactly the same code that I cloned from kafka-streams-word-count)
  2. tags/success (without encryption but modified the properties like the way I use in my project)
  3. tags/fail (with encryption, it fails)

Runs successfully for the case 1 and 2 but for the case 3 (tags/fail) it fails on the build. I believe there must be an issue with the way my project uses properties, but I have no idea why it's failing.

Any help would be appreciated.

sobychacko commented 3 years ago

@yaboong Thank you for this detailed report and the sample app. Your tagging of the repo based on success/failure was very helpful in debugging the issue. We in fact addressed this issue in the 3.1.x line of Spring Cloud Stream while working on another issue. This is the relevant commit in the core Spring Cloud Stream that addressed this.

Any chance you can upgrade this to the 3.1.3 release of Spring Cloud Stream? If you use spring cloud version 2020.0.3, then you will get the proper stream version. Also, you need to upgrade your Spring Boot parent to either 2.4 or 2.5. The aforementioned commit is too complex to backport to the 3.0.x line and therefore we encourage you to upgrade to 3.1.3 as a solution for this problem. Please let us know what you think. Thank you!

yaboong commented 3 years ago

@sobychacko Thank you for your quick response. I upgraded versions in my project like below to use spring-cloud-stream 3.1.3 as you let me know and it works fine.

I really appreciate your support!

sobychacko commented 3 years ago

Thank you for getting back to us. Glad to hear that the upgrade solves the issues you found. Closing the issue.