Skip to content

Commit

Permalink
Merge pull request #1 from Reef3rm4n/vm/gcloud
Browse files Browse the repository at this point in the history
Vm/gcloud
  • Loading branch information
Reef3rm4n committed Jul 22, 2023
2 parents ee9d719 + 43f6d8e commit addf724
Show file tree
Hide file tree
Showing 206 changed files with 4,216 additions and 2,803 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ In the above example, the `DepositBehaviour` processes a `DepositCommand` for th

# EventBehaviour Interface

The `EventBehaviour` interface plays a vital role in event.x, managing how events apply to aggregates.
The `EventBehaviour` interface plays a vital role in es4j, managing how events apply to aggregates.

## Type Parameters

Expand Down
62 changes: 62 additions & 0 deletions diagrams/command-handler.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
@startuml
skinparam sequence {
ArrowColor DeepSkyBlue
ActorBorderColor DeepSkyBlue
LifeLineBorderColor blue
LifeLineBackgroundColor #A9DCDF
ParticipantBorderColor DeepSkyBlue
ParticipantBackgroundColor DodgerBlue
ParticipantFontName Impact
ParticipantFontSize 17
ParticipantFontColor #A9DCDF
ActorBackgroundColor aqua
ActorFontColor DeepSkyBlue
ActorFontSize 17
ActorFontName Aapex
NoteBackgroundColor wheat
NoteBorderColor sienna
NoteFontColor black
}
!define DEFAULT_MONO_FONT_SIZE 14

skinparam monochrome true

actor CommandIssuer
participant es4j
database EventStore

CommandIssuer -> es4j: Issue Command 1
activate es4j
es4j -> EventStore: Fetch Events
activate EventStore
EventStore --> es4j: Return Events
deactivate EventStore
es4j -> es4j: Process Command and Events in Memory
es4j -> EventStore: Append New Event
activate EventStore
EventStore --> es4j: Confirm Event Appended
deactivate EventStore
es4j --> CommandIssuer: Reply to Command 1
deactivate es4j

CommandIssuer -> es4j: Issue Command 2
activate es4j
es4j -> es4j: Process Command in Memory
es4j -> EventStore: Attempt to Append New Event
activate EventStore
EventStore --> es4j: Event Append Failed
deactivate EventStore
es4j -> EventStore: Fetch Events Again
activate EventStore
EventStore --> es4j: Return Events
deactivate EventStore
es4j -> es4j: Process Command Again and Events in Memory
es4j -> EventStore: Append New Event
activate EventStore
EventStore --> es4j: Confirm Event Appended
deactivate EventStore
es4j --> CommandIssuer: Reply to Command 2
deactivate es4j

@enduml

48 changes: 48 additions & 0 deletions diagrams/config.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
@startuml

skinparam sequence {
ArrowColor DeepSkyBlue
ActorBorderColor DeepSkyBlue
LifeLineBorderColor blue
LifeLineBackgroundColor #A9DCDF
ParticipantBorderColor DeepSkyBlue
ParticipantBackgroundColor DodgerBlue
ParticipantFontName Impact
ParticipantFontSize 17
ParticipantFontColor #A9DCDF
ActorBackgroundColor aqua
ActorFontColor DeepSkyBlue
ActorFontSize 17
ActorFontName Aapex
NoteBackgroundColor wheat
NoteBorderColor sienna
NoteFontColor black
}
!define DEFAULT_MONO_FONT_SIZE 14
skinparam monochrome true

actor "Client" as f
participant "ES4J Node1" as B
database "Config Store" as C
participant "ES4J Node2" as D
participant "ES4J Node3" as E


f -> B: Send configuration
activate B
activate C
B -> C: Update table with configuration
C -> B: Emit event
B -> B: Update internal cache
deactivate B
activate D
C -> D: Emit event
D -> D: Update internal cache
deactivate D

activate E
C -> E: Emit event
deactivate C
E -> E: Update internal cache
deactivate E
@enduml
47 changes: 47 additions & 0 deletions diagrams/configmaps.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
@startuml

skinparam sequence {
ArrowColor DeepSkyBlue
ActorBorderColor DeepSkyBlue
LifeLineBorderColor blue
LifeLineBackgroundColor #A9DCDF
ParticipantBorderColor DeepSkyBlue
ParticipantBackgroundColor DodgerBlue
ParticipantFontName Impact
ParticipantFontSize 17
ParticipantFontColor #A9DCDF
ActorBackgroundColor aqua
ActorFontColor DeepSkyBlue
ActorFontSize 17
ActorFontName Aapex
NoteBackgroundColor wheat
NoteBorderColor sienna
NoteFontColor black
}
!define DEFAULT_MONO_FONT_SIZE 14

skinparam monochrome true

participant "ES4J Node1" as A
participant "ES4J Node2" as B
participant "ES4J Node3" as C
participant "ES4J Node4" as E
participant "ES4J Node5" as F
database "Kubernetes ConfigMap1" as D
database "EventStore ConfigMap" as G

A -> D: Put Watch
activate D
B -> D: Put Watch
C -> D: Put Watch
note right of D: Watches by 3 ES4J Nodes are active

E -> G: Put Watch
activate G
F -> G: Put Watch
A -> G: Put Watch
B -> G: Put Watch
C -> G: Put Watch
note right of G: Watches by 5 ES4J Nodes are active

@enduml
50 changes: 50 additions & 0 deletions diagrams/event-sequence.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
@startuml
skinparam sequence {
ArrowColor DeepSkyBlue
ActorBorderColor DeepSkyBlue
LifeLineBorderColor blue
LifeLineBackgroundColor #A9DCDF
ParticipantBorderColor DeepSkyBlue
ParticipantBackgroundColor DodgerBlue
ParticipantFontName Impact
ParticipantFontSize 17
ParticipantFontColor #A9DCDF
ActorBackgroundColor aqua
ActorFontColor DeepSkyBlue
ActorFontSize 17
ActorFontName Aapex
NoteBackgroundColor wheat
NoteBorderColor sienna
NoteFontColor black
}

