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

SpringBoot Kotlin with Kafka utilizing @SendTo does not properly work with Springs- Kotlin property substitution #848

Closed
meshpaul opened this issue Nov 1, 2018 · 1 comment

Comments

@meshpaul
Copy link

meshpaul commented Nov 1, 2018

🐞 Bug report

Hi,

While working with Spring Boot, Kotlin, Spring Kafka and utilizing Springs Request Reply template

kotlinVersion = '1.2.61'
springBootVersion = '2.0.5.RELEASE'
springCloudVersion = 'Greenwich.BUILD-SNAPSHOT'
gsonVersion = '2.8.5'
commonsValidatorVersion = '1.4.1'
libphonenumberVersion = '5.5'
log4jVersion = '2.11.1'
junitVersion = '4.12'
protobufGradlePluginVersion = '0.8.6'
springKafkaVersion = '2.1.10.RELEASE'
commonsValidatorVersion = '1.4.1'
jacksonModuleKotlinVersion = '2.9.6'
javaVersion='1.8'
I have stumbled upon an issue here is scenario thats easily replicated

Using Spring KafkaRequestReplyTemplate set up a required client call to REQ/REPLY topics
Using Listener to receive required messages on REQ topic and once received send them to REPLY topic via @sendto the value in @sendto is as follows
@KafkaListener(topics = ["${my.input-request-topic}"])
@sendto("${my.output-reply-topic}")
override fun caseRequestListener(myModel: CommandModel): CommandModel {
logger.warn("SUCCESS RECIVED MESSAGE {} ", myModel)

   myModel.responseType = CommandModel.ResponseType.SUCCESS

    return myModel

}

the above property definition in @sendto does not resolve and kept as is ${my.output-reply-topic}.

The only way this works if I use static declarations or change to use Spring EL using #{ and not Kotlin supported ${myVal}... I also tried git issue with custom property resolver that did not work... what works is something like this :
@sendto("#{systemProperties['my.output-response-topic'] ?: 'MY.CMD.CREATE.RESPONSE'}")

@garyrussell
Copy link
Contributor

Why did you create 2 identical issues?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants