I have one spring boot controllers which recives many users like below
sample json
{
"users": [
{ "name":"john", "age":18, "type":"1"},
{ "name":"kim", , "age":18, "type":"2"},
{ "name":"Fits", "age":18, "type","3"},
]
}
request handler
@RequestMapping(value = "/users", method = RequestMethod.POST, headers = "Accept=application/json")
public void Add(@RequestBody List<user> users) throws Exception {
// Here I am iterating users and writing one by one to different message topic based on the type
// if any error in the given user while writing to message topic I am storing that user in other DB
}
it works well when I have some 100 users in the user list, but if list is big like 1000 etc it takes too much time. so is there any spring batch job where I can assign to that to perform this?
I just want to return http response code 202 to request and assign this payload to spring batch job