From c856c72fc6531ac9d18e52cfd5121957d7a624d7 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Fri, 3 Jan 2020 14:28:22 -0500 Subject: [PATCH] Fix README for the current state of code base * Update Copyright in the affected classes --- spring-integration-kotlin-dsl/README.adoc | 19 +++++++++---------- .../dsl/kotlin/IntegrationFlowDsl.kt | 2 +- .../kotlin/KotlinIntegrationFlowDefinition.kt | 2 +- .../dsl/kotlin/test/KotlinDslTests.kt | 2 +- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/spring-integration-kotlin-dsl/README.adoc b/spring-integration-kotlin-dsl/README.adoc index 2628d10..e21418e 100644 --- a/spring-integration-kotlin-dsl/README.adoc +++ b/spring-integration-kotlin-dsl/README.adoc @@ -6,7 +6,7 @@ NOTE: The project should be treated as experimental and API is a subject to chan The main goal we pursue here is to make Spring Integration development on Kotlin as smooth and straightforward as is it possible with interoperability with existing Java DSL and some Kotlin extensions or language-specific structures. -All you need to get started is just an import for `org.springframework.integration.dsl.integrationFlow` - an overloaded global function for Kotlin DSL. +All you need to get started is just an import for `org.springframework.integration.dsl.kotlin.integrationFlow` - an overloaded global function for Kotlin DSL. For `IntegrationFlow` definitions as lambdas we typically don't need anything else from Kotlin and just declare a bean like this: @@ -31,17 +31,16 @@ As an alternative to the construction above and for consistency with use-cases e @Bean fun flowLambda() = integrationFlow { - filter({ it === "test" }) - wireTap( - integrationFlow { - handle { m -> println(m.payload) } - }) + filter { it === "test" } + wireTap { + handle { println(it.payload) } + } transform { it.toUpperCase() } } ---- ==== -Such a global `integrationFlow()` function expects a `@BuilderInference` for a `KotlinIntegrationFlowDefinition` (a Kotlin extension for the `BaseIntegrationFlowDefinition` with some inline function for reified generic types) and produces a regular `IntegrationFlow` lambda implementation. +Such a global `integrationFlow()` function expects a lambda in builder style for a `KotlinIntegrationFlowDefinition` (a Kotlin wrapper for the `IntegrationFlowDefinition`) and produces a regular `IntegrationFlow` lambda implementation. See more overloaded `integrationFlow()` variants below. Many other scenarios require an `IntegrationFlow` to be started from source of data (e.g. `JdbcPollingChannelAdapter`, `JmsInboundGateway` or just an existing `MessageChannel`). @@ -70,15 +69,15 @@ For example: ---- @Bean fun functionFlow() = - integrationFlow>({ it.beanName("functionGateway") }) { + integrationFlow>({ beanName("functionGateway") }) { transform { it.toUpperCase() } } @Bean fun messageSourceFlow() = integrationFlow(MessageProcessorMessageSource { "testSource" }, - { it.poller { it.fixedDelay(10).maxMessagesPerPoll(1) } }) { - channel { c -> c.queue("fromSupplierQueue") } + { poller { it.fixedDelay(10).maxMessagesPerPoll(1) } }) { + channel { queue("fromSupplierQueue") } } ---- ==== diff --git a/spring-integration-kotlin-dsl/src/main/kotlin/org/springframework/integration/dsl/kotlin/IntegrationFlowDsl.kt b/spring-integration-kotlin-dsl/src/main/kotlin/org/springframework/integration/dsl/kotlin/IntegrationFlowDsl.kt index 33ea1c1..f33dbbb 100644 --- a/spring-integration-kotlin-dsl/src/main/kotlin/org/springframework/integration/dsl/kotlin/IntegrationFlowDsl.kt +++ b/spring-integration-kotlin-dsl/src/main/kotlin/org/springframework/integration/dsl/kotlin/IntegrationFlowDsl.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019 the original author or authors. + * Copyright 2019-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. diff --git a/spring-integration-kotlin-dsl/src/main/kotlin/org/springframework/integration/dsl/kotlin/KotlinIntegrationFlowDefinition.kt b/spring-integration-kotlin-dsl/src/main/kotlin/org/springframework/integration/dsl/kotlin/KotlinIntegrationFlowDefinition.kt index 39ee511..3a01694 100644 --- a/spring-integration-kotlin-dsl/src/main/kotlin/org/springframework/integration/dsl/kotlin/KotlinIntegrationFlowDefinition.kt +++ b/spring-integration-kotlin-dsl/src/main/kotlin/org/springframework/integration/dsl/kotlin/KotlinIntegrationFlowDefinition.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019 the original author or authors. + * Copyright 2019-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. diff --git a/spring-integration-kotlin-dsl/src/test/kotlin/org/springframework/integration/dsl/kotlin/test/KotlinDslTests.kt b/spring-integration-kotlin-dsl/src/test/kotlin/org/springframework/integration/dsl/kotlin/test/KotlinDslTests.kt index e0cfe11..d07c71f 100644 --- a/spring-integration-kotlin-dsl/src/test/kotlin/org/springframework/integration/dsl/kotlin/test/KotlinDslTests.kt +++ b/spring-integration-kotlin-dsl/src/test/kotlin/org/springframework/integration/dsl/kotlin/test/KotlinDslTests.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019 the original author or authors. + * Copyright 2019-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.