I would like to wrap a linux command (some compiled C program in this case but could be anything) which reads input from standard input and produces response output on standard output into a light-weight REST service where each get is used to send over the input to the linux pipeline and sends back the resulting output.

In more detail: A scala or Java program that exposes a REST interface and runs a (configurable) program. The program it runs reads from standard input and writes results to standard output. The Scala/Java program starts that program once and then waits for GET requests. The data of each GET request is sent to the standard input of the running linux program. The running linux program writes a response to standard output which is captured by the Scala/Java program and send back as the response for that GET request. The Linux program/pipe remains active after that GET request - essentially until the Scala/Java program is shut down or receives a special request for shutting down itself or restarting the pipe. Again, I think this is a very common problem and since this could be used in many situations I am wondering if there is already a canned solution that only needs to be configured instead of me needing to implement it from scratch (which I would probably do using Scala Spray).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.