An example project that demonstrates how to serve Apache Spark services with Scalatra.
The project was generated according to Scalatra's Getting Started Guide, then minimal changes were made to integrate with Spark. Some effort was also required also to use JSON4S for parsing arguments and rendering results.
The interesting files are:
- project/build.scala This has all the version stuff that needed to be finessed in order to integrate Spark and Scalatra.
- DataReductionServlet.scala This is the part that defines a JSON REST API that invokes a Spark job.
- main.js This invokes the API using jQuery and prints the result to the console.
See also StackOverflow - Any examples of code integrating Scalatra with Spark
by Curran Kelleher Feb 2015