Add handle() based on single argument lambda

* Upgrade dependencies including Gradle
This commit is contained in:
Artem Bilan
2020-02-14 16:13:07 -05:00
parent 68734223ee
commit 40d94f4dc5
5 changed files with 30 additions and 9 deletions

View File

@@ -4,7 +4,7 @@ plugins {
id 'idea'
id 'jacoco'
id 'org.sonarqube' version '2.8'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'org.jetbrains.kotlin.jvm' version "$kotlinVersion"
id 'org.jetbrains.kotlin.plugin.spring' version "$kotlinVersion"
id 'org.jetbrains.dokka' version '0.9.18'
@@ -28,10 +28,10 @@ repositories {
ext {
assertkVersion = '0.20'
jacksonVersion = '2.10.1'
junitVersion = '5.5.2'
junitVersion = '5.6.0'
log4jVersion = '2.13.0'
reactorVersion = 'Dysprosium-SR1'
springIntegrationVersion = '5.2.2.RELEASE'
reactorVersion = 'Dysprosium-SR4'
springIntegrationVersion = '5.2.3.RELEASE'
idPrefix = 'kotlin-dsl'
@@ -66,13 +66,11 @@ dependencyManagement {
compileKotlin {
kotlinOptions {
jvmTarget = '1.8'
freeCompilerArgs = ['-Xjsr305=strict']
allWarningsAsErrors = true
}
}
compileTestKotlin {
kotlinOptions {
freeCompilerArgs = ['-Xjsr305=strict']
jvmTarget = '1.8'
}
}
@@ -82,7 +80,7 @@ eclipse.project.natures += 'org.springframework.ide.eclipse.core.springnature'
jacoco {
toolVersion = '0.8.4'
toolVersion = '0.8.5'
}
dependencies {

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -485,6 +485,25 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ
this.delegate.handle(messageHandlerSpec, endpointConfigurer)
}
/**
* Populate a [ServiceActivatingHandler] for the provided
* [MessageHandler] lambda.
*/
fun handle(messageHandler: (Message<*>) -> Unit) {
this.delegate.handle(MessageHandler { messageHandler(it) })
}
/**
* Populate a [ServiceActivatingHandler] for the provided
* [MessageHandler] lambda.
* In addition accept options for the integration endpoint using [GenericEndpointSpec].
*/
fun handle(messageHandler: (Message<*>) -> Unit,
endpointConfigurer: GenericEndpointSpec<MessageHandler>.() -> Unit) {
this.delegate.handle(MessageHandler { messageHandler(it) }, endpointConfigurer)
}
/**
* Populate a [ServiceActivatingHandler] for the provided
* [MessageHandler] implementation.

View File

@@ -222,6 +222,7 @@ class KotlinDslTests {
integrationFlow("convertFlowInput") {
convert<TestPojo>()
convert<TestPojo> { id("kotlinConverter") }
handle { m -> (m.headers[MessageHeaders.REPLY_CHANNEL] as MessageChannel).send(m) }
}
@Bean
@@ -231,7 +232,10 @@ class KotlinDslTests {
split<Message<*>> { it.payload }
split<String>({ it }) { id("splitterEndpoint") }
resequence()
aggregate { id("aggregator").outputProcessor { it.one } }
aggregate {
id("aggregator")
outputProcessor { it.one }
}
}
@Bean