marcuslankenau

marcuslankenau

How to use a set of worker to handle sqs messages?

Hi there,

we are implementing a client for AWS EQS queuing (that we already use in other [ruby] projects). Sqs is providing a http entpoint that is returning a list of messages. In case of an empty queue it is possible to let that call block for a couple of seconds (to save http calls and money). We would like to have one process polling sqs and handing the messages to a pool of worker, that do the real work. The number of worker should be limited to avoid sucking all sqs messages into elixir and dying an overload death.

We have a kind of hacked solution using honeydew, but there we need busy waiting loops to wait for a free worker. That we would like to avoid.

It would be really nice to have a worker pool that we can pass a message and it blocks (the caller) in case all worker are busy. I think we would be able to handcraft that, but prefer to use otp or standard libraries.

Solutions and ideas are highly appreciated. :slight_smile:

Cheers
Marcus

Most Liked

OvermindDL1

OvermindDL1

Actually, instead of poolboy, this seems like something that the new GenStage module that is being added to Elixir (and currently available via the above link on hex.pm) is explicitly and specifically designed for. Hard to get more ‘standard built-in library’ than that (at least until it is added to, likely, the next Elixir version base). :slight_smile:

EDIT: /me is really loving the GenStage module

StevenXL

StevenXL

Hi @marcuslankenau,

I would love to hear what the folks that have actually worked with pools would do in this case, but pool management is a (elegantly) solved problem in Elixir / Erlang. The most common package I’ve seen used for this is poolboy. It’s a dependency of Ecto, in case that increases your confidence in the library. I found a very quick tutorial / example on using poolboy - I don’t know how much the library has changed since that post was written, but it will certainly help you understand the intent of the library.

Does it seem to fit your need?

StevenXL

StevenXL

I’ll second @OvermindDL1’s request for a follow-up, if it’s not to much trouble. Also, @OvermindDL1 thanks for pointing out GenStage - I wasn’t aware of it.

Where Next?

Popular in Questions Top

marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
tduccuong
Hi, is there any work on GUI with Elixir, that is similar to Electron/Javascript? My idea is to bundle Phoenix and BEAM into a single se...
New
JulienCorb
I am trying to implement my new.html.eex file to create new posts on my website. new.html.eex: <h1>Create Post</h1> <%= ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New

Other popular topics Top

marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

Latest on Elixir Forum

We're in Beta

About us Mission Statement