Search code examples
spring-integrationspring-integration-dsl

send is not supported, because no request channel has been configured


I am trying to configure integration flow with gateway. Using Java DSL on kotlin.

Gateway config:

@MessagingGateway(name = "tdiOutSenderGateway")
interface TdiOutSenderGateway {
    fun send(packet: PhasorEnricher.Packet)
}

Flow config:

@Bean
open fun tdiOutSendFlow() = IntegrationFlows
    .from(TdiOutSenderGateway::class.java)
    .transform(tdiOutSenderRouter())
    .get()!!

got send is not supported, because no request channel has been configured docs: request channel will be autoconfigured.

Is there any additional setting I missed?


Solution

    1. Of course, transform should return something, there should be route or handle.

    2. But even I fixed #1 I faced with that: Void kotlin functions return Unit. Spring integrations checks Unit == null which is false, tries to find the next channel and throw an error. The fix is to use kotlin lambda and return null explicitly.

    3. After working with Spring Integration and kotlin these 8 months I decided to try to create Kotlin DSL for Spring Integration (https://github.com/spring-projects/spring-integration/issues/3016)

    Kotlin Unit: https://kotlinlang.org/docs/reference/functions.html#unit-returning-functions


    P.S.: Of course I solved it earlier, not after 8 months.