Closed tanner0101 closed 5 years ago
This is what a min-viable setup for vapor + jobs looks like currently:
let app = Application(environment: env) app.provider(JobsProvider()) app.register(JobsDriver.self) { app in return TestDriver(on: app.make()) } app.register(extension: JobsConfiguration.self) { jobs, app in jobs.add(FooJob()) } app.get("foo") { req in return req.jobs.dispatch(FooJob.Data(foo: "bar")) .map { "done" } } return app
Not bad at all, but I have some ideas. What about something like this:
let app = Application(environment: env) app.provider(JobsProvider()) app.jobs.driver(TestDriver()) app.jobs.add(FooJob()) app.jobs.add(BarJob()) app.jobs.add(QuxJob()) app.get("foo") { req in return req.jobs.dispatch(FooJob.self, .init(foo: "bar")) .map { "done" } } return app
I agree, I think this would be really nice.
Closed in #43
This is what a min-viable setup for vapor + jobs looks like currently:
Not bad at all, but I have some ideas. What about something like this: