Context path routing in Tomcat ( service swapping )
- by jojovilco
Here is what I would like to achieve:
I have a web service A which I want to be able to deploy side by side with other web services of type A - different version(s). For now I assume 2 instances side by side. I need it because the service has a warm up stage, which takes some time to build up stuff from DB and only after it is ready it can start serving requests ...
I was thinking to deploy to Tomcat context paths like: "/ServiceA-1.0", "/ServiceA-2.0"
and then have a "virtual" context like "/ServiceA" which will point to the desired physical service e.g. "/ServiceA-1.0". So external world will know about ServiceA, but internally, my ServiceA related stack would know about versioned ServiceA url ( there are more components involved but only ServiceA is serving outer world ). When new service is ready, I would just reconfigure the "virtual" context to point to a new service.
So far, I was not able to find out how to do this with Tomcat and starting to tkink it is not possible. I found suggestions to place Apache Server in front of Tomcat and do the routing there, but I do not want to enroll another piece of software unless necessary.
My questions are:
- is this kind of a "virtual" context and routing possible to do with Tomcat?
- any other options, wisdom and lessons learned how to achieve this kind of service swapping scenario?
Best,
Jozef