All Projects → banq → Jivejdon

banq / Jivejdon

Licence: apache-2.0
Jivejdon is a Domain Driven Design appication with CQRS/ES/Clean/Hexagonal architecture

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Jivejdon

Event Sourcing Jambo
An Hexagonal Architecture with DDD + Aggregates + Event Sourcing using .NET Core, Kafka e MongoDB (Blog Engine)
Stars: ✭ 159 (-44.6%)
Mutual labels:  event-driven, cqrs-es, ddd, domain-driven-design, ddd-architecture
Todomvc Ddd Cqrs Eventsourcing
Implementation of basic Todo app via tastejs/todomvc in C#/Typescript with eventsourcing, cqrs, and domain driven design
Stars: ✭ 134 (-53.31%)
Mutual labels:  eventsourcing, cqrs-es, ddd, domain-driven-design
Eshoponcontainersddd
Fork of dotnet-architecture/eShopOnContainers in full DDD/CQRS design using my own patterns
Stars: ✭ 126 (-56.1%)
Mutual labels:  eventsourcing, cqrs-es, ddd, domain-driven-design
Event Sourcing Castanha
An Event Sourcing service template with DDD, TDD and SOLID. It has High Cohesion and Loose Coupling, it's a good start for your next Microservice application.
Stars: ✭ 68 (-76.31%)
Mutual labels:  event-driven, clean-architecture, ddd, domain-driven-design
Modular Monolith With Ddd
Full Modular Monolith application with Domain-Driven Design approach.
Stars: ✭ 6,210 (+2063.76%)
Mutual labels:  clean-architecture, ddd, domain-driven-design, ddd-architecture
Run Aspnetcore
A starter kit for your next ASP.NET Core web application. Boilerplate for ASP.NET Core reference application, demonstrating a layered application architecture with applying Clean Architecture and DDD best practices. Download 100+ page eBook PDF from here ->
Stars: ✭ 227 (-20.91%)
Mutual labels:  clean-architecture, ddd, domain-driven-design, ddd-architecture
Rails event store
A Ruby implementation of an Event Store based on Active Record
Stars: ✭ 947 (+229.97%)
Mutual labels:  event-driven, cqrs-es, ddd, domain-driven-design
Cp Ddd Framework
A lightweight flexible development framework for complex business architecture with full ecosystem!轻量级业务中台开发框架,中台架构的顶层设计和完整解决方案!
Stars: ✭ 566 (+97.21%)
Mutual labels:  clean-architecture, ddd, domain-driven-design, ddd-architecture
Dotnet New Caju
Learn Clean Architecture with .NET Core 3.0 🔥
Stars: ✭ 228 (-20.56%)
Mutual labels:  event-driven, clean-architecture, ddd, domain-driven-design
Goes
Go Event Sourcing made easy
Stars: ✭ 144 (-49.83%)
Mutual labels:  event-driven, eventsourcing, ddd, domain-driven-design
Eventflow
Async/await first CQRS+ES and DDD framework for .NET
Stars: ✭ 1,932 (+573.17%)
Mutual labels:  eventsourcing, cqrs-es, ddd, domain-driven-design
awesome-software-architecture
A curated list of awesome articles, videos, and other resources to learn and practice software architecture, patterns, and principles.
Stars: ✭ 1,594 (+455.4%)
Mutual labels:  ddd, clean-architecture, event-driven, ddd-architecture
Eventflow.example
DDD+CQRS+Event-sourcing examples using EventFlow following CQRS-ES architecture. It is configured with RabbitMQ, MongoDB(Snapshot store), PostgreSQL(Read store), EventStore(GES). It's targeted to .Net Core 2.2 and include docker compose file.
Stars: ✭ 131 (-54.36%)
Mutual labels:  event-driven, eventsourcing, ddd, domain-driven-design
Bbs
巡云轻论坛系统包含论坛、问答模块。系统采用JAVA+MYSQL架构,自适应手机端和电脑端,界面简洁,性能高效。数据库表结构设计使用分表方案,提高系统的负载能力。后台数据库备份/还原、全站指定目录打包、一键自动升级等功能使维护简单方便。系统拥有强大的模板管理功能,布局版块支持设置输出条件,让前端页面展示方便快捷。
Stars: ✭ 712 (+148.08%)
Mutual labels:  forum, bbs, blog, cms
delta
DDD-centric event-sourcing library for the JVM
Stars: ✭ 15 (-94.77%)
Mutual labels:  ddd, domain-driven-design, eventsourcing, cqrs-es
eShopOnWeb
Sample ASP.NET Core 6.0 reference application, powered by Microsoft, demonstrating a layered application architecture with monolithic deployment model. Download the eBook PDF from docs folder.
Stars: ✭ 8,250 (+2774.56%)
Mutual labels:  ddd, clean-architecture, ddd-architecture
EcommerceDDD
Experimental full-stack application using Domain-Driven Design, CQRS, and Event Sourcing.
Stars: ✭ 178 (-37.98%)
Mutual labels:  ddd, domain-driven-design, clean-architecture
ddd-referenz
Deutsche Übersetzung der DDD Referenz von Eric Evans
Stars: ✭ 58 (-79.79%)
Mutual labels:  ddd, domain-driven-design, ddd-architecture
eventuous
Minimalistic Event Sourcing library for .NET
Stars: ✭ 236 (-17.77%)
Mutual labels:  ddd, domain-driven-design, eventsourcing
nota
"None Of The Above" - is going to be a secure online voting system, intended to give the electorate better choices. It always adds one additional choice to anything to be voted on: If more than 50% of voters choose "None of the Above", the election is considered null and void.
Stars: ✭ 17 (-94.08%)
Mutual labels:  ddd, eventsourcing, cqrs-es

Jivejdon

Jivejdon is a full DDD application with Event Soucing/CQRS and clean architecture/Hexagonalarchitecture, powered by jdonframework .

chinese Book : here

Domain centric Architecture

Domain centric architecture is a new way to design the morden world entreprise applications.

avatar

Use Case

avatar

DDD Aggregate Model

avatar

There are two aggregate roots in jivejdon: FormThread and ForumMessage(Root Message).

com.jdon.jivejdon.domain.model.ForumMessage is a rich model, no "public" setter method, all setter methods are "private":

avatar

Domain Model principles:

  1. High level of encapsulation

All members setter method are private by default, then internal. need heavy builder pattern to create aggregate root!

  1. High level of PI (Persistence Ignorance)

No dependencies to infrastructure, databases, other stuff. All classes are POJO.

The customer/supply model from jdonframework can seperate domain model from Persistence/Repository.

All business datas outside of domain is packed in a DTO anemic model(AnemicMessageDTO), so business rules in the aggregate root entity will not leak outside of domain.

avatar

These DTO anemic models can alseo be packed in Command and Domain Events,so they be managed in DDD ubiquitous business language.

  1. Rich in behavior

All business logic is located in Domain Model. No leaks to application layer or other places.

  1. Low level of primitive obssesion

Primitive attributes of Entites grouped together using ValueObjects.

MessageVO is a value Object, and has two attributes for message content: subject/body.

Clean architecture/Hexagonal architecture

Why clean architecture/Hexagonal architecture are a better choice for "Implementing Domain Driven Design"

JiveJdon is developed with JdonFramework that supports Customer/Supply or pub-sub model, this model can seperate domain logic from infrastructure, databases, other stuff.

avatar

JiveJdon Hexagonal_architecture:

avatar

here is package view of jivejdon:

avatar

Invoking path:

presentation -> api -> domain -> spi ->infrastructure

models.xml is a adapter for presentation:

	<model key="messageId" class="com.jdon.jivejdon.infrastructure.dto.AnemicMessageDTO">
		<actionForm name="messageForm"/>
		<handler>
			<service ref="forumMessageService">
			
				<createMethod name="createReplyMessage"/>
					
			</service>
		</handler>
	</model>

When a user post a replies message, a POST command from presentation will action the createReplyMessage method of forumMessageService in api :

public interface ForumMessageService {

	Long createReplyMessage(EventModel em) throws Exception;
	....
	
}

The forumMessageService will delegate the responsibility to the aggregate root entity ForumMessage,

The createReplyMessage() method of the forumMessageService will send a command to the addChild() method of ForumMessage that is too a command handler of CQRS:

avatar

@OnCommand("postRepliesMessageCommand") annotation make addChild() being a command handler, the annotation is from pub-sub model of jdonframework, it can make this method executed with a single-writer pattern - no blocked, no lock, high concurrent. only one thread/process invoking this update method.

"eventSourcing.addReplyMessage" will send a "ReplyMessageCreatedEvent" domain Event to infrastructure layer such as Repository. seperate domain logic from infrastructure, databases, other stuffs.

Domain event "ReplyMessageCreatedEvent" occurring in the domain is saved in the event store "jiveMessage", this is a message posted events table. the event can be used for reconstructing the latest replies state of a thread, events replay is in ForumThreadState .

CQRS architecture

CQRS addresses separates reads and writes into separate models, using commands to update data, and queries to read data.

