Java 26392 Move modules to patterns-module (#15060)

* JAVA-26392 Move axon module and ddd module to patterns-modules

* JAVA-26292 Move ddd-contexts to patterns-module
This commit is contained in:
anuragkumawat
2023-10-27 15:57:32 +05:30
committed by GitHub
parent 16b931c4df
commit 1028ab97c4
146 changed files with 23 additions and 28 deletions
@@ -0,0 +1,9 @@
## Setup DDD Hexagonal Spring Application
To run this project, follow these steps:
* Run the application database by executing `docker-compose up` in this directory.
* Launch the Spring Boot Application (DomainLayerApplication).
* By default, the application will connect to the one of the two databases (configuration in *ddd-layers.properties*)
* check `CassandraDbOrderRepository.java` and `MongoDbOrderRepository.java`
* switch between the databases by making one of the above beans primary using the `@Primary` annotation
@@ -0,0 +1,12 @@
CREATE KEYSPACE IF NOT exists order_database
WITH replication = {'class':'SimpleStrategy', 'replication_factor':1};
CREATE TYPE IF NOT EXISTS order_database.orderitementity (productid uuid, price decimal);
CREATE TABLE IF NOT EXISTS order_database.orderentity(
id uuid,
status text,
orderitementities list<frozen<orderitementity>>,
price decimal,
primary key(id)
);
@@ -0,0 +1,30 @@
version: '3'
services:
order-mongo-database:
image: mongo:3.4.13
container_name: order-mongo-db
restart: always
ports:
- 27017:27017
environment:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: admin
MONGO_INITDB_DATABASE: order-database
volumes:
- ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
order-cassandra-database:
image: cassandra:3.11.5
container_name: order-cassandra-db
restart: always
ports:
- 9042:9042
order-cassandra-init:
image: cassandra:3.11.5
container_name: order-cassandra-db-init
depends_on:
- order-cassandra-database
volumes:
- ./cassandra-init.cql:/cassandra-init.cql:ro
command: bin/bash -c "echo Initializing cassandra schema... && sleep 30 && cqlsh -u cassandra -p cassandra -f cassandra-init.cql order-cassandra-db"
@@ -0,0 +1,12 @@
db.createUser(
{
user: "order",
pwd: "order",
roles: [
{
role: "readWrite",
db: "order-database"
}
]
}
);
@@ -0,0 +1,12 @@
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.mongo.embedded.EmbeddedMongoAutoConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
spring.data.mongodb.host=127.0.0.1
spring.data.mongodb.port=27017
spring.data.mongodb.database=order-database
spring.data.mongodb.username=order
spring.data.mongodb.password=order
spring.data.cassandra.keyspaceName=order_database
spring.data.cassandra.username=cassandra
spring.data.cassandra.password=cassandra
spring.data.cassandra.contactPoints=127.0.0.1
spring.data.cassandra.port=9042