We have a Spring 4.0-based web application running in Tomcat 8 (alternatively we have a start-up script for Undertow). Spring MVC is handling requests. I am looking for a way to defer some of request handling code to Clojure library, with minimal changes to legacy Java code.
For instance, requests with URLs ending with .java
would be handled by legacy Java, and requests ending with .clj
would be handled by Clojure. For now, i see three options:
- Include Clojure library jar in Java project's dependencies and use
clojure.java.api
to invoke Clojure code from Java. - Use some sort of RPC/RMI or message queues, e.g. Redis and Carmine's message queue processing capabilities. This way, Clojure would live in a separate JVM.
- Use some sort of reverse proxy to perform URL routing.
Are above approaches actually feasible? What else would you suggest?
Thanks!