avatar

In jivejdon ForumThread and ForumMessage are saved in cache, cache is a snapshot of even logs, if a update command activate one of these models, they will send domain events to clear the cache datas, the cache is similar as the database for query/read model, the consistency between with cache and the database for commmand model is maintained by the domain events such as "ReplyMessageCreatedEvent".

The domain event "ReplyMessageCreatedEvent" do three things:

  1. add a new post message to "jiveMessage" (events log)
  2. clear the query cache (CQRS)
  3. update/project the latest replies state of a thread (event project to state)

Event Sourcing

Posting a message is a event, modifying the latest replies status for one thread.

avatar

How to get the the latest replies status for one thread? we must iterate all posted events collection.

JiveMessage is a database storing posted events in time order, with one SQL we can reduce them chronologically to get the current state: the latest posted event:


SELECT messageID from jiveMessage WHERE  threadID = ? ORDER BY modifiedDate DESC

This sql can quickly find the latest replies post, similar as replaying all posted events to project the current state.

In jiveThread table there is no special field for latest replyies state , all states are from posted events projection. (projection can use SQL!)

When a user post a new ForumMessage, a ReplyMessageCreatedEvent event will be saved to event store: JiveMessage, simultaneously refresh the snapshot of event: ForumThreadState.

In ForumThreadState there is another method for projecting state from the database, if we want tp get the count of all message replies, its projectStateFromEventSource() method can do this:


	public void projectStateFromEventSource() {
		DomainMessage dm = this.forumThread.lazyLoaderRole.projectStateFromEventSource(forumThread.getThreadId());
		OneOneDTO oneOneDTO = null;
		try {
			oneOneDTO = (OneOneDTO) dm.getEventResult();
			if (oneOneDTO != null) {
				latestPost = (ForumMessage) oneOneDTO.getParent();
				messageCount = new AtomicLong((Long) oneOneDTO.getChild());
				dm.clear();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

lazyLoaderRole.projectStateFromEventSource will send a "projectStateFromEventSource" message to ThreadStateLoader:

public void onEvent(EventDisruptor event, boolean endOfBatch) throws Exception {
		try {
			ForumMessage latestPost = forumAbstractFactory.getMessage(lastMessageId);

			long messagereplyCount;
			long messageCount = messageQueryDao.getMessageCount(threadId);
			if (messageCount >= 1)
				messagereplyCount = messageCount - 1;
			else
				messagereplyCount = messageCount;

			OneOneDTO oneOneDTO = new OneOneDTO(latestPost, messagereplyCount);
			event.getDomainMessage().setEventResult(oneOneDTO);

		} catch (Exception e) {
			e.printStackTrace();
		}

	}

ThreadStateLoader will reconstruct current state by SQL from MySQL database, the sql is "select count(1) ...". and now we refreshed the current state of a ForumThread: the count for all message replies.

Domain model mapping to the database schema:

avatar

Most of stuffs in aggregate root "ForumThread" mapping to jiveThread table, but its "rootMessage" mapping to jiveMessage table, and its state "ForumThreadState" is projected from jiveMessage table. In jiveMessage table there are two kinds of ForumMessage: root message and replies messages, one thread only has one root message, but has many replies messages, these replies messages are replies-posted event log. in domain model,repliese messages (FormMessageReply) is a sub class of Root Message(FormMessage).

Compile & Package & Install

git clone https://github.com/banq/jivejdon.git (git clone https://gitee.com/banqjdon/jivejdon.git)
cd jivejdon
mvn clean install -U

if clone error, please remove all downloaded files in Maven local repository and try "mvn clean install -U" again, or clone from https://gitee.com/banqjdon/jivejdon

if mvn compile error, please configure your mirror Maven center repository.

Runtime download

(1) Docker:

1. docker build -t jivejdondb -f Dockerfile.db .
2. docker run  -p 3306:3306  -e MYSQL_ROOT_PASSWORD=123456 jivejdondb
3. docker build -t jivejdonweb -f Dockerfile.web .
4. docker run  -p 8080:8080 jivejdonweb

browser : http://$DOCKER_HOST_IP:8080

(2) jivejdon+tomcat+mysql download passwd:97j9

Start the server:

  1. mysql-5.6.15-winx64\bin\mysqld.exe, and telnet 127.0.0.1 3306
  2. apache-tomcat-7.0.37\bin\debug.bat

app: http://127.0.0.1:8080/

debug port:8000

you can debug jivejdon in IntelliJ Idea with connectting to 8000 port

Document

english install doc

chinese install doc

chinese design doc

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].