SlideShare a Scribd company logo
MODULARITY AND DOMAIN
DRIVEN DESIGN
a killer combination?
Tom De Wolf
Architect
tom.dewolf@aca-it.be
@tomdw
Stijn Van den Enden
CTO
stijn.vandenenden@aca-it.be
@stieno
www.aca-it.be
initial development maintenance phase
Software Design Customer Satisfaction
Separation of Concerns
Low coupling High Cohesion
B AB
A
• Change A impacts all
modules = costly
• Change B requires split
of module = costly
• Change A only impacts
other module if api change
• Change B limited to
module
Encapsulate Source of Change
Predictable Cost of Change
Constant change Business Driven
Aim for 1-on-1 mapping from business changes
onto software constructs
Source of Change = Business
Functional Modularisation
Vehicle
Option
Make
Warranty
Model
Transport
Location
Domain Driven Design
Without modularity
BusinessPartner
Address
Contact
consumer supplier
transports
owner
from to
Vehicle
Option
Make
Warranty
Owner
Model
Transported Item
Transport
Transport Supplier
Transport Consumer
Vehicle Context Transport Context
Domain Driven Design
Modularity with Bounded Contexts BusinessPartner
AddressContact
Business Partner Context
Location
from to
transport
vehicle
MODULAR DATABASE SCHEMA
• cross domain database structures not allowed
• queries cannot cross domain boundaries
NO foreign key
business partner
UUID MAKE MODEL OWNER_ID
djdfjfdkjdk221 Ford C-Max BE1234567
TRANSPORTED_ITEM_ID FROM CONSUMER_ID
djdfjfdkjdk221 454 BE1234567
LOCATION_ID ADDRESS
454 Sunstreet 23
foreign key
VAT_NUMBER NAME
BE1234567 Company A
BENEFITS …
• Domain modules can migrate independently
to next version!
• Database schema is internal to the domain
bundle, i.e. NOT part of the API!
• Persistence and/or database technology can
differ between modules in one system!
Mmodular database migration
cross domain transactions
Tx
Scross domain search and reporting
C
H
A
L
L
E
N
G
E
S
Mmodular database migration
M
Dev Machine 1
MIGRATION CHALLENGE
Dev Machine 2
Continuous
Integration
Test
environment
Acceptance
environment
Production
environment
Version	

1.0.0
Version	

1.0.1
Version	

1.0.2
Version	

?
Version	

?
Version	

?
environment x
Module 1 Module 2 Module 3
Version	

1.0.0
Version	

3.0.0
Version	

2.0.2
Manually track which scripts have run
on which environment for which module ?
M
LIQUIBASE
DATABASECHANGELOG table to track executed changesets for each environment
In versioned source code
XML based DSL for changeSets
www.liquibase.org
M
MODULAR LIQUIBASE
transportvehicle business partner
deployment 1
deployment 2
deployment 3
Migrate modules separately Migrate @deploy of module
migrate to initial version migrate to initial version migrate to initial version
no db changes, no migration migrate to version 2 migrate to version 2
migrate to version 3
M
THE EXTENDER PATTERN
bundle A
bundle B
bundle C
bundle D
extender bundle
Extension Pattern ?!
no match
/OSGI-INF/liquibase/db.changelog-master.xml
osgi-liquibase-extender
framework dependency
Liquibase
change sets domain A
change sets domain B
change sets domain C
• Only extender depends on
Liquibase framework
• Update of single bundle
triggers Liquibase update
• New Liquibase process 

for each matching bundle
Tcross domain transactionsx
JTA OR NOT?
• No persistence layer — direct jdbc/sql access — 1 datasource



• Multiple datasources
• Different types of persistence layers (JPA, NoSQL, …)
• JPA persistence layer in each domain bundle
• instead of one big persistence unit
• even on 1 datasource
T
1 transaction spanning multiple modular domains
JTA not needed
JTA required
x
javax.transaction.TransactionManager
transaction provider
e.g. atomikos
MODULAR PERSISTENCE
T osgi-datasource
XA enabled
vehicle-domaintransport-domain
javax.sql.DataSource
persistence
context
persistence
context
commit
x
Scross domain search
Scross domain search
SEARCH
the tale of the evil joins
NO
cross
module
search
A. Search encapsulated in a separate module leveraging
the functionality of other domain modules
search-
module
domainA
domainB
x
x
Repository
Repository
Stop
• requires specific implementation for every search	

