Skip to content

Commit 654fd61

Browse files
committed
Renamed EventBus to EventStore in ES workshop
1 parent 406df09 commit 654fd61

File tree

132 files changed

+1315
-1631
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+1315
-1631
lines changed

EventSourcing.NetCore.sln

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,18 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core.EntityFramework", "Cor
490490
EndProject
491491
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core.EntityFramework.Tests", "Core.EntityFramework.Tests\Core.EntityFramework.Tests.csproj", "{040621EF-1D78-443B-8871-2ABC070496BA}"
492492
EndProject
493+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "16-EntitiesDefinition", "Workshops\IntroductionToEventSourcing\Solved\16-EntitiesDefinition\16-EntitiesDefinition.csproj", "{05A2E622-6616-492C-A913-C8F7B219F01A}"
494+
EndProject
495+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "15-EventsDefinition", "Workshops\IntroductionToEventSourcing\Solved\15-EventsDefinition\15-EventsDefinition.csproj", "{DE52526A-43CD-4A21-A9FF-C86C6A8555E2}"
496+
EndProject
497+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "17-BusinessProcesses", "Workshops\IntroductionToEventSourcing\Solved\17-BusinessProcesses\17-BusinessProcesses.csproj", "{B87B8E84-7306-433A-A072-5CE922F3E4AD}"
498+
EndProject
499+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "15-EventsDefinition", "Workshops\IntroductionToEventSourcing\15-EventsDefinition\15-EventsDefinition.csproj", "{2E689CB0-B10D-4606-A2E2-0E9E0BF53A10}"
500+
EndProject
501+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "16-EntitiesDefinition", "Workshops\IntroductionToEventSourcing\16-EntitiesDefinition\16-EntitiesDefinition.csproj", "{34F0D75D-97E1-4E61-801D-26DF2CA381B0}"
502+
EndProject
503+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "17-BusinessProcesses", "Workshops\IntroductionToEventSourcing\17-BusinessProcesses\17-BusinessProcesses.csproj", "{7F5CD0C7-8F7A-41EC-BC25-B00FA471243B}"
504+
EndProject
493505
Global
494506
GlobalSection(SolutionConfigurationPlatforms) = preSolution
495507
Debug|Any CPU = Debug|Any CPU
@@ -1108,6 +1120,30 @@ Global
11081120
{040621EF-1D78-443B-8871-2ABC070496BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
11091121
{040621EF-1D78-443B-8871-2ABC070496BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
11101122
{040621EF-1D78-443B-8871-2ABC070496BA}.Release|Any CPU.Build.0 = Release|Any CPU
1123+
{05A2E622-6616-492C-A913-C8F7B219F01A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
1124+
{05A2E622-6616-492C-A913-C8F7B219F01A}.Debug|Any CPU.Build.0 = Debug|Any CPU
1125+
{05A2E622-6616-492C-A913-C8F7B219F01A}.Release|Any CPU.ActiveCfg = Release|Any CPU
1126+
{05A2E622-6616-492C-A913-C8F7B219F01A}.Release|Any CPU.Build.0 = Release|Any CPU
1127+
{DE52526A-43CD-4A21-A9FF-C86C6A8555E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
1128+
{DE52526A-43CD-4A21-A9FF-C86C6A8555E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
1129+
{DE52526A-43CD-4A21-A9FF-C86C6A8555E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
1130+
{DE52526A-43CD-4A21-A9FF-C86C6A8555E2}.Release|Any CPU.Build.0 = Release|Any CPU
1131+
{B87B8E84-7306-433A-A072-5CE922F3E4AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
1132+
{B87B8E84-7306-433A-A072-5CE922F3E4AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
1133+
{B87B8E84-7306-433A-A072-5CE922F3E4AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
1134+
{B87B8E84-7306-433A-A072-5CE922F3E4AD}.Release|Any CPU.Build.0 = Release|Any CPU
1135+
{2E689CB0-B10D-4606-A2E2-0E9E0BF53A10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
1136+
{2E689CB0-B10D-4606-A2E2-0E9E0BF53A10}.Debug|Any CPU.Build.0 = Debug|Any CPU
1137+
{2E689CB0-B10D-4606-A2E2-0E9E0BF53A10}.Release|Any CPU.ActiveCfg = Release|Any CPU
1138+
{2E689CB0-B10D-4606-A2E2-0E9E0BF53A10}.Release|Any CPU.Build.0 = Release|Any CPU
1139+
{34F0D75D-97E1-4E61-801D-26DF2CA381B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
1140+
{34F0D75D-97E1-4E61-801D-26DF2CA381B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
1141+
{34F0D75D-97E1-4E61-801D-26DF2CA381B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
1142+
{34F0D75D-97E1-4E61-801D-26DF2CA381B0}.Release|Any CPU.Build.0 = Release|Any CPU
1143+
{7F5CD0C7-8F7A-41EC-BC25-B00FA471243B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
1144+
{7F5CD0C7-8F7A-41EC-BC25-B00FA471243B}.Debug|Any CPU.Build.0 = Debug|Any CPU
1145+
{7F5CD0C7-8F7A-41EC-BC25-B00FA471243B}.Release|Any CPU.ActiveCfg = Release|Any CPU
1146+
{7F5CD0C7-8F7A-41EC-BC25-B00FA471243B}.Release|Any CPU.Build.0 = Release|Any CPU
11111147
EndGlobalSection
11121148
GlobalSection(SolutionProperties) = preSolution
11131149
HideSolutionNode = FALSE
@@ -1313,6 +1349,12 @@ Global
13131349
{E1B97A7B-97C3-4C14-9BE6-ACE0AF45CE61} = {0570E45A-2EB6-4C4C-84E4-2C80E1FECEB5}
13141350
{840B5027-91B5-42F2-A431-17DBD05F0BDC} = {0570E45A-2EB6-4C4C-84E4-2C80E1FECEB5}
13151351
{040621EF-1D78-443B-8871-2ABC070496BA} = {0570E45A-2EB6-4C4C-84E4-2C80E1FECEB5}
1352+
{05A2E622-6616-492C-A913-C8F7B219F01A} = {65F6E2BE-B2D4-4E56-B0CB-3062C4882B9E}
1353+
{DE52526A-43CD-4A21-A9FF-C86C6A8555E2} = {65F6E2BE-B2D4-4E56-B0CB-3062C4882B9E}
1354+
{B87B8E84-7306-433A-A072-5CE922F3E4AD} = {65F6E2BE-B2D4-4E56-B0CB-3062C4882B9E}
1355+
{2E689CB0-B10D-4606-A2E2-0E9E0BF53A10} = {14C7B928-9D6C-441A-8A1F-0C49173E73EB}
1356+
{34F0D75D-97E1-4E61-801D-26DF2CA381B0} = {14C7B928-9D6C-441A-8A1F-0C49173E73EB}
1357+
{7F5CD0C7-8F7A-41EC-BC25-B00FA471243B} = {14C7B928-9D6C-441A-8A1F-0C49173E73EB}
13161358
EndGlobalSection
13171359
GlobalSection(ExtensibilityGlobals) = postSolution
13181360
SolutionGuid = {A5F55604-2FF3-43B7-B657-4F18E6E95D3B}

Workshops/IntroductionToEventSourcing/12-Projections.SingleStream/ProjectionsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public void GettingState_ForSequenceOfEvents_ShouldSucceed()
9797
var database = new Database();
9898

9999
// TODO:
100-
// 1. Register here your event handlers using `eventBus.Register`.
100+
// 1. Register here your event handlers using `eventStore.Register`.
101101
// 2. Store results in database.
102102

103103
// first confirmed

Workshops/IntroductionToEventSourcing/12-Projections.SingleStream/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ With the [Database](./Tools/Database.cs) interface representing the sample datab
1111
- total number of products
1212
- confirmed and canceled shopping carts should not be visible.
1313

14-
Add event handlers registrations in [ProjectionsTests](ProjectionsTests.cs) calling [EventBus.Register](./Tools/EventBus.cs) method.
14+
Add event handlers registrations in [ProjectionsTests](ProjectionsTests.cs) calling [EventStore.Register](./Tools/EventStore.cs) method.
1515

1616
If needed expand existing classes definition.

Workshops/IntroductionToEventSourcing/13-Projections.SingleStream.Idempotency/ProjectionsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ public void GettingState_ForSequenceOfEvents_ShouldSucceed()
243243
var database = new Database();
244244

245245
// TODO:
246-
// 1. Register here your event handlers using `eventBus.Register`.
246+
// 1. Register here your event handlers using `eventStore.Register`.
247247
// 2. Store results in database.
248248
var shoppingCartDetailsProjection = new ShoppingCartDetailsProjection(database);
249249

Workshops/IntroductionToEventSourcing/13-Projections.SingleStream.Idempotency/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ With the [Database](./Tools/Database.cs) interface representing the sample datab
1111
- total number of products
1212
- confirmed and canceled shopping carts should not be visible.
1313

14-
Add event handlers registrations in [ProjectionsTests](ProjectionsTests.cs) calling [EventBus.Register](./Tools/EventBus.cs) method.
14+
Add event handlers registrations in [ProjectionsTests](ProjectionsTests.cs) calling [EventStore.Register](./Tools/EventStore.cs) method.
1515

1616
Track and implement proper idempotency handling in projection event handlers.
1717

Workshops/IntroductionToEventSourcing/14-Projections.SingleStream.EventualConsistency/ProjectionsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ public void GettingState_ForSequenceOfEvents_ShouldSucceed()
243243
var database = new Database();
244244

245245
// TODO:
246-
// 1. Register here your event handlers using `eventBus.Register`.
246+
// 1. Register here your event handlers using `eventStore.Register`.
247247
// 2. Store results in database.
248248
var shoppingCartDetailsProjection = new ShoppingCartDetailsProjection(database);
249249

Workshops/IntroductionToEventSourcing/14-Projections.SingleStream.EventualConsistency/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ With the [Database](./Tools/Database.cs) interface representing the sample datab
1111
- total number of products
1212
- confirmed and canceled shopping carts should not be visible.
1313

14-
Add event handlers registrations in [ProjectionsTests](ProjectionsTests.cs) calling [EventBus.Register](./Tools/EventBus.cs) method.
14+
Add event handlers registrations in [ProjectionsTests](ProjectionsTests.cs) calling [EventStore.Register](./Tools/EventStore.cs) method.
1515

1616
Track and implement proper idempotency and eventual consistency handling in projection event handlers.
1717

Workshops/IntroductionToEventSourcing/16-EntitiesDefinition/Core/EventBus.cs

Lines changed: 0 additions & 65 deletions
This file was deleted.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using FluentAssertions;
2+
3+
namespace EntitiesDefinition.Core;
4+
5+
public class EventCatcher
6+
{
7+
public List<object> Published { get; } = [];
8+
9+
public void Catch(object message) =>
10+
Published.Add(message);
11+
12+
public void Reset() => Published.Clear();
13+
14+
public void ShouldNotReceiveAnyEvent() =>
15+
Published.Should().BeEmpty();
16+
17+
18+
public void ShouldReceiveEvent<T>(T message) where T: notnull
19+
{
20+
Published.Should().Contain(message);
21+
}
22+
23+
public void ShouldReceiveSingleEvent<T>(T message)
24+
{
25+
Published.Should().HaveCount(1);
26+
Published.OfType<T>().Should().HaveCount(1);
27+
Published.Single().Should().Be(message);
28+
}
29+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
namespace EntitiesDefinition.Core;
2+
3+
public record EventMetadata(
4+
string EventId,
5+
ulong StreamPosition,
6+
ulong LogPosition
7+
)
8+
{
9+
public static EventMetadata For(ulong streamPosition, ulong logPosition) =>
10+
new(Guid.NewGuid().ToString(), streamPosition, logPosition);
11+
}
12+
13+
public record EventEnvelope(
14+
object Data,
15+
EventMetadata Metadata
16+
);
17+
18+
public record EventEnvelope<T>(
19+
T Data,
20+
EventMetadata Metadata
21+
): EventEnvelope(Data, Metadata) where T : notnull
22+
{
23+
public new T Data => (T)base.Data;
24+
}

0 commit comments

Comments
 (0)