spring-cloud / spring-cloud-stream

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

@Component annotated beans composition doesn't work #2941

Closed LiquidSelf closed 4 months ago

LiquidSelf commented 5 months ago

Hello, I try to use composition of two functions annotated with @Component, and I get null as argument. Without composition works as expected. @Bean annotated functions composition work as expected as well.

spring-cloud-stream-binder-kafka:4.0.3 and spring-cloud-stream-binder-kafka-streams:4.0.3

image image image
sobychacko commented 5 months ago

@LiquidSelf, Could you put these components in a sample project and share with us? We can then triage the issue further to identify the issue.

LiquidSelf commented 5 months ago

@LiquidSelf, Could you put these components in a sample project and share with us? We can then triage the issue further to identify the issue.

as simple as that https://github.com/LiquidSelf/sample/blob/main/src/main/resources/application.yaml#L6

sobychacko commented 5 months ago

@LiquidSelf Thank you for the sample. I just added a fix where the Kafka Streams binder now supports Component beans for function composition. Could you test your app against the latest snapshot (4.1.2-SNAPSHOT)? Thanks!

sobychacko commented 4 months ago

@LiquidSelf, Were you able to verify the fix?

LiquidSelf commented 4 months ago

@LiquidSelf, Were you able to verify the fix?

hello, only fast verify on mock-demo project, fix works, but first component function getting called two times, and processing happens two times for first function in composition (only first) , e.g:

image

test-1#apply gets called two times, As a result processing occurs 2 times as well

image