• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

bringmeister/ddd-with-kotlin: A demo project to show a Domain Driven Design with ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

bringmeister/ddd-with-kotlin

开源软件地址(OpenSource Url):

https://github.com/bringmeister/ddd-with-kotlin

开源编程语言(OpenSource Language):

Kotlin 100.0%

开源软件介绍(OpenSource Introduction):

DDD with Kotlin

Build Status License

This is a simple demo project to show a Domain Driven Design with Kotlin.

Note that there is a similar version of this demo which is using event sourcing at event-sourcing-with-kotlin.

Run it

./gradlew bootRun

Then simulate an incoming event:

POST to http://localhost:8080/master_data_update
POST to http://localhost:8080/media_data_update

Example Use Case

The subject of this demo is the Product Service. The Product Service is located between five other components. The Master Data Service will push new products to the Product Service. This is the beginning of our business process. The Product Service will register each new product at the Media Data Service. After a product is registered, the Product Service will receive updates for this product from the Media Data Service. After an update was received, the Product Service will:

  • Update the CDN if media data has changed
  • Update the Shop and search index if master data has changed
+-------------+
| Master Data |
|   Service   |
+-------------+
   |                     << DEMO >>   
   +------------------► +---------+
    1: update product   | Product |
                        | Service |---------+---------+
               +------► +---------+         |         |
      3:       |             |      2:      |         |        5:
 push updates  |             | register new |         | update if master 
               |             |   product    |         | data has changed
   +------------+            |              |         |
   | Media Data | ◄----------+              |         +----------+
   |  Service   |                           |         |          |
   +------------+        4: update if media |         |          |
                          data has changed  |         |          |
                                            ▼         ▼          ▼
                                         +-----+  +------+  +--------+ 
                                         | CDN |  | Shop |  | Search |
                                         +-----+  +------+  +--------+

What to see

  • A domain entity called Product.kt which encapsulates business logic and throws domain events.
  • A process flow with events ("something has happened") and commands ("now do something").
  • Value objects such as ProductNumber.kt or ProductInformation.kt.
  • A ports-and-adapters package layout.
  • An anti-corruption layer for external events - they will be transformed to internal commands.

Resources




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap