Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/antonioalmeida/spring-modulith-externalization-demo
Testing success and failure scenarios of Spring Modulith's Externalization
https://github.com/antonioalmeida/spring-modulith-externalization-demo
aws-sqs localstack spring-boot spring-modulith
Last synced: about 18 hours ago
JSON representation
Testing success and failure scenarios of Spring Modulith's Externalization
- Host: GitHub
- URL: https://github.com/antonioalmeida/spring-modulith-externalization-demo
- Owner: antonioalmeida
- Created: 2023-11-30T13:18:24.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2023-11-30T15:28:22.000Z (12 months ago)
- Last Synced: 2024-05-21T07:12:14.783Z (6 months ago)
- Topics: aws-sqs, localstack, spring-boot, spring-modulith
- Language: Java
- Homepage:
- Size: 66.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# spring-modulith-externalization-demo
Testing success and failure scenarios of Spring Modulith's [Externalization](https://docs.spring.io/spring-modulith/reference/events.html#externalization)
## Results
There are 3 endpoints, one for each scenario:
1. `GET /listener`
- With local listener setup.
- Expectation: listener executed, entry in `event_publication`
- Success case: `completion_date` is set
- Failure case: `completion_date` is not set, can be retried
- Result: works as expected
1. `GET /noListener`
- With no listener
- Expectation: no entry in `event_publication`
- Result: works as expected
1. `GET /externalized`
- With no listener, but `@Externalized` set to publish to SQS
- Expectation: entry in `event_publication`,
- Success case: `completion_date` is set
- Failure case: `completion_date` is not set, can be retried
- Result: works as expected with version `1.2.0-SNAPSHOT` due to a [bug](https://github.com/spring-projects/spring-modulith/issues/395) (1.2.0 not released yet)## Do it yourself
### Setup
```shell
# Start PostgreSQL and SQS Queue
$ docker-compose up# Start application (another terminal)
$ ./gradlew bootRun
```## Trigger Events
Run the following commands to trigger each scenario. For failure scenario, see the `TODO`s in code.
```shell
$ curl http://localhost:8080/listener
$ curl http://localhost:8080/noListener
$ curl http://localhost:8080/externalized
```### Checking DB
```shell
$ psql --host=localhost --username=local --dbname=postgres
# password: local## Fetching events
select id, listener_id, event_type, completion_date from event_publication;
```