Getting Started with Axon Framework 5 - Send Notification to the Administrator When All Courses Are Fully Booked

I’m following the Axon Framework 5 – Getting Started tutorial and have a question about the feature:
“Send Notification to the Administrator When All Courses Are Fully Booked.”

In the AutomationEventHandler class, the EventSourcedEntity state is retrieved with this line:

var state = context.component(StateManager.class)
    .loadEntity(State.class, FACULTY_ID, context)
    .join();

When I run the test automationTest() in
WhenAllCoursesFullyBookedThenSendNotificationAxonFixtureTest,
I can see that the State entity is created (@EntityCreated),
but it’s not sourced by the events defined in the fixture test.

As a result, both the capacity and student count remain 0,
so the system incorrectly assumes that all courses are fully booked.

Should all events include the following property?
@EventTag(key = FacultyTags.FACULTY_ID) FacultyId facultyId ?

I came to the same conclusion and filed a pull request here :slightly_smiling_face: Fixed AllCoursesFullyBookedNotifier and its tests, enhanced sample co… by AukeHaanstra · Pull Request #13 · AxonIQ/university-demo · GitHub

1 Like