• complexity increases with number of modules	

• inability to leverage power of the datastore
SearchAPI
domainA
B. Search is using a separate query model
search-
module
domainB
SearchAPI
EventProvider
Update	

Events
Update
Modularity and Domain Driven Design; a killer combination?
$ curl -XPUT ‘localhost:9200/vehicle/external/1’ -d ‘{	
	“make”: “BMW”,	
	 “VIN”: “30203232012102”	
}’
index document_type
id
Index a document
$ curl -XPOST ‘localhost:9200/vehicle/external/1/
_update’ -d ‘{	
	“doc”: {“make”: “Alpina”}	
}’
Update a document
index document_type
id
$ curl -XPOST localhost:9200/vehicle/_search?pretty -d
‘{"query":{"match":{"make":"BMW"}}}'	
index
Querying an index
$ curl -XPOST localhost:9200/vehicle/_search?pretty -d
‘{"query":{"match":{"make":"BMW"}}}'	
{	
"took" : 3,	
"timed_out" : false,	
"_shards" : {	
"total" : 5,	
"successful" : 5,	
"failed" : 0	
},	
"hits" : {	
"total" : 2,	
"max_score" : 0.30685282,	
"hits" : [ {	
"_index" : "vehicle",	
"_type" : "external",	
"_id" : "1",	
"_score" : 0.30685282, "_source" : {"make": "BMW", "VIN": "30203232012102"}	
}, {	
"_index" : "vehicle",	
"_type" : "external",	
"_id" : "2",	
"_score" : 0.30685282, "_source" : {"make": "BMW", "VIN": "30203232012112"}	
} ]}}	
!
Querying an index
• Distributed (shards/replicas)	

• Advanced Quering (lucene/geo/
aggregation)	

• Facets (terms/ranges/histogram)	

• API (HTTP/Java/JavaTesting)	

