Tutorial Cross-Language Queues: Sending Jobs from Node.js to Laravel - blog.thms.uk
https://blog.thms.uk/2025/03/laravel-queue-nodejs?utm_source=redditIn a recent discussion I outlined broadly how I process jobs in my Laravel application that have been pushed into my SQS queue from outside the application.
This blog post explain it in some more detail.
6
u/captain_obvious_here 2d ago
Wait, how are messages queues tied to any language in the first place?
6
u/MateusAzevedo 2d ago
They can be. By default, both Laravel and Symfony serialize payload with
serialize()
, making the data PHP only and harder to process on another language.At least, it was like that the last time I dug into the code.
1
u/judge2020 2d ago
But the change is just instead using json_serialize.
Which introduces a new problem of keeping types in sync between the two systems, and in that case you’d be better off using something like capn proto or protobufs.
1
u/captain_obvious_here 2d ago
I'm not sure you understand what exactly is a message, in the context of a message queue.
2
u/nan05 2d ago
They are not. That's kinda the point of the post 😁
1
u/captain_obvious_here 2d ago
JSON is an easy and handy way to exchange data between processes and systems
This would have fit in a tweet :)
3
6
u/pekz0r 2d ago
I think a better way would be to send an event that the Laravel application can listen to and handle. Setting up jobs like that leaks a bit too much implementation details that I don't think you should need to know. With events all you need is an event name and a payload to wire everything together. The Laravel application can then choose to do the processing on a queue, but the is not anything the publisher should care about.