I'm writing a web application using the Catalyst framework. I'm also using a Job Queue called TheSchwartz.
I'm wanting to use a job queue because I'm wanting as much of the application specific code decoupled from the web application interface code.
Essentially the whole system consists of three main components:
- GUI (Catalyst web interface)
- A crawler
- An "attacking component" (the app is being written to look for XSS and SQLi vulnerabilities in other webapps/sites)
So in theory the GUI creates jobs for the crawler which in turn creates jobs for the "attacking component".
Currently I have a Model in Catalyst which instantiates a TheSchwartz object so that Controllers in the web app can add jobs to the job queue.
I also need to create some job worker scripts that continuously listen (/check the database) for new jobs so they can perform the required actions. Currently the DB specific stuff for TheSchwartz is in the Model in Catalyst and I don't think I can easily access that outside of Catalyst?
I don't want to duplicate the DB connection data for TheSchwartz job queue in the Model and then in my job worker scripts. Should I wrap the creation of TheSchwartz object in another class sitting outside of Catalyst and call that in the Model that is currently instantiating TheSchwartz object? Then I could also use that in the worker scripts. Or should I have the DB data in a config file and instantiate new TheSchwartz objects as and when I need them (inside Catalyst/inside job worker scripts)?
Or am I just over thinking this?
Some links to meaty web app architecture articles may also be useful (I've never built one of moderate complexity before..).
Cheers