• …
{
1Populate the index
1Populate the index
package be.vabfs.search.api;	
!
public interface SearchIndexService {	
	 	
	 void update(Object entityToUpdate);	
	 	
	 void delete(Object entityToRemove);	
!
	 void populate();	
!
	 void clear();	
!
}
search
SearchIndexService
domainB
Entity
EntityListener
@PrePersist
@PostUpdate
@PostRemove
1Populate the index
search
SearchIndexService
update(entity)
Synchronise onTransaction
Track updated entities
A
Map entities to searchData
B
Bulk update search index
C
1Populate the index
Map entities to searchData
B
package be.vabfs.search.api.data;	
!
import java.util.List;	
!
public interface SearchDataProvider {	
!
	 Class<? extends Object> getEntityClass();	
	 	
	 List<SearchData> index(Object entity);	
!
}
domainB
Entity
SearchData
1Populate the index
Map entities to searchData
B
SearchDataProvider
domainB
Entity
SearchData
1Populate the index
A
search
SearchIndexService
update(entity)
Synchronise onTransaction
Track updated entities
Bulk update search index
C
Map entities to searchData
B SearchDataProvider
domainB
A
2Enhancing Search
2Enhancing Search
2Enhancing Search
search
SearchService
package be.vabfs.search.api;	
!
import …	
!
public interface SearchService {	
	
…	
!
SearchResults query(String query, int start, int rows,	
	 	 	 	 	 	 	 	String sort, String sortOrder,	
	 	 	 	 	 	 	 	 	 String documentType);	
	 	
	 List<String> options(String field, 	
	 	 	 	 	 	 	 	 	 	 String... documentTypes);	
	 	
	 List<SearchCriterion> availableCriteria(	
	 	 	 	 	 	 	 	 	 	 String... criteriaCategories);	
	 	
}
2Enhancing Search
package be.vabfs.search.api.criteria;	
!
import java.util.List;	
!
public interface SearchCriteriaProvider {	
	 	
	 String getProviderCategory();	
	 	
	 List<SearchCriterion> getAvailableCriteria();	
}	
package be.vabfs.search.api.criteria;	
!
public interface SearchCriterion {	
!
	 String getName();	
	 String getKey();	
	 String getUnitName();	
	 SearchCriterionType getType();	
	 SearchCriterionQueryType getQueryType();	
	 String getDocumentType();	
!
}
"vehicle.mileage"
"mileage"
SearchCriterionType.NUMBER
SearchCriterionQueryType.RANGE_NUMBER
"SERVICE_ITEM"
"km"
2Enhancing Search
search
SearchService
domainB
SearchCriteriaProvider
domainB
LESSONS LEARNED
@deployment time migration = RISK
• have CI build continuously migrate current production
data
Refactor wrong modularisation requires unwanted migration
dependencies
• reset/flatten migration change sets to restore
modularisation
Migration
Cross domain search and reporting
Effort to integrate search is limited
• due to dynamic osgi service model
Advanced search functionality is possible
WHAT IS NEXT?
Multiple module versions active? Multiple schema versions
active?
• e.g. feature try-out to limited customer base
Downgrade to older module version?
• Previous schema with new data?
Hot deploy while users are firing requests?
• Migration still busy = failure
Migration
Cross domain search and reporting
Domain Specific Query Language
!
Exploiting elastic search capabilities beyond search, e.g.
reporting
M
Modular migration
Liquibase extender @ DeployT
Cross domain transactions
Distributed JTA transactionsx S
Cross domain search
Elasticsearch view
Functionally	

not limited by domain module boundaries to answer business questions
Non-functionally
future-proof platform with impact of change contained in loosely coupled domain modules
Tom De Wolf
Architect
tom.dewolf@aca-it.be
@tomdw
Stijn Van den Enden
CTO
stijn.vandenenden@aca-it.be
@stieno
www.aca-it.be

More Related Content

PPT
Domain Driven Design (DDD)
PDF
DDD Basics - Context mapping
PDF
Domain driven design and model driven development
PPTX
Brownfield Domain Driven Design
PPTX
Domain Driven Design
PDF
DDD Strategic Design - Context Maps - Paulo Clavijo - April 2018
PPTX
Domain Driven Design
PDF
Baby steps to Domain-Driven Design
Domain Driven Design (DDD)
DDD Basics - Context mapping
Domain driven design and model driven development
Brownfield Domain Driven Design
Domain Driven Design
DDD Strategic Design - Context Maps - Paulo Clavijo - April 2018
Domain Driven Design
Baby steps to Domain-Driven Design

What's hot (20)

PPTX
Domain Driven Design(DDD) Presentation
PDF
Introduction to-ddd
PDF
Tactical DDD (just better OOP?) - PHPBenelux 2017
PPTX
Introduction to DDD
PPTX
Applying Domain-Driven Design to craft Rich Domain Models
PPT
Domain Driven Design Demonstrated
PPTX
Domain-Driven Design
PPTX
شرح Domain Driven Design بالعربي
PDF
Domain Driven Design Development Spring Portfolio
PDF
Amazon AWS - a quick review
PDF
Domain driven design: a gentle introduction
PPTX
Domain Driven Design: Zero to Hero
PDF
Domain Event - The Hidden Gem of DDD
PDF
Modularity and Domain Driven Design; a killer Combination? - Tom de Wolf & St...
PDF
DDD and Microservices: Like Peanut Butter and Jelly - Matt Stine
PPTX
Domain Driven Design 101
PPTX
DITA Quick Start for Authors Part II
PDF
Domain Driven Design
PDF
If your computer is cloud what its Operating System look like?
PPTX
Crafted Design - Sandro Mancuso
Domain Driven Design(DDD) Presentation
Introduction to-ddd
Tactical DDD (just better OOP?) - PHPBenelux 2017
Introduction to DDD
Applying Domain-Driven Design to craft Rich Domain Models
Domain Driven Design Demonstrated
Domain-Driven Design
شرح Domain Driven Design بالعربي
Domain Driven Design Development Spring Portfolio
Amazon AWS - a quick review
Domain driven design: a gentle introduction
Domain Driven Design: Zero to Hero
Domain Event - The Hidden Gem of DDD
Modularity and Domain Driven Design; a killer Combination? - Tom de Wolf & St...
DDD and Microservices: Like Peanut Butter and Jelly - Matt Stine
Domain Driven Design 101
DITA Quick Start for Authors Part II
Domain Driven Design
If your computer is cloud what its Operating System look like?
Crafted Design - Sandro Mancuso
Ad

Viewers also liked (20)

PPTX
Refactoring domain driven design way
ODP
jTransfo lightning talk
PDF
Domain Driven Design
PPTX
Mapping Problem Domain Objects to Object-Persistence Formats(OOAD)
PPTX
Applying Object Composition to Build Rich Domain Models
KEY
ZendCon 2011 UnCon Domain-Driven Design
PPT
Domain driven design in a nutshell
PPTX
Success by Challenging Assumptions (Part I)
PPTX
Domain Driven Design Quickly
PDF
Introduction to Domain Driven Design
KEY
Context Mapping In Action
PPTX
Domain State model OOAD
PDF
Domain Driven Design and Hexagonal Architecture with Rails
PDF
Refactoring for Domain Driven Design
PPT
Domain object model
PDF
Why Domain-Driven Design Matters
PDF
Domain Driven Design Introduction
PDF
Domain-Driven Design with ASP.NET MVC
PPTX
Implementing DDD with C#
PPTX
A Practical Guide to Domain Driven Design: Presentation Slides
Refactoring domain driven design way
jTransfo lightning talk
Domain Driven Design
Mapping Problem Domain Objects to Object-Persistence Formats(OOAD)
Applying Object Composition to Build Rich Domain Models
ZendCon 2011 UnCon Domain-Driven Design
Domain driven design in a nutshell
Success by Challenging Assumptions (Part I)
Domain Driven Design Quickly
Introduction to Domain Driven Design
Context Mapping In Action
Domain State model OOAD
Domain Driven Design and Hexagonal Architecture with Rails
Refactoring for Domain Driven Design
Domain object model
Why Domain-Driven Design Matters
Domain Driven Design Introduction
Domain-Driven Design with ASP.NET MVC
Implementing DDD with C#
A Practical Guide to Domain Driven Design: Presentation Slides
Ad

Similar to Modularity and Domain Driven Design; a killer combination? (20)

PDF
Jlook open api server platform
PPT
SPLive Orlando - Beyond the Search Center - Application or Solution?
PDF
"A Study of I/O and Virtualization Performance with a Search Engine based on ...
PDF
Webinar: Increase Conversion With Better Search
PPTX
Software Development: Beyond Training wheels
PDF
ISWC 2012 - Industry Track: "Linked Enterprise Data: leveraging the Semantic ...
PDF
What is DDD and how could it help you
PPTX
DDD_upload
PDF
2009.10.22 S308460 Cloud Data Services
PPTX
Applying Domain-Driven Design to APIs and Microservices - Austin API Meetup
PDF
Model Driven Architecture (MDA): Motivations, Status & Future
PDF
JavaOne 2009 - Full-Text Search: Human Heaven and Database Savior in the Cloud
PPTX
Designing APIs and Microservices Using Domain-Driven Design
PPTX
Nosql Now 2012: MongoDB Use Cases
PPT
Technology Fundamentals
PPT
Technology Fundamentals
PPT
Geotech presentation 2012
PDF
Modularity and Layered Data Model
PPTX
Lets focus on business value
PPTX
Data at Scale - Michael Peacock, Cloud Connect 2012
Jlook open api server platform
SPLive Orlando - Beyond the Search Center - Application or Solution?
"A Study of I/O and Virtualization Performance with a Search Engine based on ...
Webinar: Increase Conversion With Better Search
Software Development: Beyond Training wheels
ISWC 2012 - Industry Track: "Linked Enterprise Data: leveraging the Semantic ...
What is DDD and how could it help you
DDD_upload
2009.10.22 S308460 Cloud Data Services
Applying Domain-Driven Design to APIs and Microservices - Austin API Meetup
Model Driven Architecture (MDA): Motivations, Status & Future
JavaOne 2009 - Full-Text Search: Human Heaven and Database Savior in the Cloud
Designing APIs and Microservices Using Domain-Driven Design
Nosql Now 2012: MongoDB Use Cases
Technology Fundamentals
Technology Fundamentals
Geotech presentation 2012
Modularity and Layered Data Model
Lets focus on business value
Data at Scale - Michael Peacock, Cloud Connect 2012

More from ACA IT-Solutions (20)

PDF
The steps of enterprise innovation at ACA IT-Solutions
PDF
The right tool / technology for the right job : by Yakup Kalin (ACA IT-Soluti...
PPTX
IT MATCH: Vastgoedfinanciering voor zelfstandigen / freelancers in België
PDF
ACA-Mobile - Creating Enterprise Apps with MADP
PDF
JavaOne 2016 - 10 Key Lessons you should know
PDF
Axway Introduction & Digital Business (by Jo Van Audenhove & Rogier van Boxtel)
PDF
How to transform your business with Appcelerator (Stijn Wijndaele)
PDF
ACA IT-Solutions introduction 2016 (Willy Van Mechelen)
PDF
Appcelerator: Customer testimonial and demo (VAB Fleet Services - Diederik De...
PDF
IT MATCH: Aansprakelijkheidsverzekering voor IT'ers
PDF
IT MATCH: contracten onderhandelen als zelfstandige / freelancer
PDF
IT MATCH: Pensioen voor zelfstandigen (België)
PDF
Revolutionize your IT Team with JIRA Service Desk
PDF
Going Beyond JIRA Service Desk: Use Cases in Action
PDF
'DOCKER' & CLOUD: ENABLERS For DEVOPS
PDF
What’s hot in the world of atlassian
PDF
JavaOne 2015: 14 Key Lessons, you should learn
PDF
JIRA Portfolio: Failing to plan is your best plan for failure
PPTX
A practical guide on what UX could mean to your business (Peter Gevaerts - AC...
PPTX
What is IoT and how can it impact your business - by Piet Vandaele
The steps of enterprise innovation at ACA IT-Solutions
The right tool / technology for the right job : by Yakup Kalin (ACA IT-Soluti...
IT MATCH: Vastgoedfinanciering voor zelfstandigen / freelancers in België
ACA-Mobile - Creating Enterprise Apps with MADP
JavaOne 2016 - 10 Key Lessons you should know
Axway Introduction & Digital Business (by Jo Van Audenhove & Rogier van Boxtel)
How to transform your business with Appcelerator (Stijn Wijndaele)
ACA IT-Solutions introduction 2016 (Willy Van Mechelen)
Appcelerator: Customer testimonial and demo (VAB Fleet Services - Diederik De...
IT MATCH: Aansprakelijkheidsverzekering voor IT'ers
IT MATCH: contracten onderhandelen als zelfstandige / freelancer
IT MATCH: Pensioen voor zelfstandigen (België)
Revolutionize your IT Team with JIRA Service Desk
Going Beyond JIRA Service Desk: Use Cases in Action
'DOCKER' & CLOUD: ENABLERS For DEVOPS
What’s hot in the world of atlassian
JavaOne 2015: 14 Key Lessons, you should learn
JIRA Portfolio: Failing to plan is your best plan for failure
A practical guide on what UX could mean to your business (Peter Gevaerts - AC...
What is IoT and how can it impact your business - by Piet Vandaele

Recently uploaded (20)

PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Getting Started with Data Integration: FME Form 101
PDF
Mushroom cultivation and it's methods.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PPTX
A Presentation on Artificial Intelligence
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
OMC Textile Division Presentation 2021.pptx
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Programs and apps: productivity, graphics, security and other tools
PPT
Teaching material agriculture food technology
PPTX
Machine Learning_overview_presentation.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
Getting Started with Data Integration: FME Form 101
Mushroom cultivation and it's methods.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
NewMind AI Weekly Chronicles - August'25-Week II
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Network Security Unit 5.pdf for BCA BBA.
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
A Presentation on Artificial Intelligence
Building Integrated photovoltaic BIPV_UPV.pdf
Approach and Philosophy of On baking technology
Diabetes mellitus diagnosis method based random forest with bat algorithm
OMC Textile Division Presentation 2021.pptx
Heart disease approach using modified random forest and particle swarm optimi...
Advanced methodologies resolving dimensionality complications for autism neur...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Programs and apps: productivity, graphics, security and other tools
Teaching material agriculture food technology
Machine Learning_overview_presentation.pptx

Modularity and Domain Driven Design; a killer combination?

  • 1. MODULARITY AND DOMAIN DRIVEN DESIGN a killer combination? Tom De Wolf Architect tom.dewolf@aca-it.be @tomdw Stijn Van den Enden CTO stijn.vandenenden@aca-it.be @stieno www.aca-it.be
  • 2. initial development maintenance phase Software Design Customer Satisfaction Separation of Concerns Low coupling High Cohesion B AB A • Change A impacts all modules = costly • Change B requires split of module = costly • Change A only impacts other module if api change • Change B limited to module Encapsulate Source of Change Predictable Cost of Change Constant change Business Driven Aim for 1-on-1 mapping from business changes onto software constructs Source of Change = Business Functional Modularisation
  • 3. Vehicle Option Make Warranty Model Transport Location Domain Driven Design Without modularity BusinessPartner Address Contact consumer supplier transports owner from to
  • 4. Vehicle Option Make Warranty Owner Model Transported Item Transport Transport Supplier Transport Consumer Vehicle Context Transport Context Domain Driven Design Modularity with Bounded Contexts BusinessPartner AddressContact Business Partner Context Location from to
  • 5. transport vehicle MODULAR DATABASE SCHEMA • cross domain database structures not allowed • queries cannot cross domain boundaries NO foreign key business partner UUID MAKE MODEL OWNER_ID djdfjfdkjdk221 Ford C-Max BE1234567 TRANSPORTED_ITEM_ID FROM CONSUMER_ID djdfjfdkjdk221 454 BE1234567 LOCATION_ID ADDRESS 454 Sunstreet 23 foreign key VAT_NUMBER NAME BE1234567 Company A
  • 6. BENEFITS … • Domain modules can migrate independently to next version! • Database schema is internal to the domain bundle, i.e. NOT part of the API! • Persistence and/or database technology can differ between modules in one system!
  • 7. Mmodular database migration cross domain transactions Tx Scross domain search and reporting C H A L L E N G E S
  • 9. M Dev Machine 1 MIGRATION CHALLENGE Dev Machine 2 Continuous Integration Test environment Acceptance environment Production environment Version 1.0.0 Version 1.0.1 Version 1.0.2 Version ? Version ? Version ? environment x Module 1 Module 2 Module 3 Version 1.0.0 Version 3.0.0 Version 2.0.2 Manually track which scripts have run on which environment for which module ?
  • 10. M LIQUIBASE DATABASECHANGELOG table to track executed changesets for each environment In versioned source code XML based DSL for changeSets www.liquibase.org
  • 11. M MODULAR LIQUIBASE transportvehicle business partner deployment 1 deployment 2 deployment 3 Migrate modules separately Migrate @deploy of module migrate to initial version migrate to initial version migrate to initial version no db changes, no migration migrate to version 2 migrate to version 2 migrate to version 3
  • 12. M THE EXTENDER PATTERN bundle A bundle B bundle C bundle D extender bundle Extension Pattern ?! no match /OSGI-INF/liquibase/db.changelog-master.xml osgi-liquibase-extender framework dependency Liquibase change sets domain A change sets domain B change sets domain C • Only extender depends on Liquibase framework • Update of single bundle triggers Liquibase update • New Liquibase process 
 for each matching bundle
  • 14. JTA OR NOT? • No persistence layer — direct jdbc/sql access — 1 datasource
 
 • Multiple datasources • Different types of persistence layers (JPA, NoSQL, …) • JPA persistence layer in each domain bundle • instead of one big persistence unit • even on 1 datasource T 1 transaction spanning multiple modular domains JTA not needed JTA required x
  • 15. javax.transaction.TransactionManager transaction provider e.g. atomikos MODULAR PERSISTENCE T osgi-datasource XA enabled vehicle-domaintransport-domain javax.sql.DataSource persistence context persistence context commit x
  • 17. Scross domain search SEARCH the tale of the evil joins
  • 19. A. Search encapsulated in a separate module leveraging the functionality of other domain modules search- module domainA domainB x x Repository Repository Stop • requires specific implementation for every search • complexity increases with number of modules • inability to leverage power of the datastore SearchAPI
  • 20. domainA B. Search is using a separate query model search- module domainB SearchAPI EventProvider Update Events Update
  • 22. $ curl -XPUT ‘localhost:9200/vehicle/external/1’ -d ‘{ “make”: “BMW”, “VIN”: “30203232012102” }’ index document_type id Index a document
  • 23. $ curl -XPOST ‘localhost:9200/vehicle/external/1/ _update’ -d ‘{ “doc”: {“make”: “Alpina”} }’ Update a document index document_type id
  • 24. $ curl -XPOST localhost:9200/vehicle/_search?pretty -d ‘{"query":{"match":{"make":"BMW"}}}' index Querying an index
  • 25. $ curl -XPOST localhost:9200/vehicle/_search?pretty -d ‘{"query":{"match":{"make":"BMW"}}}' { "took" : 3, "timed_out" : false, "_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 2, "max_score" : 0.30685282, "hits" : [ { "_index" : "vehicle", "_type" : "external", "_id" : "1", "_score" : 0.30685282, "_source" : {"make": "BMW", "VIN": "30203232012102"} }, { "_index" : "vehicle", "_type" : "external", "_id" : "2", "_score" : 0.30685282, "_source" : {"make": "BMW", "VIN": "30203232012112"} } ]}} ! Querying an index
  • 26. • Distributed (shards/replicas) • Advanced Quering (lucene/geo/ aggregation) • Facets (terms/ranges/histogram) • API (HTTP/Java/JavaTesting) • … {
  • 28. 1Populate the index package be.vabfs.search.api; ! public interface SearchIndexService { void update(Object entityToUpdate); void delete(Object entityToRemove); ! void populate(); ! void clear(); ! } search SearchIndexService domainB Entity EntityListener @PrePersist @PostUpdate @PostRemove
  • 29. 1Populate the index search SearchIndexService update(entity) Synchronise onTransaction Track updated entities A Map entities to searchData B Bulk update search index C
  • 30. 1Populate the index Map entities to searchData B package be.vabfs.search.api.data; ! import java.util.List; ! public interface SearchDataProvider { ! Class<? extends Object> getEntityClass(); List<SearchData> index(Object entity); ! } domainB Entity SearchData
  • 31. 1Populate the index Map entities to searchData B SearchDataProvider domainB Entity SearchData
  • 32. 1Populate the index A search SearchIndexService update(entity) Synchronise onTransaction Track updated entities Bulk update search index C Map entities to searchData B SearchDataProvider domainB A
  • 35. 2Enhancing Search search SearchService package be.vabfs.search.api; ! import … ! public interface SearchService { … ! SearchResults query(String query, int start, int rows, String sort, String sortOrder, String documentType); List<String> options(String field, String... documentTypes); List<SearchCriterion> availableCriteria( String... criteriaCategories); }
  • 36. 2Enhancing Search package be.vabfs.search.api.criteria; ! import java.util.List; ! public interface SearchCriteriaProvider { String getProviderCategory(); List<SearchCriterion> getAvailableCriteria(); } package be.vabfs.search.api.criteria; ! public interface SearchCriterion { ! String getName(); String getKey(); String getUnitName(); SearchCriterionType getType(); SearchCriterionQueryType getQueryType(); String getDocumentType(); ! } "vehicle.mileage" "mileage" SearchCriterionType.NUMBER SearchCriterionQueryType.RANGE_NUMBER "SERVICE_ITEM" "km"
  • 38. LESSONS LEARNED @deployment time migration = RISK • have CI build continuously migrate current production data Refactor wrong modularisation requires unwanted migration dependencies • reset/flatten migration change sets to restore modularisation Migration Cross domain search and reporting Effort to integrate search is limited • due to dynamic osgi service model Advanced search functionality is possible
  • 39. WHAT IS NEXT? Multiple module versions active? Multiple schema versions active? • e.g. feature try-out to limited customer base Downgrade to older module version? • Previous schema with new data? Hot deploy while users are firing requests? • Migration still busy = failure Migration Cross domain search and reporting Domain Specific Query Language ! Exploiting elastic search capabilities beyond search, e.g. reporting
  • 40. M Modular migration Liquibase extender @ DeployT Cross domain transactions Distributed JTA transactionsx S Cross domain search Elasticsearch view Functionally not limited by domain module boundaries to answer business questions Non-functionally future-proof platform with impact of change contained in loosely coupled domain modules
  • 41. Tom De Wolf Architect tom.dewolf@aca-it.be @tomdw Stijn Van den Enden CTO stijn.vandenenden@aca-it.be @stieno www.aca-it.be