Add more Kotlin DSL for sub-flows (#3233)
* Add more Kotlin DSL for sub-flows * Introduce `KotlinSplitterEndpointSpec`, `KotlinEnricherSpec` & `KotlinFilterEndpointSpec` to avoid an explicit use of `IntegrationFlow` usage from Kotlin DSL * Fix `AbstractKotlinRouterSpec` to extend `ConsumerEndpointSpec` for access to more endpoint options as it is with Java DSL for similar specs * Introduce a `KotlinIntegrationFlowDefinition.publishSubscribe()` for a `BroadcastCapableChannel` and `vararg` of `KotlinIntegrationFlowDefinition` builders. This allows us to not introduce a `BroadcastPublishSubscribeSpec` wrapper for Kotlin and let us to remove `publishSubscribeChannel()` DSL methods for `PublishSubscribeSpec` since it is covered with the `publishSubscribe(PublishSubscribeChannel())` and respective set of sub-flows in Kotlin DSL as subscribers * Use new Kotlin specs in the `KotlinIntegrationFlowDefinition` instead of their Java variants * * Mention `kotlin-dsl.adoc` in the ToC
This commit is contained in:
@@ -29,9 +29,9 @@ import org.springframework.beans.factory.annotation.Qualifier
|
||||
import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import org.springframework.integration.channel.FluxMessageChannel
|
||||
import org.springframework.integration.channel.PublishSubscribeChannel
|
||||
import org.springframework.integration.channel.QueueChannel
|
||||
import org.springframework.integration.config.EnableIntegration
|
||||
import org.springframework.integration.core.GenericSelector
|
||||
import org.springframework.integration.core.MessagingTemplate
|
||||
import org.springframework.integration.dsl.context.IntegrationFlowContext
|
||||
import org.springframework.integration.endpoint.MessageProcessorMessageSource
|
||||
@@ -248,7 +248,13 @@ class KotlinDslTests {
|
||||
fun messageSourceFlow() =
|
||||
integrationFlow(MessageProcessorMessageSource { "testSource" },
|
||||
{ poller { it.trigger(OnlyOnceTrigger()) } }) {
|
||||
channel { queue("fromSupplierQueue") }
|
||||
publishSubscribe(PublishSubscribeChannel(),
|
||||
{
|
||||
channel { queue("fromSupplierQueue") }
|
||||
},
|
||||
{
|
||||
log<Any>(LoggingHandler.Level.WARN) { "From second subscriber: ${it.payload}"}
|
||||
})
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
Reference in New Issue
Block a user