Suppose i have a product and i need to enrich this product with downloaded image id's.
As an input message i have java pojo. For simplicity present it as a json :
{
"id" : "productId",
"price" : 10000,
"productPhotos" : ["http://url1", "http://url2", ...],
"marketPhotos" : ["http://url1", "http://url2", ...]
}
Also i have pollable chanel that can = download an image and put it somewhere in storage and return downloaded photo id
@Bean
public IntegrationFlow imageDownloadFlow() {
return IntegrationFlows.from(inputChannel())
.transform(Message.class, messageTransformer::transformToImageMassage, e -> e.poller(queuePoller()))
.transform(imageDownloader::download)
.transform(imageS3Uploader::upload)
.channel(outputChannel())
.get();
}
So, my task is to run "productPhotos" and "marketPhotos" in parrallel and enrich the product message with downloaded id's. e.g.
{
"id" : "productId",
"price" : 10000,
"productPhotos" : ["id1", "id2", ...],
"marketPhotos" : ["id3", "id4", ...]
}
Is it possible with enrich in the IntegrationFlows?