Hello,

There is a great article about using CQRS/ES in Elixir/Phoenix 
http://jfcloutier.github.io/jekyll/update/2015/11/04/cqrs_elixir_phoenix.html 
which 
inspired us to try those technics in our app.

I'm sure that it's a very common pattern in reappearing situation (everyone 
are building notifications in Elixir!) and should be pretty straightforward 
to implement, but as an n00b, I have a lot of questions, besides the fact 
that I might not have a correct understanding of it at all.  

So we have three sets:
Notification Events - transactional and domain (registration, password 
reset, doing a post, etc)
Notification Channels  - currently email and SMS
Users who have contacts info in their profiles

Assumed OTP structure: 
NotificationManager is a notifications operations entry point, it's a 
supervised GenServer (https://domnikl.github.io/supervised-gen-event/) 
 that  orchestrates notification dispatching. Each Notification Channel 
thus   is a handler implementing GenEvent behavior on the Notification 
Manager.
NotificationManager then exposes simple API (details are still under 
consideration) like notify(:event_name, %User{}, channels \\ [:all], 
additional_message \\ "")  and calls subsequent handlers each in separate 
process (????) to parallelize notifications delivery. 
Handlers in their turn are just hitting other application services that 
perform a real job. 

Afterward, NotificationManager caller is notified of the operations results 
(delivered or not delivered, if not - there must be a detail to show it to 
the user).

Questions here:

1. Is it a Frankenstein style over-engineering? Am I trying to shoot myself 
in the foot? 
2. At which point NotificationHandlers should be spawned to make 
notifications dispatched in parallel? Besides costly network IO operations, 
they will also need to query database for the provided message templates.
3. How to communicate operations results to the NotificationManager caller?

Super thrived to work with OTP and implement it the "right-way"(tm)


-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-talk/d2a80994-3ed1-4956-a678-ae62624061d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to