Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mploed/event-driven-spring-boot
Example Application to demo various flavours of handling domain events in Spring Boot
https://github.com/mploed/event-driven-spring-boot
atom event-driven event-sourcing events feed rest-api spring spring-boot spring-cloud-stream spring-data-jpa
Last synced: 6 days ago
JSON representation
Example Application to demo various flavours of handling domain events in Spring Boot
- Host: GitHub
- URL: https://github.com/mploed/event-driven-spring-boot
- Owner: mploed
- License: apache-2.0
- Created: 2017-05-18T12:10:05.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-09-24T08:53:12.000Z (over 6 years ago)
- Last Synced: 2025-01-08T15:17:44.116Z (13 days ago)
- Topics: atom, event-driven, event-sourcing, events, feed, rest-api, spring, spring-boot, spring-cloud-stream, spring-data-jpa
- Language: Java
- Homepage:
- Size: 409 KB
- Stars: 265
- Watchers: 32
- Forks: 123
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Event Driven Applications with Spring Boot
This projects tries to capture various options you have when dealing with Event Driven Spring Boot applications.
The follwing Spring Technologies are being used:
- Spring Boot
- Spring Cloud Stream Rabbit
- Spring Data JPAThese examples contain various different ways to model and deal with events:
- Complete aggregates / entities in the events
- REST Resource URLs in events
- Partial parsing / handling of events in consumers
- Events as Atom Feeds## Prerequisites
- You need to have Docker installed## How to run and install the example
In the root directory you need to
1. Compile everything with ./mvnw package
2. Start everything up with docker-compose up --build## Running on Kubernetes
Mind the KubernetesSetup.md file in the kubernetes directory## URLs and Ports
Each of the modules is it's own Spring Boot Application which can be accessed as follows:
Name
Application / Enpoint Type
URL
Application Process
9000
http://localhost:9000
Credit Application
9001
http://localhost:9001/credit-application
Customer
9002
http://localhost:9002/customer and http://localhost:9002/customer/feed
Scoring
9003
No UI
CreditDecision
9004
http://localhost:9004/credit-decision and http://localhost:9004/credit-decision/feed
## Messaging Infrastructure & Domain Events
### Public Events
#### CreditApplicationNumberGeneratedEvent
Source: application-processPersisted in source: no
Consumers:
- credit-application
- credit-decisionTopic: CreditApplicationNumberGeneratedTopic
#### CreditApplicationEnteredEvent
Source: credit-applicationPersisted in source: yes in its own Table via JPA
Consumers:
- application-process
- credit-decisionTopic: CreditApplicationEnteredTopic
#### CustomerCreatedEvent
Source: customerPersisted in source: no
Consumers:
- application-process
- credit-decisionTopic: CustomerCreatedTopic
#### ScoringPositiveEvent
Source: scoringPersisted in source: no
Consumers:
- application-process
- credit-decisionTopic: ScoringPositiveTopic
#### ScoringNegativeEvent
Source: scoringPersisted in source: no
Consumers:
- application-process
- credit-decisionTopic: ScoringNegativeTopic
#### ApplicationDeclinedEvent
Source: credit-decisionPersisted in source: not as an event
Consumers:
- application-processTopic: ApplicationDeclinedTopic
### Internal Events
#### Credit-Application
- CreditDetailsEnteredEvent
- FinancialSituationEnteredEventBoth events are stored
Source: credit-application
Storage: Own Table via JPA### Feeds
#### Customer Feed
Url: http://localhost:9002/customer/feedContains URLs to Customer Resources
#### Credit Decision Feed
Url: http://localhost:9004/credit-decision/feedContains Application Numbers that have been confirmed
## Event Types being used
This demo shows various types of event types: Events with all the data, Events with Resource Urls and "Events" as Feeds#### Events with all the data
Especially the CreditApplicationEnteredEvent falls into this category: it contains all of the data for the credit application
such as the financial situation and the details of the actual credit. By consuming this event you will not need additional
roundtrips to upstream systemsOther events that fall into this category are:
- ApplicationNumberGeneratedEvent
- ScoringNegativeEvent
- ScoringPositiveEvent
- ApplicationDeclinedEvent##### Idea of Bounded Context:
Please take a close look at how the CreditApplicationEnteredEvent is being reflected in the scoring application. Yes, we
take in all the payload from the broker but the public model of the event has a clear focus on the scoring context's view
on the data.#### Events with a Resource URL
These Events do not contain a lot of information. They may contian something like a business process identifier such as
the applicationNumber in this example but for the purpose of this demo I refrained from doing that. So the CustomerCreatedEvent
only contians the URL to the Customer REST Resource from which interested contexts can obtain the payload from.#### "Events" via Feeds
Althoug the usage of feeds is no plain and pure event driven processing style I think that they come in handy when you
are dealing with situations like these:
- you have issues with your message broker and firewalls and these issues can't be resolved easily
- you need to have an event replay functionality in place that enables consumers to restore their replicated dataYou can find "Events via Feeds" in the customer and the credit-decision (see Feeds) applications.