Improve Delayer DSL (#8645)
* Improve Delayer DSL Move `groupId` option from a `delay()` method arg to the `DelayerEndpointSpec` to make it cleaner from code reading perspective * Expose new DSL method based on just a `DelayerEndpointSpec` for Kotlin &v Groovy * Deprecate multi-arg `delay()` methods in favor of `Consumer<DelayerEndpointSpec>`-based * * Fix language and code style
This commit is contained in:
@@ -33,7 +33,8 @@ If you need to determine the delay for each message, you can also provide the Sp
|
||||
@Bean
|
||||
public IntegrationFlow flow() {
|
||||
return IntegrationFlow.from("input")
|
||||
.delay("delayer.messageGroupId", d -> d
|
||||
.delay(d -> d
|
||||
.messageGroupId("delayer.messageGroupId")
|
||||
.defaultDelay(3_000L)
|
||||
.delayExpression("headers['delay']"))
|
||||
.channel("output")
|
||||
@@ -46,7 +47,8 @@ public IntegrationFlow flow() {
|
||||
@Bean
|
||||
fun flow() =
|
||||
integrationFlow("input") {
|
||||
delay("delayer.messageGroupId") {
|
||||
delay {
|
||||
messageGroupId("delayer.messageGroupId")
|
||||
defaultDelay(3000L)
|
||||
delayExpression("headers['delay']")
|
||||
}
|
||||
|
||||
@@ -35,7 +35,10 @@ flowLambda() {
|
||||
wireTap integrationFlow {
|
||||
channel { queue 'wireTapChannel' }
|
||||
}
|
||||
delay 'delayGroup', { defaultDelay 100 }
|
||||
delay {
|
||||
messageGroupId 'delayGroup'
|
||||
defaultDelay 100
|
||||
}
|
||||
transform String, { it.toUpperCase() }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user