How to understand GenStage

hello all any one can help me to understand GenStage as well

Hi there, when i was looking for a good explanation of what is and how to use the gen stage, i found a great conf vid by @josevalim, here ->, watch it too, he covered all the question i had.


Thank you!

It took a long time for GenStage to click for me.

It wasn’t obvious that producers emit events from any handle_* callback by populating a list in the second element of the return tuple.

The HexDocs are quite good, particularly once the section on buffering demand made sense it all came together.

1 Like

i have genstage project
i have 1 producer and x consumer
my producer get messages from amazon sqs and emit it to consumers
i don’t want to get more messages until my consumer finish

any example with this behavior
Thanks !

This blog post covers polling SQS from a GenStage producer, there’s a GitHub repo linked with some sample code.

I’d also consider using ConsumerSupervisor to handle each SQS message in a new process.