Skip to content

Commit

Permalink
GH-113: Fix KafkaPublisherConfiguration for auto-wire ambiguity
Browse files Browse the repository at this point in the history
Fixes: #113
  • Loading branch information
artembilan committed Dec 19, 2024
1 parent d5a77d1 commit 19cc51f
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.time.Duration;
import java.util.function.Consumer;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.kafka.KafkaAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
Expand Down Expand Up @@ -52,11 +53,13 @@ public class KafkaPublisherConfiguration {
* @return the consumer for accepting message for producing to Kafka.
*/
@Bean
public Consumer<Message<?>> kafkaPublisher(KafkaProducerMessageHandler<?, ?> kafkaProducerMessageHandler) {
public Consumer<Message<?>> kafkaPublisher(
@Qualifier("kafkaProducerMessageHandler") KafkaProducerMessageHandler<?, ?> kafkaProducerMessageHandler) {

return kafkaProducerMessageHandler::handleMessage;
}

@Bean
@Bean("kafkaProducerMessageHandler")
public KafkaProducerMessageHandlerSpec<?, ?, ?> kafkaProducerMessageHandlerSpec(KafkaTemplate<?, ?> kafkaTemplate,
KafkaPublisherProperties kafkaPublisherProperties, PublishSubscribeChannel kafkaPublisherSuccessChannel,
PublishSubscribeChannel kafkaPublisherFailureChannel, PublishSubscribeChannel kafkaPublisherFuturesChannel,
Expand Down

0 comments on commit 19cc51f

Please sign in to comment.