I searched online but I didn't find any solution for my issue. I'm using laravel 5.2 with SQS as queue driver. I'm dispatching a job in order to send email messages to 100 users. The job receives the "Article" model and array of "User"(s) and each user supposed to receive an email with an "article".
When it is 10 users all is OK. When it is 100 users I receive an error message "400 bad request" from amazon SQS service and the response is: "Reason: Message must be shorter than 262144 bytes." I understood the job's request is too big because of the user's array.
I want to split the user's array in order to reduce the job's request size to less than 256kb. I can do it by looping through the user's array and every time I reach close to 256kb I will dispatch a job with the article and users and then I will continue to run over the rest of the users in the array.
- What is the way to check the current job request size before we dispatch it?
- Do you have a better solution to offer?
Thank you very much in advance Leo.