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] Not working when using Spring Kafka and Kafka Binder via connection string auth in Spring Cloud Azure 5.19.0 #43853

Open
2 of 3 tasks
moarychan opened this issue Jan 21, 2025 · 3 comments · May be fixed by #43854
Open
2 of 3 tasks
Assignees
Labels
azure-spring All azure-spring related issues Client This issue points to a problem in the data-plane of the library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team
Milestone

Comments

@moarychan
Copy link
Member

moarychan commented Jan 21, 2025

Describe the bug
KafkaAdminClient still using a default local address for connection.

Exception or Stack Trace
Connect to the Event hubs server.

To Reproduce
Use this sample.

Code Snippet
N/A

Expected behavior
Normally connect to Event Hubs via Kafka API.

Screenshots
If applicable, add screenshots to help explain your problem.

Setup (please complete the following information):

  • OS: Windows 11
  • IDE: Intellij idea
  • Java version: Java 21
  • Frameworks: Spring Boot 3.3.4 + Spring Cloud 2023.0.3 + Spring Cloud Azure 5.19.0

Additional context
Works for 5.18.0.

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Bug Description Added
  • Repro Steps Added
  • Setup information Added
@moarychan moarychan added the azure-spring All azure-spring related issues label Jan 21, 2025
@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team labels Jan 21, 2025
Copy link

Copy link

Thank you for your feedback. Tagging and routing to the team member best able to assist.

@moarychan moarychan assigned moarychan and unassigned saragluna Jan 21, 2025
@moarychan moarychan moved this from Todo to In Progress in Spring Cloud Azure Jan 21, 2025
@moarychan moarychan added this to the 2025-02 milestone Jan 21, 2025
@moarychan
Copy link
Member Author

moarychan commented Jan 21, 2025

The root cause is that the configuration AzureEventHubsKafkaAutoConfiguration is spliced to a another new class KafkaPropertiesConfiguration, the initialization of the new class KafkaPropertiesConfiguration takes precedence over the connection string provider, the workaround for this bug is:
Update configuration for Kafka Binder:

spring.cloud.stream.binders.kafka.environment.spring.main.sources=com.azure.spring.cloud.autoconfigure.implementation.eventhubs.kafka.AzureEventHubsKafkaAutoConfiguration,com.azure.spring.cloud.autoconfigure.implementation.eventhubs.kafka.KafkaPropertiesConfiguration

Re-register the bean KafkaPropertiesBeanPostProcessor for Spring Kafka in the parent application context, since is not public, you may should make a copy then register it as a bean and depends on bean eventHubsKafkaConnectionString; or you can make the eventHubsKafkaConnectionString bean is initialed first before the KafkaPropertiesBeanPostProcessor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
azure-spring All azure-spring related issues Client This issue points to a problem in the data-plane of the library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team
Projects
Status: In Progress
2 participants