-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactors domain Events for moduliths
- Loading branch information
Showing
16 changed files
with
168 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...kendApplicationDefaultGenerator/src/main/java/core/implementation/partials/withEvents.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...endApplicationDefaultGenerator/src/main/java/core/outbound/events/EventPublisher.java.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package {{outboundEventsPackage}}; | ||
|
||
import {{domainEventsPackage}}.*; | ||
import {{entitiesPackage}}.*; | ||
|
||
public interface EventPublisher { | ||
|
||
{{#each events as |event|}} | ||
void on{{event.className}}({{event.className}} event); | ||
{{/each}} | ||
} |
20 changes: 20 additions & 0 deletions
20
...cationDefaultGenerator/src/main/java/infrastructure/events/DefaultEventPublisher.java.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package {{infrastructureEventsPackage}}; | ||
|
||
import {{domainEventsPackage}}.*; | ||
import {{entitiesPackage}}.*; | ||
import {{outboundEventsPackage}}.EventPublisher; | ||
import org.springframework.context.ApplicationEventPublisher; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@lombok.RequiredArgsConstructor | ||
public class DefaultEventPublisher implements EventPublisher { | ||
|
||
private final ApplicationEventPublisher applicationEventPublisher; | ||
|
||
{{#each events as |event|}} | ||
public void on{{event.className}}({{event.className}} event) { | ||
applicationEventPublisher.publishEvent(event); | ||
} | ||
{{/each}} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...ationDefaultGenerator/src/test/java/infrastructure/events/InMemoryEventPublisher.java.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package {{infrastructureEventsPackage}}; | ||
|
||
import {{domainEventsPackage}}.*; | ||
import {{entitiesPackage}}.*; | ||
import {{outboundEventsPackage}}.EventPublisher; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class InMemoryEventPublisher implements EventPublisher { | ||
|
||
private final List<Object> events = new ArrayList<>(); | ||
|
||
public List<Object> getEvents() { | ||
return events; | ||
} | ||
{{~#each events as |event|}} | ||
public void on{{event.className}}({{event.className}} event) { | ||
events.add(event); | ||
} | ||
{{~/each}} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.