scottyscripts

scottyscripts

Hello!

I am designing a GenStage pipeline using a FIFO queue from Amazon SQS.
I just want to say right up front that unfortunately I can’t use Broadway SQS based on my use case.

I have a

  • producer (receiving messages from SQS)
  • producer_consumer (to normalize incoming messages)
  • consumer (want to perform operations for a group of messages)

My end goal is to

  1. take incoming messages
  2. group them by an attribute on that message (Message Group Id), while maintaining original message order
  3. process messages in batches/groups

In my producer consumer, I’d like to dynamically spin up a new consumer process for each batch of messages (events).

For example, I have 10 messages received.

  • 7 messages have message group ID “a”
  • 3 messages have message group ID “b”

After initial processing in my producer_consumer, I would like to spin up 2 (n) consumer processes, one for processing messages w/ group “a” and another process for spinning up messages with group “b”.

I was looking at making my consumer use ConsumerSupervisor, but this spins up a new consumer process per event.

I’m also considering the issue where I receive 7 messages from group “a” and then receive 3 more messages from group “a” (SQS only allows 10 messages in flight for a given Message Group ID). I need to make sure they are processed in the original order they were received. (Processing these in different consumers opens up this potential race condition)

My current idea is to do some sort of check in my producer consumer to see if a consumer process exists for message group “a”

  • if it does, push new messages (genstage events) to this consumer process to be processed next
  • otherwise create a new consumer process for group “a” and process all incoming messages for a certain window.
    This idea feels like I’m going to far away from what was intended with GenStage.

Any ideas to maximize concurrency in my situation while keeping true to GenStage pattern?

Marked As Solved

kokolegorille

kokolegorille

Did You look at Flow? The main difference with GenStage is its ability to group…

Also Liked

kokolegorille

kokolegorille

There is a flow diagram in this video…

… at about 39min 50sec

Last Post!

scottyscripts

scottyscripts OP

Was just looking for some good videos on this! Thanks!

Where Next? Top

Trending in Questions Top

RSP87
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
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
nseaSeb
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
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
velrest
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
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
apz
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
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
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews