F
Filament2mo 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);
})
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
Jump to solution
3 Replies
Keika
KeikaOP2mo ago
Has nobody encountered that?
Solution
hyperion-mx
hyperion-mx2mo ago
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
Keika
KeikaOP2mo ago
Damn! You're a legend! I have just changed computers a few days ago, and I was transfering the site, but I didn't copy/paste the .env file. So the queue connection was on sync.... Thanks a lot!
Want results from more Discord servers?
Add your server