dod

dod

OTP architecture advice

Hi there!
Which approach would you choose for the following:
App receives events notification from external source. As long as notification received, app needs to collect data from external API. After data from API received the call to API has to be repeated after 10 sec. And repeated again after 20 sec. An again after 40 sec and so on. In other words each notification should trigger N calls each call should be made after 10 x 2^n seconds.
Notifications occurs randomly with random rate. If at some point of time API call result in stop command no further calls has to be done.

What would you use and how would you structure an application? Supervised Tasks, GenStage, GenServer, would you spawn a new process for each call or would you track timings in single process? Could you provide architecture example?

Thanks!

Most Liked

Qqwy

Qqwy

TypeCheck Core Team

Here are some questions that probably require an answer before a choice can be made:

  • What should happen on app restart or (partial) crash? Is it required to continue the sending of these requests at that case, or is it okay to drop them in cases like these?

  • How expensive will these API calls be? Will there be other work that has to be calculated locally to send it to the API? How much storage will be required to keep track of the notification-data that will be used in some way to invoke the API? (What kind of data are we talking about?)

  • How tight is the time window? Is it a problem if at some point a call is a second late?

  • What should the app do if the API is not responding or crashing when you call it?

  • How will the app receive these notifications? By an external party making a request, or does it have to fetch the data itself?

  • What kind of parties will create these notifications? Will there only be a couple hundreds per minute at best, or possibly millions?

Where Next?

Popular in Questions Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
Fl4m3Ph03n1x
Background Let’s assume I have a typical GenServer that receives messages as requests, does some operation in a DB and returns responses....
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
hpopp
To simplify some tasks at work, I wrote and published this package yesterday. It’s a simple macro that enables Access behaviour on struct...
New
sabri
Can someone explain the settings of pool_size of Ecto in config file? and what is the recommend size? Thanks
New

Other popular topics Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30048 115
New
yurko
Here are few pieces of (common) Linux knowledge that we use for reasonably small one server apps. We use Ubuntu but this should work for ...
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set? Thanks.
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New

We're in Beta

About us Mission Statement