1
votes

In my api I am using Redis for caching dispatched jobs from my controllers: This is how my controller looks

class FormSubmissionsController extends Controller
{
    /**
     * @param StoreRequest $request
     * @return \Illuminate\Http\JsonResponse
     */
    public function store(StoreRequest $request, FormSubmission $formSubmission)
    {

        JobStore::dispatch($formSubmission, $request->get('tracking_code'), $request->get('form'));

        return response()->json([
            'id' => $formSubmission->id
        ]);
    }
}

All is working, and the only change I did to use redis it was some config vars in dot env file. My question:

In another controller I want to use some of Amazon SQSservices for queued jobs, any idea how to config queue and how should I dispatch each job to particular queue handler ?

1
What Laravel version? You may use "connection" to dispatch to whatever you want.Just open up documentation its all there. Search for "connection".Kyslik
Laravel 5.5 @kyslikuser7175325

1 Answers

2
votes

You can pick a connection that should be used to dispatch a job with onConnection() method:

JobStore::dispatch()->onConnection('sqs');

See https://laravel.com/docs/5.5/queues#dispatching-jobs for more details.