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_date
is set - Failure case:
completion_date
is 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
@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
- Success case:
- Result: works as expected with version
1.2.0-SNAPSHOT
due 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 bootRun
Run the following commands to trigger each scenario. For failure scenario, see the TODO
s 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;