I would like to enrich collection of orders with person details.
Suppose I've (example is in json):
[
{
"orderId": 123,
"quantity": 5,
"buyerId": "84aa820f-2301-4d01-8c4c-2b71204da7dd"
},
{
"orderId": 124,
"quantity": 5,
"buyerId": "7158a748-dfd0-47e5-b620-e8ca4d3ac84d"
}
]
And now I would like extract all buyer identifiers to hit other message endpoint, so I will get in result:
[
{
"personId": "84aa820f-2301-4d01-8c4c-2b71204da7dd",
"name": "Johny",
"surname": "Bravo"
},
{
"personId": "7158a748-dfd0-47e5-b620-e8ca4d3ac84d",
"name": "Felica",
"surname": "Good"
}
]
With this information I need to enrich each of the objects with person details, so the final result will be like this:
[
{
"orderId": 123,
"quantity": 5,
"buyerId": "84aa820f-2301-4d01-8c4c-2b71204da7dd",
"buyer": {
"personId": "84aa820f-2301-4d01-8c4c-2b71204da7dd",
"name": "Johny",
"surname": "Bravo"
}
},
{
"orderId": 124,
"quantity": 5,
"buyerId": "7158a748-dfd0-47e5-b620-e8ca4d3ac84d",
"buyer": {
"personId": "7158a748-dfd0-47e5-b620-e8ca4d3ac84d",
"name": "Felica",
"surname": "Good"
}
}
]
Is that possible to achieve this using enrichers?