Giter Site home page Giter Site logo

Projections per category about commanded HOT 9 OPEN

commanded avatar commanded commented on April 29, 2024
Projections per category

from commanded.

Comments (9)

florish avatar florish commented on April 29, 2024

I've been looking for this option, too, encountering a couple of cases where I'd like to subscribe to all Events for a specific Aggregate type. I'm not sure whether this would be more of an EventStore issue that a Commanded issue, though... (as in: you may want to have a stream_type (aggregate type) registered with each stream, enabling per-type subscriptions on the EventStore level).

from commanded.

drozzy avatar drozzy commented on April 29, 2024

@florish I'm using Greg's ES, where it is already available: http://codeofrob.com/entries/creating-a-projection-per-stream-in-the-eventstore.html

from commanded.

slashdotdash avatar slashdotdash commented on April 29, 2024

@florish Both Greg's Event Store and my own Elixir EventStore support subscriptions to a single stream. But only Greg's Event Store supports category subscriptions (e.g. by event type).

Commanded could allow the user to configure the stream that a handler, or process manager, subscribes to as in the example below:

defmodule ExampleEventHandler do
  use Commanded.Event.Handler, 
    name: "ExampleEventHandler",
    subscribe_to: "$ce-cars"
end

This would be optional, the default would be the current behaviour (subscribe all events).

from commanded.

florish avatar florish commented on April 29, 2024

@slashdotdash @drozzy Thanks both! Good to know about the available options.

from commanded.

drozzy avatar drozzy commented on April 29, 2024

I think the $ce-cars behaviour should be the default. I practically never subscribe to single stream (commanded handles it for me automatically for aggregates!)

So it looks like internal implementation leaking into user layer.

By the way, this is the only feature that commanded is missing for me not to use Extreme alongside it.

from commanded.

jfornoff avatar jfornoff commented on April 29, 2024

@drozzy Using $ce-cars as a default wouldn't work with anything other than Greg's ES, would it?
AFAIK the Postgres-backed Eventstore (commanded/eventstore) would not be able to use that default since it does not have category streams ATM, or am I mistaken here?

from commanded.

drozzy avatar drozzy commented on April 29, 2024

Sorry, I'm not familiar with Postgres-ES :-(

from commanded.

jfornoff avatar jfornoff commented on April 29, 2024

Not a problem at all, in essence there is no such thing as category streams in there yet (I'm not aware whether there is interest in building something along these lines). So right now, if Commanded is going to support pluggable backends, it'd be necessary to subscribe to $all since that's the only stream that is guaranteed to be supported by all backends.

Apart from that, totally agreed with your point, it'd be super nice for scalability as well.

from commanded.

drozzy avatar drozzy commented on April 29, 2024

@jfornoff the notion of "categories" is what makes the stream model per-aggregate so powerful. For example, if you have a page that lists "cars", how would you get cars from different aggregates into one projection? I suppose if you could query the DB directly (and if that DB did projections for you) that would solve the issue. But ES.org is remote service, and you can't build large projections and then query them.

I find, in general, that ES guys know what they are doing in terms of Event Sourcing, and I've been actually learning about the right way of doing things just by using their product (for example, their competing consumers implementation teaches you that you must ack everything, as opposed to how I though it would work magically).

from commanded.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.