spring-cloud / spring-cloud-stream

Framework for building Event-Driven Microservices
http://cloud.spring.io/spring-cloud-stream
Apache License 2.0
1.01k stars 614 forks source link

Consider KafkaConnectionDetails when working with Kafka connections #3007

Closed wilkinsona closed 1 month ago

wilkinsona commented 1 month ago

See https://github.com/spring-projects/spring-boot/issues/42312 for background. In order to support the connection details feature that was introduced in Spring Boot 3.1, the Kafka binder needs to consider any KafkaConnectionDetails bean when establishing a connection (admin, consumer, or producer) to Kafka.

I've had a bit of trouble getting the project to build cleanly (resetOffsets and dlqWithDlqDestinationResolver in KafkaBinderTests are flaky for me), but this PR should hopefully be pretty close to what's needed. With a local build of the changes, the tests in https://github.com/corneil/test-processor/tree/main/java now pass at least. You may want to add some unit tests that verify that the addresses provided by a KafkaConnectionDetails bean are used correctly.

sobychacko commented 1 month ago

@wilkinsona Thanks for the PR! It looks great. I see that the PR is issued against the 4.1.x branch. We will merge it and forward port the changes to the main branch (4.2.0-SNAPSHOT).

sobychacko commented 1 month ago

@wilkinsona Merged to 4.1.x and forward ported to main. We will look into the unit tests you mentioned. Thanks!