!define DEFAULT_MONO_FONT_SIZE 14
skinparam monochrome true

actor Client
participant es4j as A
database "Event Store" as C

Client -> A : Sends Command with Aggregate Key(aggregateID, tenant)
activate A
A -> A : hash(AggregateKey)
A -> A : handleCommand(Command)

note over A: Generate 3 events
A -> A: Event 1 with tuple (aggregateID, tenant, 1)
A -> A: Event 2 with tuple (aggregateID, tenant, 2)
A -> A: Event 3 with tuple (aggregateID, tenant, 3)

A -> C : Persist Events to Event Store
activate C
deactivate A
note right of C: Events are stored

C --> A : Acknowledgement
deactivate C
activate A

A --> Client : Return Aggregate State
deactivate A

@enduml
15 changes: 0 additions & 15 deletions diagrams/hash-ring-2.puml

This file was deleted.

11 changes: 7 additions & 4 deletions diagrams/hash-ring-append.puml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ skinparam sequence {
NoteBorderColor sienna
NoteFontColor black
}
!define DEFAULT_MONO_FONT_SIZE 14

skinparam monochrome true

actor Client
participant "Event.x Node 1" as N1
participant "Event.x Node 2" as N2
participant "es4j Node 1" as N1
participant "es4j Node 2" as N2
database "PG Event Store" as PG


Expand All @@ -30,7 +33,7 @@ database "PG Event Store" as PG
note right: worse case scenario 1 network hop
Client -> N1 : Command(aggregateId)
N1 -> N1 : findNode(aggregateId)
note right: returns "Event.x Node 2"
note right: returns "es4j Node 2"
N1 -> N2: proxyCommand(aggregateId)
N2 -> N2: aggregateCacheMiss
N2 <-> PG: streamEvent()
Expand All @@ -44,7 +47,7 @@ N1 ->> Client : AggregateState()

Client -> N1 : Command2(aggregateId)
N1 -> N1 : findNode(aggregateId)
note right: returns "Event.x Node 1"
note right: returns "es4j Node 1"
N1 -> N1: cacheHit()
N1 -> N1: handleCommand(aggregateId)
N1 -> PG: appendEvents()
Expand Down
5 changes: 4 additions & 1 deletion diagrams/hash-ring-synchronization.puml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ skinparam sequence {
ActorFontSize 17
ActorFontName Aapex
}
!define DEFAULT_MONO_FONT_SIZE 14

participant "Event.x Bus" as LB
skinparam monochrome true

participant "Es4j Bus" as LB
note over LB: the bus is embeded in each node \n this is just to make the visualization easier
database "Node 1" as N1
database "Node 2" as N2
Expand Down
10 changes: 6 additions & 4 deletions diagrams/hash-ring.puml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ skinparam sequence {
NoteBorderColor sienna
NoteFontColor black
}
!define DEFAULT_MONO_FONT_SIZE 14

skinparam monochrome true
actor Client
participant "Event.x Node 1" as N1
participant "Event.x Node 2" as N2
participant "es4j Node 1" as N1
participant "es4j Node 2" as N2


== Worse Case Scenario ==
Expand All @@ -29,7 +31,7 @@ participant "Event.x Node 2" as N2
note right: worse case scenario 1 network hop
Client -> N1 : Command(aggregateId)
N1 -> N1 : findNode(aggregateId)
note right: returns "Event.x Node 2"
note right: returns "es4j Node 2"
N1 -> N2: proxyCommand(aggregateId)
N2 -> N2: handleCommand(aggregateId)
N2 ->> N1 : AggregateState()
Expand All @@ -40,7 +42,7 @@ N1 ->> Client : AggregateState()

Client -> N1 : Command2(aggregateId)
N1 -> N1 : findNode(aggregateId)
note right: returns "Event.x Node 1"
note right: returns "es4j Node 1"
N1 -> N1: handleCommand(aggregateId)
N1 ->> Client : AggregateState()

Expand Down
49 changes: 49 additions & 0 deletions diagrams/projection.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
@startuml

skinparam sequence {
ArrowColor DeepSkyBlue
ActorBorderColor DeepSkyBlue
LifeLineBorderColor blue
LifeLineBackgroundColor #A9DCDF
ParticipantBorderColor DeepSkyBlue
ParticipantBackgroundColor DodgerBlue
ParticipantFontName Impact
ParticipantFontSize 17
ParticipantFontColor #A9DCDF
ActorBackgroundColor aqua
ActorFontColor DeepSkyBlue
ActorFontSize 17
ActorFontName Aapex
NoteBackgroundColor wheat
NoteBorderColor sienna
NoteFontColor black
}
!define DEFAULT_MONO_FONT_SIZE 14

skinparam monochrome true

actor Client
participant Bridge
participant CommandHandler
database EventStore
participant Projection

Client -> Bridge: Issue Command
activate Bridge
Bridge -> CommandHandler: Proxy Command
activate CommandHandler
CommandHandler -> EventStore: Append Event
activate EventStore
EventStore --> CommandHandler: Confirm Event Appended
deactivate CommandHandler
EventStore -> Projection: Project Event
activate Projection
Projection --> EventStore: Confirm Projection Updated
deactivate EventStore
Client -> Projection: Query Projection
Projection --> Client: Return Query Result
deactivate Projection
Bridge --> Client: Reply to Command
deactivate Bridge

@enduml
Loading

0 comments on commit addf724

Please sign in to comment.