Suppose I have a front end. On said front end, I want to upload a file. The controller in the Spring Boot (Java) app receives said file as a MultipartFile (Service A). I want to take the input stream from that, and send it to a different service (Service B) without writing said stream to the file system. Service B should return something to Service A which sends said response to the client to let me know it has handled said file after completion of the streaming. I am unsure which libraries/classes to use to achieve this in a Spring Boot app. I assume Java or Spring Boot has all kinds of helper classes to make this trivial, I'm just unsure which and how to string them together in the correct order.
Client --> Service A --> Service B
Any help would be appreciated, as the current approach of writing it to a file system is a horrible approach that I want refactored ASAP.
@Autowired
RestTemplate restTemplate
public customResponse myFileUpload(@RequestParam("foo") MultipartFile myFile) {
//myFile comes in fine, I can pull input stream via myFile.getInputStream();
//Should pull stream from myFile and return response from Service A here.
//Not sure if I need to map the input to an outputStream or something?
return restTemplate.postForObject(serviceA.url, ???, customResponse.class);
}