Skip to content
Advertisement

Laravel and AWS SQS, How to read job payload / retrieve queue?

I struggling from last 3 days about how I can read queued job payload in Laravel.

What I’ve achieved till yet. Dispatch a job and see that it is available on AWS SQS queue. After that I’ve executed listener and worker for AWS to process queued jobs and I see that it is working fine as well.

Right now I am stuck on how I can read QUEUED job payload / messagebody / attributes from AWS SQS.

Here is my code example if possible than anyone from this whole community please help me.

JavaScript

Logs are printed if I remove this json_encode() from log info as mentioned above.

Advertisement

Answer

In your case you want to access $this->job->payload(), but you are overwriting the job variable in the constructor, with this line.

JavaScript

Instead rename this to something else.

JavaScript

Now you can access the payload like so.

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement