Page MenuHomeDevCentral

Simplify Notifications center workflow to build notifications and fire payload events
Open, Needs TriagePublic

Description

Current workflow

Currently, the HTTP gate workflow works like this:

  1. Client posts a payload to the gate
  2. The gate controller fires an event, e.g. GitHubPayloadEvent
  3. Nasqueron\Notifications\Listeners\NotificationListener listens to all these events, mutates it into a notification and call the relevant job, e.g. FireGitHubNotification
  4. The job creates a notification, as a subclass of Nasqueron\Notifications\Notifications\Notification e.g. GitHubNotification

That allows to have other listeners to work with the events e.g. PhabricatorListener listens to GitHubPayloadEvent to notify Diffusion about new commits.

Issue

Each time we need to add a new service, there are lot of files to create:

  1. a gate controller
  2. an event
  3. a job for this event
  4. a notification

The code is pretty much the same.

Furthermore, other listeners could find everything in the notification format, as it contains original payload (well GitHub sends extra headers, but we inject the event in the notification, and we don't use the guid).

Proposal

New workflow will be:

  1. Client posts a payload to the gate
  2. The gate controller directly prepares the specific notification class, probably a responsibility of the notification class (a build method?)
  3. The gate controller then fires directly a generic event PayloadEvent with the notification attached

An example of how to construct a specific notification class from generic arguments can be found in the Nasqueron\Notifications\Console\Commands\NotificationsPayload class.

We can then remove the Fire... jobs, the specific events, and adapt the listeners to work with the generic PayloadEvent.

Event Timeline

dereckson created this task.Jan 6 2017, 06:12
dereckson renamed this task from Simplify Notifications center workflow to Simplify Notifications center workflow to build notifications and fire payload events.
dereckson moved this task from Backlog to Dev on the Technical debt board.Feb 22 2018, 01:46