Testing success and failure scenarios of Spring Modulith's Externalization
There are 3 endpoints, one for each scenario:
GET /listener- With local listener setup.
- Expectation: listener executed, entry in
event_publication- Success case:
completion_dateis set - Failure case:
completion_dateis not set, can be retried
- Success case:
- Result: works as expected
GET /noListener- With no listener
- Expectation: no entry in
event_publication - Result: works as expected
GET /externalized- With no listener, but
@Externalizedset to publish to SQS - Expectation: entry in
event_publication,- Success case:
completion_dateis set - Failure case:
completion_dateis not set, can be retried
- Success case:
- Result: works as expected with version
1.2.0-SNAPSHOTdue to a bug (1.2.0 not released yet)
- With no listener, but
# Start PostgreSQL and SQS Queue
$ docker-compose up
# Start application (another terminal)
$ ./gradlew bootRunRun the following commands to trigger each scenario. For failure scenario, see the TODOs in code.
$ curl http://localhost:8080/listener
$ curl http://localhost:8080/noListener
$ curl http://localhost:8080/externalized$ psql --host=localhost --username=local --dbname=postgres
# password: local
## Fetching events
select id, listener_id, event_type, completion_date from event_publication;