@@ -19,6 +19,7 @@ package org.springframework.integration.dsl
1919import org.reactivestreams.Publisher
2020import org.springframework.expression.Expression
2121import org.springframework.integration.aggregator.AggregatingMessageHandler
22+ import org.springframework.integration.channel.BroadcastCapableChannel
2223import org.springframework.integration.channel.FluxMessageChannel
2324import org.springframework.integration.channel.interceptor.WireTap
2425import org.springframework.integration.core.MessageSelector
@@ -54,7 +55,6 @@ import org.springframework.messaging.MessageChannel
5455import org.springframework.messaging.MessageHandler
5556import org.springframework.messaging.MessageHeaders
5657import reactor.core.publisher.Flux
57- import java.util.concurrent.Executor
5858import java.util.function.Consumer
5959
6060/* *
@@ -112,9 +112,9 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ
112112 */
113113 inline fun <reified P > split (
114114 crossinline function : (P ) -> Any ,
115- crossinline configurer : SplitterEndpointSpec <MethodInvokingSplitter >.() -> Unit ) {
115+ crossinline configurer : KotlinSplitterEndpointSpec <MethodInvokingSplitter >.() -> Unit ) {
116116
117- this .delegate.split(P ::class .java, { function(it) }) { configurer(it ) }
117+ this .delegate.split(P ::class .java, { function(it) }) { configurer(KotlinSplitterEndpointSpec (it) ) }
118118 }
119119
120120 /* *
@@ -131,9 +131,9 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ
131131 */
132132 inline fun <reified P > filter (
133133 crossinline function : (P ) -> Boolean ,
134- crossinline configurer : FilterEndpointSpec .() -> Unit ) {
134+ crossinline filterConfigurer : KotlinFilterEndpointSpec .() -> Unit ) {
135135
136- this .delegate.filter(P ::class .java, { function(it) }) { configurer(it ) }
136+ this .delegate.filter(P ::class .java, { function(it) }) { filterConfigurer( KotlinFilterEndpointSpec (it) ) }
137137 }
138138
139139
@@ -207,22 +207,19 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ
207207 }
208208
209209 /* *
210- * The [org.springframework.integration.channel.PublishSubscribeChannel ] `channel()`
210+ * The [org.springframework.integration.channel.BroadcastCapableChannel ] `channel()`
211211 * method specific implementation to allow the use of the 'subflow' subscriber capability.
212212 */
213- fun publishSubscribeChannel (publishSubscribeChannelConfigurer : PublishSubscribeSpec .() -> Unit ) {
214- this .delegate.publishSubscribeChannel(publishSubscribeChannelConfigurer)
215- }
216-
217- /* *
218- * The [org.springframework.integration.channel.PublishSubscribeChannel] `channel()`
219- * method specific implementation to allow the use of the 'subflow' subscriber capability.
220- * Use the provided [Executor] for the target subscribers.
221- */
222- fun publishSubscribeChannel (executor : Executor ,
223- publishSubscribeChannelConfigurer : PublishSubscribeSpec .() -> Unit ) {
213+ fun publishSubscribe (broadcastCapableChannel : BroadcastCapableChannel ,
214+ vararg subscribeSubFlows : KotlinIntegrationFlowDefinition .() -> Unit ) {
224215
225- this .delegate.publishSubscribeChannel(executor, Consumer (publishSubscribeChannelConfigurer))
216+ val publishSubscribeChannelConfigurer =
217+ Consumer <BroadcastPublishSubscribeSpec > { spec ->
218+ subscribeSubFlows.forEach { subFlow ->
219+ spec.subscribe { subFlow(KotlinIntegrationFlowDefinition (it)) }
220+ }
221+ }
222+ this .delegate.publishSubscribeChannel(broadcastCapableChannel, publishSubscribeChannelConfigurer)
226223 }
227224
228225 /* *
@@ -331,10 +328,10 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ
331328
332329 /* *
333330 * Populate a [MessageFilter] with [MessageSelector] for the provided SpEL expression.
334- * In addition accept options for the integration endpoint using [FilterEndpointSpec ]:
331+ * In addition accept options for the integration endpoint using [KotlinFilterEndpointSpec ]:
335332 */
336- fun filter (expression : String , endpointConfigurer : FilterEndpointSpec .() -> Unit = {}) {
337- this .delegate.filter(expression, endpointConfigurer)
333+ fun filter (expression : String , filterConfigurer : KotlinFilterEndpointSpec .() -> Unit = {}) {
334+ this .delegate.filter(expression) { filterConfigurer( KotlinFilterEndpointSpec (it)) }
338335 }
339336
340337 /* *
@@ -349,18 +346,19 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ
349346 * Populate a [MessageFilter] with [MethodInvokingSelector] for the
350347 * method of the provided service.
351348 */
352- fun filter (service : Any , methodName : String? , endpointConfigurer : FilterEndpointSpec .() -> Unit ) {
353- this .delegate.filter(service, methodName, endpointConfigurer)
349+ fun filter (service : Any , methodName : String? , filterConfigurer : KotlinFilterEndpointSpec .() -> Unit ) {
350+ this .delegate.filter(service, methodName) { filterConfigurer( KotlinFilterEndpointSpec (it)) }
354351 }
355352
356353 /* *
357354 * Populate a [MessageFilter] with [MethodInvokingSelector]
358355 * for the [MessageProcessor] from
359356 * the provided [MessageProcessorSpec].
360- * In addition accept options for the integration endpoint using [FilterEndpointSpec ].
357+ * In addition accept options for the integration endpoint using [KotlinFilterEndpointSpec ].
361358 */
362- fun filter (messageProcessorSpec : MessageProcessorSpec <* >, endpointConfigurer : FilterEndpointSpec .() -> Unit = {}) {
363- this .delegate.filter(messageProcessorSpec, endpointConfigurer)
359+ fun filter (messageProcessorSpec : MessageProcessorSpec <* >,
360+ filterConfigurer : KotlinFilterEndpointSpec .() -> Unit = {}) {
361+ this .delegate.filter(messageProcessorSpec) { filterConfigurer(KotlinFilterEndpointSpec (it)) }
364362 }
365363
366364 /* *
@@ -512,8 +510,8 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ
512510 * to the current integration flow position
513511 * with provided options.
514512 */
515- fun enrich (enricherConfigurer : EnricherSpec .() -> Unit ) {
516- this .delegate.enrich( enricherConfigurer)
513+ fun enrich (enricherConfigurer : KotlinEnricherSpec .() -> Unit ) {
514+ this .delegate.enrich { enricherConfigurer( KotlinEnricherSpec (it)) }
517515 }
518516
519517 /* *
@@ -562,9 +560,9 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ
562560 * SpEL expression.
563561 */
564562 fun split (expression : String ,
565- endpointConfigurer : SplitterEndpointSpec <ExpressionEvaluatingSplitter >.() -> Unit = {}) {
563+ endpointConfigurer : KotlinSplitterEndpointSpec <ExpressionEvaluatingSplitter >.() -> Unit = {}) {
566564
567- this .delegate.split(expression, endpointConfigurer)
565+ this .delegate.split(expression) { endpointConfigurer( KotlinSplitterEndpointSpec (it)) }
568566 }
569567
570568 /* *
@@ -578,12 +576,12 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ
578576 /* *
579577 * Populate the [MethodInvokingSplitter] to evaluate the provided
580578 * `method` of the `bean` at runtime.
581- * In addition accept options for the integration endpoint using [GenericEndpointSpec ].
579+ * In addition accept options for the integration endpoint using [KotlinSplitterEndpointSpec ].
582580 */
583581 fun split (service : Any , methodName : String? ,
584- endpointConfigurer : SplitterEndpointSpec <MethodInvokingSplitter >.() -> Unit ) {
582+ splitterConfigurer : KotlinSplitterEndpointSpec <MethodInvokingSplitter >.() -> Unit ) {
585583
586- this .delegate.split(service, methodName, endpointConfigurer)
584+ this .delegate.split(service, methodName) { splitterConfigurer( KotlinSplitterEndpointSpec (it)) }
587585 }
588586
589587 /* *
@@ -597,43 +595,43 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ
597595 /* *
598596 * Populate the [MethodInvokingSplitter] to evaluate the provided
599597 * `method` of the `bean` at runtime.
600- * In addition accept options for the integration endpoint using [GenericEndpointSpec ].
598+ * In addition accept options for the integration endpoint using [KotlinSplitterEndpointSpec ].
601599 */
602600 fun split (beanName : String , methodName : String? ,
603- endpointConfigurer : SplitterEndpointSpec <MethodInvokingSplitter >.() -> Unit ) {
601+ splitterConfigurer : KotlinSplitterEndpointSpec <MethodInvokingSplitter >.() -> Unit ) {
604602
605- this .delegate.split(beanName, methodName, endpointConfigurer)
603+ this .delegate.split(beanName, methodName) { splitterConfigurer( KotlinSplitterEndpointSpec (it)) }
606604 }
607605
608606 /* *
609607 * Populate the [MethodInvokingSplitter] to evaluate the
610608 * [MessageProcessor] at runtime
611609 * from provided [MessageProcessorSpec].
612- * In addition accept options for the integration endpoint using [GenericEndpointSpec ].
610+ * In addition accept options for the integration endpoint using [KotlinSplitterEndpointSpec ].
613611 */
614612 fun split (messageProcessorSpec : MessageProcessorSpec <* >,
615- endpointConfigurer : SplitterEndpointSpec <MethodInvokingSplitter >.() -> Unit = {}) {
613+ splitterConfigurer : KotlinSplitterEndpointSpec <MethodInvokingSplitter >.() -> Unit = {}) {
616614
617- this .delegate.split(messageProcessorSpec, endpointConfigurer)
615+ this .delegate.split(messageProcessorSpec) { splitterConfigurer( KotlinSplitterEndpointSpec (it)) }
618616 }
619617
620618 /* *
621619 * Populate the provided [AbstractMessageSplitter] to the current integration flow position.
622620 */
623621 fun <S : AbstractMessageSplitter > split (splitterMessageHandlerSpec : MessageHandlerSpec <* , S >,
624- endpointConfigurer : SplitterEndpointSpec <S >.() -> Unit = {}) {
622+ splitterConfigurer : KotlinSplitterEndpointSpec <S >.() -> Unit = {}) {
625623
626- this .delegate.split(splitterMessageHandlerSpec, endpointConfigurer)
624+ this .delegate.split(splitterMessageHandlerSpec) { splitterConfigurer( KotlinSplitterEndpointSpec (it)) }
627625 }
628626
629627 /* *
630628 * Populate the provided [AbstractMessageSplitter] to the current integration
631629 * flow position.
632630 */
633631 fun <S : AbstractMessageSplitter > split (splitter : S ,
634- endpointConfigurer : SplitterEndpointSpec <S >.() -> Unit = {}) {
632+ splitterConfigurer : KotlinSplitterEndpointSpec <S >.() -> Unit = {}) {
635633
636- this .delegate.split(splitter, endpointConfigurer)
634+ this .delegate.split(splitter) { splitterConfigurer( KotlinSplitterEndpointSpec (it)) }
637635 }
638636
639637 /* *
0 commit comments