Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
RaghuVamseedhar
Active Contributor
288

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.

1.png

Here are the configurations of Splitter - Gather and Content Modifier.

2a.png

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.

5.png

Labels in this area