Skip to main content

Processable Events

Following the creation of a processable event, a reaction from our side is trigerred once.

How to implement

Let's suppose, we want to send a payslip to an employee following a transaction to him from our side, we can implement a processable reference event called that we will call 'EMPLOYEE_PAYROLL_DISBURSEMENT':

  1. Add the event slug to ReferenceEvent::Slugs and ReferenceEvent::PROCESSABLE_EVENTS,
  2. Create a processor for the event following the same name but in camel case, for example: EventProcessors::EmployeePayrollDisbursementEventProcessor,

Now, under the hood, the ReferenceEventsProcessorJob which is enqueued each 15 minutes will try to process all processable events where end_at is nil and update end_at to the current timestamp if the processor works flawlessly.

To understand this even more, check the case of the already implemented EMPLOYEE_PAYROLL_DISBURSEMENT in the codebase.