fireproofsocks
This is a general question, but what are people doing for their SQS message formats? In a lot of places I’ve worked, people just JSON encoded an object and sent it as the SQS message and they never used the SQS message attributes. Even the Broadway testing functions don’t put message attributes at the forefront: the envisioned use case is that all test messages in a pipeline will share the same message attributes.
Is the JSON encoding route the “proper” way? Although I can see some advantages (mostly in pattern matching) that leverage using message attributes, it’s usually a chunk more work.
What are people’s thoughts on this?
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 4- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
gregvaughn
As always with these “best” practice type of questions, the answer is “it depends.” There is no single best way of doing it. it really depends upon what your payload is. If, for example, you were sending pdf files or images, then json is a horrible choice. If you’re sending some structured data payload, then json is a fine choice (though there’s cases where csv or xml or protobuf or other might be the best for that situation).
My personal use involves integration with a 3rd party company, so they dictated the message format. They have a message attribute (I asked the Broadway team to expose those) that is a cryptographic IV (initialization vector) that I have to read and combine with a shared secret to decrypt the json payload.
I would not use message attributes for domain knowledge purposes though. I see them more as infrastructural metadata. However, I tend to be cautious about buying too deeply into one vendor’s implementation. The less you depend upon their special features the easier it will be for you to migrate to some other queueing service. Tradeoffs apply and your situation may not match mine though.
fireproofsocks
That’s helpful, thanks! Could you elaborate a bit more on what you would consider “domain knowledge purposes” vs. “infrastructural metadata”? E.g. message attributes are handy in pattern matching to route execution, but there would be no significant change if JSON were decoded and the pattern matching happened one level below
handle_message/3.gregvaughn
My example of the decryption IV is an example of infrastructural metadata. You need that to even be able to read the message body. Other examples might be SQS configuration (I’m just guessing. I really haven’t studied what SQS exposes).
Routing is a fine idea for message attributes. But if “there would be no significant change” to pattern matching on the body, then I’d default to that because I’m less coupled to SQS.
When you control the format of messages you put on and take off the queues, then maybe there’s more design forces that I’m not considering. I’m not in that situation and haven’t spent time trying to weigh out all the details of that.
fireproofsocks
By “no significant change”, I just mean that the pattern matching would move downstream (i.e. to somewhere after the JSON in the message body had been decoded). I can see that there are lots of ways to skin this cat…
Thanks for the follow-up!