My server (on AWS) is in Java Spring Boot, and I’m trying to integrate a Python program that uses LangChain, takes JSON input, generates JSON output.
I have found two solutions:
-
Use ProcessBuilder library in Java to run the python.py program.
-
Run two servers simultaneously (e.g. Spring and Flask) and communicate using local HTTP requests
My initial plan is to try both ways and compare the resource usage and processing time, but it seems that it will take a while to implement them all.
If someone has already gone through similar situations, sharing your experience would be much appreciated.