Event Modeling

 The Model That Works

ARKADIUSZ KONDAS

Data Scientist @ Buddy.Works

Zend Certified Engineer

Software Architect, Event Stormer, Event Modeler, Clean Coder, Blogger, Ultrarunner

@ ArkadiuszKondas

arkadiuszkondas.com

Zend Certified Architect

Domain-Driven Design

Event Sourcing

Command Query Responsibility Segregation

CQRS

Event Storming

Event Modeling

  1. Brain storming
  2. The Plot
  3. The Story Board
  4. Identify Inputs
  5. Identify Outputs
  6. Apply Conway’s Law
  7. Elaborate Scenarios

Flat Cost Curve

Show me the code

https://twitter.com/adymitruk/status/1172414109029031941

    php:
        build: ./BookingPhp
        volumes:
            - "./eventStore:/events"
        labels:
            - "traefik.enable=true"
            - "traefik.backend=php"
            - "traefik.docker.network=web"
            - "traefik.frontend.rule=Path:/room-inventory,/create_room,/change_type_price,/room-types"
            - "traefik.port=80"
              #            - "com.centurylinklabs.watchtower.enable=true"
        networks:
            - web

    dotnet:
        image: eventmodeling/dotnet:latest
        links:
            - eventstore
        volumes:
            - "./eventStore:/App/DATA"
        labels:
            - "traefik.enable=true"
            - "traefik.backend=dotnet"
            - "traefik.docker.network=web"
            - "traefik.frontend.rule=PathPrefix:/Room/,/room/"
            - "traefik.port=8080"
            - "com.centurylinklabs.watchtower.enable=true"
        environment:
            - "WORKSHOP_EVENTSTORE_PASSWORD=${EVENTSTORE_PASSWORD}"
        networks:
            - web

    java:
        image: eventmodeling/java:latest
        volumes:
            - "./eventStore:/tmp/events"
        labels:
            - "traefik.enable=true"
            - "traefik.backend=java"
            - "traefik.docker.network=web"
            - "traefik.frontend.rule=PathPrefix:/api/booking/book-room,/api/payment/details/"
            - "traefik.port=12378"
            - "com.centurylinklabs.watchtower.enable=true"
        networks:
<?php


namespace App\EventStore;


interface EventStore
{
    public function append(Event $event, string $suffix): void;

    public function getEvents(): array;
}
<?php

namespace App\EventStore;

class JsonFileSystemEventStore implements EventStore
{

    /** @var string */
    private $directory;

    public function __construct(string $directory)
    {
        $this->directory = $directory;
        if(!is_dir($this->directory)) {
            throw new \InvalidArgumentException("[$directory] is NOT a directory");
        }
    }

    public function append(Event $event, string $suffix): void
    {
        $result = file_put_contents(
            sprintf(
                '%s/%s-%s-%s.json',
                $this->directory,
                $event->getDateTime()->format('U') * 1000,
                $event->getType(),
                $suffix
            ),
            json_encode($event->toJson())
        );

        if($result === false) {
            throw new \Exception("Failed to append event");
        }
    }

Q&A

Thanks for listening

@ ArkadiuszKondas

https://slides.com/arkadiuszkondas

https://github.com/akondas

Event Modeling - The Model That Works

By Arkadiusz Kondas

Event Modeling - The Model That Works

At the presentation you will learn what Event Modeling is, you will learn all its components and see what you need to conduct your own session. Thanks to Event Modeling, you'll discover a new tool that will allow you to better design your information systems. You'll also see how to transfer knowledge from a session straight to the code. You will know how change software development back into an engineering practice.

  • 1,562