FilamentF
Filament14mo ago
Keika

How to dispatch an event from an Action

Hi,
I have a View Action, very simple, on click I want it to trigger an event that should be queued...

so far I have:
Actions\Action::make('Fetch Details')
  ->color('info')
  ->action(function (Customer $customer): void {
      FetchDetails::dispatch($customer);
  })

However it runs the event synchronously. Horizon never receives it (and it fails!)
The event has implement ShouldQueue.

Can I send this event to the queue from within an action?
Solution
I dont think its an issue with Filament, Action can call any function, can you confirm your env file QUEUE_CONNECTION and can you confirm your queue is working please
Was this page helpful?