SQS Queues in multiple environments with Laravel
If you're reading this you're probably looking for answers to the same problem I had: Your app uses multiple queues with different names, and you need to figure out the right way to configure your app so it resolves the queue names correctly AND it doesn't break your local setup.
TLDR;
Name your queues like this:
[queue name]-[environment name]-[app name]
So if your app is named beehive and you have queues default, high, low you should have:
Dev environment
default-dev-beehive
high-dev-beehive
low-dev-beehive
Production
default-production-beehive
high-production-beehive
low-production-beehive
Environment variables
SQS_PREFIX: Your aws account url
SQS_SUFFIX: -[environment name]-[app name]
This setup will allow you to still call ->onQueue('high/low/etc') without having to have any custom SQS specific functionality.
Gotchas to look out for
SQS_PREFIX can't be played around with too much. If you try to do something like [acount id]/[app name]-[environment]- laravel will automatically add a trailing / so the path will be wrong.
Race Cars Vs. Bentleys
I have a theory: The further you get into your development career, you commit to one of two paths. Full fledged IDE, or low level terminal editors.
Structuring Data Driven Applications in Laravel
We all know that Laravel makes it really easy to store and query data from your database. Getting data submitted from a form and storing it using an eloquent model is trivial. But what if your application needs to do a lot of non-trivial operations based on the data that you have? What if you have pieces of functionality that need to be reusable during different processes? The usual way of structuring this type of functionality by having functions spread around inside models and services can quickly fall apart and make the larger process harder to decipher.