Skip to content

dispatch job on specific connection #113

@slimani-dev

Description

@slimani-dev

The problem

I have few jobs in my application that Run in the Background in a database queue connection, the problem is that when i started using the database connection i lost the HTTP request information of the Webhook Job and i need the request headers

The requested feature

it would be amazing if there is an option to choose the queue connection for the Webhook job

something like this

namespace Spatie\WebhookClient;
...

class WebhookProcessor
{
    protected Request $request;

    protected WebhookConfig $config;
    
    ...

   protected function processWebhook(WebhookCall $webhookCall): void
    {
        try {
            $job = new $this->config->processWebhookJobClass($webhookCall);

            $webhookCall->clearException();

            dispatch($job)->onConnection('sync');

        } catch (Exception $exception) {
            $webhookCall->saveException($exception);

            throw $exception;
        }
    }

    ...

}

in line 62 of WebhookProcessor.php file

dispatch($job)->onConnection('sync');

this solution is working for me but it means i will have to edit the files every time

thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions