elixirellomax

elixirellomax

Need some help understanding Commanded

Hi everyone, i’m new to this forum but no so much to elixir. Could anyone please help me to better understand Commanded.
I know that it keeps one genserver per aggregate, but does it keep current aggregate’s state in it? I mean when you need to apply a command to an aggregate, what does it do?

  • Does it fetch all previous events from store, builds the aggregate and apply the command?
  • Does it keep some sort of struct in it to which it applies the command?
    If it is the first case, how can i log those queries against the eventstore?
    Thanks in advance

Marked As Solved

y86

y86

In Commanded, after you dispatch your command, it will find the aggregate the needs to handle it based on your router. Once it finds the aggregate, if it is not running yet, it will spawn the aggregate server, load all relevant events from its subscription to get to its current state, then it executes the command. From that point onwards, as long as the aggregate is alive, the current state is in its memory.

After commands are handled, 0 or more events can be generated, which in turn are processed by the aggregate to update its state.

Regarding logging the queries to the eventstore, I’ve never really had the need for it and I am not sure if there is an option you can toggle to see them. I’d say that you can take a look at the evenstore guides (I am assuming you’re using commanded’s Postgres’s eventstore) eventstore/guides at master · commanded/eventstore · GitHub to see if there is an option for that.

Where Next?

Popular in Questions Top

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
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
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
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
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
gazoon
I want to know absolute current module path. In python i could do that: os.path.abspath(__file__) Does elixir have anything similar?
New
Phillipp
Hey, I have a NanoPi-M3 and try to install Elixir on their Ubuntu image. I followed the Raspberry Pi installation instructions from the ...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
jc00ke
Expanding on this topic: https://forum.elixirforum.net/t/map-typespec-question/19217 Let’s say I have a map with required and optional k...
New

Other popular topics Top

Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
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
Tee
can someone please explain to me how Enum.reduce works with maps
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
quazar
How to set Jason to encode all fields in ecto schema, I don’t care about security and implementing only is taking long list of attributes...
New
sacepums
Hey guys. I'm new to elixir and im really stocked about it. But I ran into a bit of problem - I need to convert a date sting, for examp...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
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
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New

We're in Beta

About us Mission Statement