Merge spring-integration-kotlin-dsl project

* Migrate all the Kotlin tests to use new Kotlin DSL
* Upgrade to the latest Kotlin
* Generate KDocs
This commit is contained in:
Artem Bilan
2020-03-05 13:08:56 -05:00
parent f332a9446b
commit 8a38a5e829
7 changed files with 1628 additions and 48 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018-2019 the original author or authors.
* Copyright 2018-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,9 +30,8 @@ import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.integration.IntegrationMessageHeaderAccessor
import org.springframework.integration.config.EnableIntegration
import org.springframework.integration.dsl.IntegrationFlow
import org.springframework.integration.dsl.IntegrationFlows
import org.springframework.integration.dsl.MessageChannels
import org.springframework.integration.dsl.integrationFlow
import org.springframework.integration.jms.DefaultJmsHeaderMapper
import org.springframework.integration.support.MessageBuilder
import org.springframework.jms.support.JmsHeaders
@@ -98,12 +97,15 @@ class JmsDslKotlinTests {
@Bean
fun jmsOutboundFlow() =
IntegrationFlow { f ->
f.handle(Jms.outboundAdapter(jmsConnectionFactory())
.destinationExpression("headers." + SimpMessageHeaderAccessor.DESTINATION_HEADER)
.deliveryModeFunction<Any> { _ -> DeliveryMode.NON_PERSISTENT }
.timeToLiveExpression("10000")
.configureJmsTemplate { t -> t.explicitQosEnabled(true) })
integrationFlow {
handle(Jms.outboundAdapter(jmsConnectionFactory())
.apply {
destinationExpression("headers." + SimpMessageHeaderAccessor.DESTINATION_HEADER)
deliveryModeFunction<Any> { DeliveryMode.NON_PERSISTENT }
timeToLiveExpression("10000")
configureJmsTemplate { it.explicitQosEnabled(true) }
}
)
}
@Bean
@@ -119,15 +121,15 @@ class JmsDslKotlinTests {
@Bean
fun jmsMessageDrivenFlowWithContainer() =
IntegrationFlows.from(
integrationFlow(
Jms.messageDrivenChannelAdapter(
Jms.container(jmsConnectionFactory(), "containerSpecDestination")
.pubSubDomain(false)
.taskExecutor(Executors.newCachedThreadPool()))
.headerMapper(jmsHeaderMapper()))
.transform({ it: String -> it.trim({ it <= ' ' }) })
.channel(jmsOutboundInboundReplyChannel())
.get()
.headerMapper(jmsHeaderMapper())) {
transform { it: String -> it.trim { it <= ' ' } }
channel(jmsOutboundInboundReplyChannel())
}
}