
Exchange Properties created before the Split-Gather block will be available within and after the block. However, if an Exchange Property is created within the Split-Gather block, there is a high chance its value will be replaced during the last execution of the Split. The probability of overwriting or data loss increases when Parallel Processing is used.
To capture information within the Split-Gather block without overwriting or missing values, the solution is to create Exchange Properties with a random naming pattern.
Here is a sample iFlow that demonstrates how to create dynamic Exchange Properties using UUID and then collect values in these properties.
Here are the configurations of Splitter - Gather and Content Modifier.
Groovy script for CreateProperties
import com.sap.gateway.ip.core.customdev.util.Message
import java.util.UUID
import java.time.Instant
def Message processData(Message message) {
def now = Instant.now().toString()
def CamelSplitIndex = message.getProperty('CamelSplitIndex')
message.setProperty("p_ExchangeProperty_${UUID.randomUUID()}", "now:${now} \t CamelSplitIndex:${CamelSplitIndex}\r\n")
return message
}
Groovy script for CollectProperties
import com.sap.gateway.ip.core.customdev.util.Message
def Message processData(Message message) {
def concatenatedString = message.getProperties().findAll { it.key.startsWith('p_ExchangeProperty') }.values().join('')
message.setProperty('p_ConcatenatedString', concatenatedString)
return message
}
Result: Exchange Properties are created with in the Split-Gather block and we are able to store data into properties without data loss.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
7 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 | |
4 |