MrDoops

MrDoops

Looking for some feedback on a Text-Processing feature with LiveView and OTP

I’ve been tinkering on a LiveView project to get a feel for these OTP tools like Dynamic Supervisors, Registry, ETS, Et Al., and I’ve ran into a few spots where I could use some feedback. I have a good idea of what could or needs to happen, but I’m having trouble taking the concept into implementation with regards to some areas of OTP.

The feature I have in mind is a text input where a LiveView with a 1:1 Session Process sends TextChanged events to a variety of Text Analysis strategies for different sorts of metrics. (Sentiment, Editing, Difficulty, etc.) Some of these metrics are stateless (current word count), some of them are stateful (word counts over time).

The plan was we Dynamically Supervise an AnalyzerSubscriber that, depending on the kind of metric, collects various results from background jobs (handling AnalysisResultProduced events), puts the result in ETS under our Session ID, and publishes an AnalysisResultPrepared event so our LiveView knows to fetch from a handy read-model.

So there’s likely some sliding window type metric aggregation, maybe some rate-limiting, and different kinds of ETS tables.

You can find the WIP repo/branch here: GitHub - zblanco/libu at live_chat · GitHub

A few questions:

  • I want to Dynamically Supervise these Subscriber / Collection processes under the also dynamically supervised Session Process - should I be using a spawn_link, Process.monitor or some different method altogether?
    • The subscriber supervisor and child processes should die with the session, but the session shouldn’t die with the supervisor or its children. I’m thinking monitors since a spawn link will kill the session if the subscriber supervisor dies? Are there some consideration I’m missing here?
  • I’m a little bit in the “don’t know what I don’t know” category with regards to many of these OTP tools. I can tell libraries like Flow, GenStage, and Broadway might fit in here, but I’m not quite sure how. Some of these Text Processing jobs have dependent aspects (e.g. different jobs might depend on a Tokenized Result).
    • The plan was to consume an event like %AnalysisResultProduced{analyzer: :tokenizer, result: ....} to then do some dependent work - is there a way to do this kind of dynamic/dependent processing with Flow? My spidey-sense says I might be re-inventing the wheel.

Any input would be appreciated!

Where Next?

Popular in Chat/Questions Top

ariandanim
Hello all, I am still learning Elixir, then go into Phoenix, i am try search in google but find the programming phoenix 1.4, another for...
New
pdgonzalez872
Do we have a list of academic/research papers: about Elixir/Erlang? that use Elixir/Erlang? about the Beam? If so, could you please po...
New
Iex.new
Hello!, I just started this week to discover Elixir. I’m a PHP-Programmer and did some sutff in Go too. The more I read about Elixir t...
New
Allyedge
Hey, I want to learn Elixir OTP and I wanted to know if there are any good resources that teach it. I found some web pages, but none of t...
New
boddhisattva
Greetings everyone, At my current workplace we’re evaluating different ways of building a microservices architecture for some parts rela...
New
lc0815
hello from a real frustrated newbe… I’m reading this article Full-Stack React With Phoenix (Chapter 3 | Introduction to Phoenix) by mich...
New
wallyfoo
Long story short, I have a real world need to create a view for hooking up a shipping terminal to live data, but because of some early ar...
New
TwistingTwists
I want to learn DSL. Don’t know how to write one. What;s the best introductory resource? I see some macro being used here. Is DSL only ...
New
QueenSvetlana
My bookstore has Introducing Elixir: Getting Started In Functional Programming and the front cover says the book uses Elixir 1.4. The cur...
New
Twfo326
As a novice dev I’m trying to keep the curriculum as lean as possible. My requirements are modest: build simple CRUD apps with Phoenix...
New

Other popular topics Top

Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
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
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
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
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

We're in Beta

About us Mission Statement