CrossScalaModuleback into a normal
def crossScalaVersionfield, but I think for an example project the non-cross module is simpler and more newbie friendly)
I've been trying out
cask and so far loving the simplicity!
However, I have a question regarding how to shut down
cask application correctly. Scenario is this: in the main object (extends
cask.Main) message consumer is created, this consumer runs in the main's thread. It basically polls a queue (
java.util.concurrent.BlockingQueue) and does some work. Now in the router object (extends
cask.Routes) on every request its body is put into this queue. So for example if queue consumer fails and throws an exception, I'd like for the whole application to stop. Not sure if it's a good approach but I've tried
executionContext.shutdown from within object extending
cask.Main but routes are still being served and JVM does not exit. So what's the correct way here?
Undertowserver. So I guess I'll just override
cask.Main.mainand create the server directly. Though it would be nice for
DefaultHandlerto be exposed publicly without needing to extend
cask.Mainbecause now I only need
defaultHandlerfrom it :).
initialize()in a cask Routes object, it will traverse all methods defined in the object and derive routing information for all methods annotated with an "endpoint" annotation (common endpoints are defined in the
cask.endpointspackage, for example
cask.get). This information is contained in an
RoutesEndpointMetadataobject and will be used by the final http request routing mechanism (essentially the code that instructs the webserver how to map HTTP requests to method calls)
I just tried the new version on 3.0 and I can't replicate com-lihaoyi/cask#30 any longer. I might as well close it.
However, one thing that struck me is that cask returns a 405 — method not allowed for undefined routes, if the method has not been used for at least one other route. It seems like this should be 404 instead?