Use/Run dw app without jetty (without being a web service)

702 views
Skip to first unread message

Fredrik Hörte

unread,
Aug 6, 2012, 11:31:23 AM8/6/12
to dropwiz...@googlegroups.com
I have really started to enjoy dw for its simplicity of getting started with web services fast and painless.

I am now working on a project where I need to run some standalone worker threads which are just connected to a queue and doesn't need any web service capabilities. So I wonder if it's possible to use dw as a framework and run the app without jetty as a regular java application and not as a web service.

Thanks!

Dimas Guardado

unread,
Aug 6, 2012, 12:56:48 PM8/6/12
to dropwiz...@googlegroups.com
I've not done this, but I believe people have asked about this before. I imagine you can use the 'server' command with a simple rest status API, saving yourself some small effort. Or you could create your own ManagedCommand and avoid the HTTP server startup altogether. There are a few examples out there of non-http (or non-http-centric dw apps) if you need more guidance.

Nick Telford

unread,
Aug 6, 2012, 2:07:52 PM8/6/12
to dropwiz...@googlegroups.com
IIRC, the application life-cycle is directly tied to a Jetty instance.

Do you really care that you'd be running a REST server? We have a number of services that only use the REST interface for admin/diagnostics and it works well.

Coda Hale

unread,
Aug 6, 2012, 2:23:16 PM8/6/12
to dropwiz...@googlegroups.com
We have a fair number of services like this, and we've found they always go better with a RESTful admin API.

That said, you can always provide your own commands for a DW service.


--
Coda Hale
http://codahale.com

Fredrik Hörte

unread,
Aug 6, 2012, 3:41:40 PM8/6/12
to dropwiz...@googlegroups.com
Thank you for your input. I think I'll stick with it as is and use a RESTful admin interface then.

James Ladd

unread,
Aug 6, 2012, 5:36:46 PM8/6/12
to dropwiz...@googlegroups.com
Why not run your code with a YML file that tells the service not to add any resources to the environment?
Essentially there will be nothing for the web app to serve. Does it matter if it sits quietly in the background
doing nothing?
The other alternative is to leave the web app running and take your messages from the queue and 
dispatch then via a http request locally - using the REST/Web layer to marshal calls from the queue.

Petr Kozelka

unread,
Dec 9, 2014, 7:01:40 AM12/9/14
to dropwiz...@googlegroups.com
One problem of this approach is that then you cannot use DW for application types like agents; especially when you prefer the agent to not occupy any port at all, or need to run multiple instances on one machine (it's weird to require user configuring ports just to avoid resource conflicts).
It would be really nice to have a simple way to use DW without any build-in command at all, just the framwork, also because webserver silently sitting in background still requires number of dependencies in the jar.

Dne pondělí, 6. srpna 2012 20:07:52 UTC+2 Nick Telford napsal(a):
Reply all
Reply to author
Forward
0 new messages