linagora / james-project

Mirror of Apache James Project
Apache License 2.0
72 stars 62 forks source link

[Postgres] Implement EventSourcingFilteringManagement #5013

Closed hungphan227 closed 10 months ago

hungphan227 commented 10 months ago

How

DoD

Pass FilteringManagementContract

hungphan227 commented 10 months ago

I found CassandraEventStoreTable that contains info about the table but could not find the module that create the table. The only module I found is CassandraFilteringProjectionModule but the table is different.

quantranhong1999 commented 10 months ago

rules TEXT

-> jsonb? cf: https://github.com/linagora/james-project-private/issues/750#issuecomment-1870276450

chibenwa commented 10 months ago

TL;DR: More complex than it seems, I would love to see a POC...


This is a tricky one, as we need transactionnality when inserting several events: they either all succeed or all fails. Partial application is not supported. I would love to see in this ticket...

... Is this feature actually used? Is there some features that relies on storing several events or is this just some convoluted complexity we can get rid of? ... We could implement this with a transaction for sure. But do we have a way to match desired consistency without resorting to such extremities? Eg: Apparently PG supports inserting several rows at once natively: https://www.postgresqltutorial.com/postgresql-tutorial/postgresql-insert-multiple-rows/

INSERT INTO 
    links (url, name)
VALUES
    ('https://www.google.com','Google'),
    ('https://www.yahoo.com','Yahoo'),
    ('https://www.bing.com','Bing');
Arsnael commented 10 months ago

Mixing two tickets here.

The first point about creating filters_projection table belongs to the ticket [Postgres] Implement FiltersProjectionDAO (that Quan seemed to have picked)

I found CassandraEventStoreTable that contains info about the table but could not find the module that create the table.

CassandraEventStoreModule , same package as CassandraEventStoreTable :)

chibenwa commented 10 months ago

Yes ignore this comment here.

I moved it to https://github.com/linagora/james-project/issues/5029 ...

Arsnael commented 10 months ago

Wondering if that shouldn't be together with https://github.com/linagora/james-project/issues/5026 then. Sounds a bit too small on its own :)

quantranhong1999 commented 10 months ago

bind PostgresEventStore to eventStore in EventSourcingFilteringManagement

The guice binding for PostgresEventStore would be done in https://github.com/linagora/james-project/issues/5029.

Here is just about contract test for Filter on top of PostgresEventStore IMO.

Arsnael commented 10 months ago

Already part of https://github.com/linagora/james-project/issues/5026 in DoD, closing this.