Skip to content

Using classes to define jobs? #270

@IngwiePhoenix

Description

@IngwiePhoenix

I would like to know if it is possible to create a job as a class. For instance, would something like this be possible?

class SendNotificationMails extends someBaseJobClass {
  constructor() {
    this.attach("notification-mails", /*... other settings */)
  }
  async run() {
    // Execute job...
  }
}

It would make organizing a lot of background jobs much easier to write everything in classes and just have them register at an initial script.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions