Skip to content

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

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

Closed
meshpaul opened this issue Oct 31, 2018 · 2 comments
Labels
for: external-project For an external project and not something we can fix status: invalid An issue that we don't feel is valid

Comments

@meshpaul
Copy link

meshpaul commented Oct 31, 2018

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

  1. Using Spring KafkaRequestReplyTemplate set up a required client call to REQ/REPLY topics
  2. 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'}")

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 31, 2018
@wilkinsona
Copy link
Member

Thanks for the report, but the handling of @SendTo is done by Spring Kafka which is managed as a separate project.

@wilkinsona wilkinsona added status: invalid An issue that we don't feel is valid for: external-project For an external project and not something we can fix and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 31, 2018
@meshpaul
Copy link
Author

meshpaul commented Nov 1, 2018

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project For an external project and not something we can fix status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

3 participants