Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[POC] Replaced document-manager by event-sourcing and CQRS #305

Closed

Conversation

wachterjohannes
Copy link
Member

@wachterjohannes wachterjohannes commented Feb 6, 2018

THIS IS AN EXPERIMENT AND FAR AWAY FROM BEEING PERFECT.

Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Fixed tickets none
Related issues/PRs none
License MIT

What's in this PR?

This PR wraps the document-manager functionality into a projection for CQRS and Event-Sourcing.

Why?

This could be a replacement for the document-manager. All the functionality which is covered by the document-manager will be moved to an AggregateRoot.

Database Schema

DROP TABLE IF EXISTS `event_streams`;
CREATE TABLE `event_streams` (
  `no` bigint(20) NOT NULL AUTO_INCREMENT,
  `real_stream_name` varchar(150) COLLATE utf8_bin NOT NULL,
  `stream_name` char(41) COLLATE utf8_bin NOT NULL,
  `metadata` json DEFAULT NULL,
  `category` varchar(150) COLLATE utf8_bin DEFAULT NULL,
  PRIMARY KEY (`no`),
  UNIQUE KEY `ix_rsn` (`real_stream_name`),
  KEY `ix_cat` (`category`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
 
DROP TABLE IF EXISTS `projections`;
CREATE TABLE `projections` (
  `no` bigint(20) NOT NULL AUTO_INCREMENT,
  `name` varchar(150) COLLATE utf8_bin NOT NULL,
  `position` json DEFAULT NULL,
  `state` json DEFAULT NULL,
  `status` varchar(28) COLLATE utf8_bin NOT NULL,
  `locked_until` char(26) COLLATE utf8_bin DEFAULT NULL,
  PRIMARY KEY (`no`),
  UNIQUE KEY `ix_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
 
DROP TABLE IF EXISTS `snapshots`;
CREATE TABLE `snapshots` (
  `aggregate_id` varchar(150) COLLATE utf8_bin NOT NULL,
  `aggregate_type` varchar(150) COLLATE utf8_bin NOT NULL,
  `last_version` int(11) NOT NULL,
  `created_at` char(26) COLLATE utf8_bin NOT NULL,
  `aggregate_root` blob,
  UNIQUE KEY `ix_aggregate_id` (`aggregate_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

To Do

  • Article-Pages

@wachterjohannes wachterjohannes force-pushed the experiment/event-sourcing branch 2 times, most recently from 0ece27e to 82af185 Compare February 6, 2018 19:03
$this->handleActionParameter($action, $document, $locale);
$this->getDocumentManager()->flush();
$this->getCommandBus()->dispatch(
new UpdateArticle(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ModifyArticle

);
$router->attachToMessageBus($commandBus);

$userProjector = new ArticleDocumentProjector(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$articleDocumentProjector

@wachterjohannes wachterjohannes force-pushed the experiment/event-sourcing branch from 82af185 to e481a53 Compare February 6, 2018 19:49
@wachterjohannes wachterjohannes changed the base branch from develop to release/2.0 April 21, 2020 12:51
@alexander-schranz alexander-schranz changed the base branch from release/2.0 to 2.0 July 2, 2020 12:47
@niklasnatter niklasnatter changed the base branch from 2.0 to master November 6, 2020 09:28
@niklasnatter niklasnatter changed the base branch from master to 2.x January 7, 2021 15:35
@niklasnatter
Copy link
Contributor

Replaced by #553

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants