SlideShare a Scribd company logo
1 of 41
Download to read offline
Turning Maven into a High scalable,
resource efficient,
cloud ready microservice
Oracle Code One 24 Oct 2018
Alex Porcelli
Business Automation Architect
Max Dessì
Senior Software Engineer
Speakers
Massimiliano Dessì has more than 18
years of experience in programming.
Co-founder of Java User Group Sardegna,
Manager of Google Developer Group
Sardegna,
Author of Spring 2.5 AOP (Packt)
He works as a Senior Software Engineer
for Red Hat in the BSIG
(Business Systems and Intelligence
Group) , on KIE projects (Knowledge Is
Everything),
he lives in Cagliari, Sardinia, Europe.
Alex Porcelli is Principal Software
Engineer at JBoss by Red Hat, proud
member of the architecture group behind
the Drools, jBPM and Business Central
platform, and co-founder of AppFormer.
Professional developer since 1996, has
been working exclusively on Open Source
projects for almost a decade. Since joined
Red Hat he has been focusing on web
enabled of the Drools&jBPM platforms
redefining all web tooling. Porcelli is also a
frequent speaker in tech events like QCon,
JavaOne, CodeOne, Red Hat Summit and
DevNation.
QUICK INTRO TO BUSINESS CENTRAL
● KJAR
○ What is a KJAR
● Maven based packaging model
○ kie-maven-plugin
○ kie-takari-plugin
4
BUSINESS CENTRAL
ALL ABOUT BUSINESS PROCESS AND RULES
<groupId>com.example</groupId>
<artifactId>user-project</artifactId>
<packaging>kjar</packaging>
<build>
<plugins>
<plugin>
<groupId>org.kie</groupId>
<artifactId>kie-maven-plugin</artifactId>
<version>7.10.0.Final</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
5
● Multiple Personas
● Design
○ Practitioners & Devs
○ Modeling tools
○ Hides Tech details (ie. POM)
○ Git backed storage
○ Editors need access to project
classloader for autocomplete
■ A build is needed on every
user I/O action
BUSINESS CENTRAL
ALL ABOUT BUSINESS PROCESS AND RULES
6
BUSINESS CENTRAL
DESIGN ENVIRONMENT
BUSINESS CENTRAL REQUIREMENTS
The GOOD
● Builds Incrementally
● Multi-thread support
● Uses POM.xml as input
● Just works
○ In production for ~6y
8
CURRENT IN-HOUSE BUILD SYSTEM
The BAD
● Stateful
● Hard to scale out
● Hard to work on CI/CD
● Don’t respect Maven semantics
○ Problems from customers
(RFE)
9
REQUEST:
REPLACE CURRENT BUILD WITH MAVEN
REQUIREMENTS GATHERING
10
11
INCREMENTAL COMPILATION
REQUIREMENT
Business Central user shouldn’t have to wait for a full compilation if the user has just
changed a POJO or a Business Rule.
Most of Business Central rich editors provide some level of autocomplete that is based on
the project content (Rules, Processes, POJOs, Configs, etc.).
On every user I/O action, it needs trigger an incremental build.
12
RESPECT/PRESERVE USER’S POM
Business Central users shouldn’t require to change their POM’s if they already work outside
Business central.
The system should be able to adapt on the fly User’s POM in order to make changed needed
that result in a incremental build.
REQUIREMENT
13
LOW LATENCY AND MEMORY FOOTPRINT
REQUIREMENT
Business Central is a web based tool, that has to support multiple concurrent users.
Maven is designed as stateless, however its bootstrap is quite heavy (multiple containers
have to be initialized, like plexus/sisu/guice).
Business Central has different interactions that relies on the build system: Incremental for
every user I/O operation, JUnit/Rules/Process execution, Packaging and Deployment.
Every use case, requires some configuration/tweak of Maven execution.
14
ADJUSTABLE FOR DIFFERENT USE CASES
REQUIREMENT
Business Central should enable multiple users interact with projects, including collaboration
in the same project.
Everyone that had to check a Maven output log of a build with a “-T 2” knows that logs are
not isolated per thread.
Maven Embedder can’t even execute correctly more than 4 threads at same time
(parameter parser get lost).
15
MULTI-THREAD
REQUIREMENT
Business Central users may work in the same project in a isolated way (forked).
Avoid users step on other toes when consuming and producing artifacts (KJARs).
16
MULTI-USER/MULTI-M2REPO
REQUIREMENT
The build system should be consumed by Business Central “as a Service” and should be
developed as a cloud native component.
Builds could be executed co-located (within Business Central, suitable for incremental
compilation) or executed remotely.
It’s expect that on heavy load the build system be auto-scaled by cloud infrastructure.
17
µService/Cloud Native
REQUIREMENT
Business Central should be able to keep working even if a malicious code is executed by a
Business Rule or Process (ie. System.exit).
For efficient user interaction incremental compilation should be, as much as possible, be
executed in the same JVM. However it’s necessary some isolation of JUnit/Rules/Process
execution to avoid shut down the Application Server using System.exit.
18
In & Off-Process
REQUIREMENT
The kie-maven-plugin and kie-takari-plugin create some in-memory objects that are super
heavy to create (basically all metadata information for all rules and process in a
pre-compiled way).
Original Maven API basically returns only two values: FAIL or SUCCESS.
19
RETURN RICH DATA STRUCTURES
REQUIREMENT
Compile, Packaging, JUnit Runs… or any Maven execution can take some time (like
download the internet!), and we should not block Caller to wait for the completion of those
heavy tasks.
Useful also for remote execution.
20
ASYNC API
REQUIREMENT
21
DETAILED REQUIREMENT LIST
The devil is in the details
● Incremental compilation
● Respect/Preserve User’s POM
● Low latency and memory footprint
● Adjustable for Different Use Cases
○ Compilation, JUnit Run, etc
● Multi-thread
● Multi-user
○ Multi M2 repos
● µService/Cloud Native
○ Local and Remote executions
● Embedded & Off-process mode
● Return rich data structures
○ Beyond Fail/Success
○ Collect data from PlugIn’s
● Async API
MAVEN AS A SERVICE
FEATURES
23
THE SOLUTION
Provide an “enhanced compiler” with request-response behavior as
simple as possible in its use and configuration and rich in terms of
objects in the response compared to “plain” Maven
24
● Maven repo per request
● Project Path
● Maven CLI arguments
● Settings file
● Unique Compilation ID
REQUEST
interface CompilationRequest {
AFCliRequest getKieCliRequest();
WorkspaceCompilationInfo getInfo();
String getMavenRepo();
String[] getOriginalArgs();
Map<String, Object> getMap();
String getRequestUUID();
Boolean skipAutoSourceUpdate();
Boolean skipProjectDependenciesCreationList();
Boolean getRestoreOverride();
}
25
● Result of the build
● In Memory Log
● Dependency List
● Target folder content
RESPONSE
interface CompilationResponse {
Boolean isSuccessful();
List<String> getMavenOutput();
Optional<Path> getWorkingDir();
List<String> getDependencies();
List<URI> getDependenciesAsURI();
List<URL> getDependenciesAsURL();
List<String> getTargetContent();
List<URI> getTargetContentAsURI();
List<URL> getTargetContentAsURL();
}
26
● Drools live objects extracted from
the Maven plugin
● Drools live objects generated on the
fly (no .class file)
● Classloaders contents
KIE RESPONSE EXTENSION
interface KieCompilationResponse
extends CompilationResponse {
Optional<KieModuleMetaInfo> getKieModuleMetaInfo();
Optional<KieModule> getKieModule();
Map<String, byte[]> getProjectClassLoaderStore();
Set<String> getEventTypeClasses();
}
We add objects to the Maven result (a
simple int) and we use a pipeline of
decorators to add behaviours before and
after compilation
27
COMPILER
interface AFCompiler<T extends CompilationResponse> {
T compile(final CompilationRequest req);
T compile(final CompilationRequest req,
final Map<Path, InputStream> override);
Boolean cleanInternalCache();
}
PIPELINE: CHAIN OF DECORATORS
● Static factory for common use cases
● Configurable per object
● Possible to provide your own
decorator
28
MAVEN API VERY RESTRICT
The first problem is how to open the
“sealed” Maven API, we change the use of
Plexus/Sisu we can reuse the same IoC
container per project saving a huge
amount of time, because the major part of
the time in a Maven startup is the creation
of this container
29
CLASSLOADERS
30
Maven use classworlds to manage the various classloaders used for its tasks
● System Classloader
● Core Classloader
● Plugin Classloaders
● Custom Classloaders
https://maven.apache.org/guides/mini/guide-maven-classloading.html
CLASSLOADERS
31
If we want read an object inside the plugin
and export it to the client code we have to
cross the barriers of those classloaders.
● ReusableAFMavenCli
● BuildMojo
● BaseMavenCompiler
IN MEMORY PLUGINS
32
A cool side effects when you cross the
barriers of the classloaders is the option to
turn the plugins impl from FS to in
memory.
INCREMENTAL COMPILER
33
To spent less time in front of a Maven build
we change on the fly the pom to add the
Takari compiler in every module of the
project tied with the compiler
POM PROCESSOR
34
The Compiler is aware
of the plugins in the POM
It changes on the fly
the Pom turning off the Default Compiler
and adds Takari and the Kie Plugin
ASYNC API
35
interface AFCompilerService {
CompletableFuture<KieCompilationResponse> build(Path projectPath, String mavenRepo);
CompletableFuture<KieCompilationResponse> build(Path projectPath, String mavenRepo,
Map<Path, InputStream> override);
CompletableFuture<KieCompilationResponse> build(Path projectPath, String mavenRepo,
Boolean skipPrjDependenciesCreationList);
CompletableFuture<KieCompilationResponse> buildAndInstall(Path projectPath, String mavenRepo);
CompletableFuture<KieCompilationResponse> buildAndInstall(Path projectPath, String mavenRepo,
Boolean skipPrjDependenciesCreationList);
CompletableFuture<KieCompilationResponse> buildSpecialized(Path projectPath, String mavenRepo, String[] args);
CompletableFuture<KieCompilationResponse> buildSpecialized(Path projectPath,
String mavenRepo,
String[] args,
Boolean skipPrjDependenciesCreationList);
}
COMPILER SERVICE
36
We could use the compiler core
to enable a compiler service
enabling local Maven executors
or remote Maven executors
on other nodes/pods/containers/VMs
COMPILER SERVICE
37
We could demand a build to a remote
node/pod/container/vm
and reads a remote File System
because
the core compiler
can use use a
JGITCompilerBeforeDecorator
LOCAL/REMOTE EXECUTORS
38
The compiler service need to know if the
current “machine” owns enough resources
to run a local executors or if is better to
ask to a remote executor to satisfy the
build.
To invoke a remote executors It needs to
know the address to reach the chosen
instance.
REST ENDPOINT
39
@Path("/build/maven/")
@RequestScoped
public class MavenRestHandler extends Application {
@POST
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public void postAsync(@Suspended AsyncResponse ar,
@HeaderParam("project") String projectRepo,
@HeaderParam("mavenrepo") String mavenRepo) throws Exception {
CompletableFuture<KieCompilationResponse> response = compilerService.build(projectRepo, mavenRepo);
response.whenCompleteAsync((kieCompilationResponse, throwable) -> {
if (throwable != null) {
logger.error(throwable.getMessage());
ar.resume(Response.serverError().build());
} else {
byte[] bytes = RestUtils.serialize(new DefaultHttpCompilationResponse(kieCompilationResponse));
ar.resume(Response.ok(bytes).build());
}
});
}
}
Resources
40
https://github.com/desmax74 https://github.com/porcelli
https://twitter.com/desmax74 https://twitter.com/porcelli
https://pt.slideshare.net/alexandre_porcelli/https://www.slideshare.net/desmax74
THANK YOU
plus.google.com/+RedHat
linkedin.com/company/red-hat
youtube.com/user/RedHatVideos
facebook.com/redhatinc
twitter.com/RedHat

More Related Content

What's hot

GlassFish Server 3.1: Deploying your Java EE 6 Applications
GlassFish Server 3.1: Deploying your Java EE 6 ApplicationsGlassFish Server 3.1: Deploying your Java EE 6 Applications
GlassFish Server 3.1: Deploying your Java EE 6 ApplicationsArun Gupta
 
OSGi and Java EE in GlassFish - Tech Days 2010 India
OSGi and Java EE in GlassFish - Tech Days 2010 IndiaOSGi and Java EE in GlassFish - Tech Days 2010 India
OSGi and Java EE in GlassFish - Tech Days 2010 IndiaArun Gupta
 
Mavenizing your Liferay project
Mavenizing your Liferay projectMavenizing your Liferay project
Mavenizing your Liferay projectmimacom
 
Cloud Foundry a Developer's Perspective
Cloud Foundry a Developer's PerspectiveCloud Foundry a Developer's Perspective
Cloud Foundry a Developer's PerspectiveDave McCrory
 
An XPager's Guide to Process Server-Side Jobs on Domino
An XPager's Guide to Process Server-Side Jobs on DominoAn XPager's Guide to Process Server-Side Jobs on Domino
An XPager's Guide to Process Server-Side Jobs on DominoFrank van der Linden
 
GlassFish in Production Environments
GlassFish in Production EnvironmentsGlassFish in Production Environments
GlassFish in Production EnvironmentsBruno Borges
 
Peering Inside the Black Box: A Case for Observability
Peering Inside the Black Box: A Case for ObservabilityPeering Inside the Black Box: A Case for Observability
Peering Inside the Black Box: A Case for ObservabilityVMware Tanzu
 
Nuxeo WebEngine and GlassFish v3
Nuxeo WebEngine and GlassFish v3Nuxeo WebEngine and GlassFish v3
Nuxeo WebEngine and GlassFish v3Nuxeo
 
Developing modular Java applications
Developing modular Java applicationsDeveloping modular Java applications
Developing modular Java applicationsJulien Dubois
 
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...ddrschiw
 
GlassFish 3.1 – Simplifying your Java EE 6 Development and Deployment @ JAX L...
GlassFish 3.1 – Simplifying your Java EE 6 Development and Deployment @ JAX L...GlassFish 3.1 – Simplifying your Java EE 6 Development and Deployment @ JAX L...
GlassFish 3.1 – Simplifying your Java EE 6 Development and Deployment @ JAX L...Arun Gupta
 
Serverless Java Challenges & Triumphs
Serverless Java Challenges & TriumphsServerless Java Challenges & Triumphs
Serverless Java Challenges & TriumphsDavid Delabassee
 
Java Modularity with OSGi
Java Modularity with OSGiJava Modularity with OSGi
Java Modularity with OSGiIlya Rybak
 
Migrating From Applets to Java Desktop Apps in JavaFX
Migrating From Applets to Java Desktop Apps in JavaFXMigrating From Applets to Java Desktop Apps in JavaFX
Migrating From Applets to Java Desktop Apps in JavaFXBruno Borges
 
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)Andreas Koop
 

What's hot (20)

GlassFish v3 Prelude Aquarium Paris
GlassFish v3 Prelude Aquarium ParisGlassFish v3 Prelude Aquarium Paris
GlassFish v3 Prelude Aquarium Paris
 
GlassFish Server 3.1: Deploying your Java EE 6 Applications
GlassFish Server 3.1: Deploying your Java EE 6 ApplicationsGlassFish Server 3.1: Deploying your Java EE 6 Applications
GlassFish Server 3.1: Deploying your Java EE 6 Applications
 
OSGi and Java EE in GlassFish - Tech Days 2010 India
OSGi and Java EE in GlassFish - Tech Days 2010 IndiaOSGi and Java EE in GlassFish - Tech Days 2010 India
OSGi and Java EE in GlassFish - Tech Days 2010 India
 
Mavenizing your Liferay project
Mavenizing your Liferay projectMavenizing your Liferay project
Mavenizing your Liferay project
 
Cloud Foundry a Developer's Perspective
Cloud Foundry a Developer's PerspectiveCloud Foundry a Developer's Perspective
Cloud Foundry a Developer's Perspective
 
An XPager's Guide to Process Server-Side Jobs on Domino
An XPager's Guide to Process Server-Side Jobs on DominoAn XPager's Guide to Process Server-Side Jobs on Domino
An XPager's Guide to Process Server-Side Jobs on Domino
 
GlassFish in Production Environments
GlassFish in Production EnvironmentsGlassFish in Production Environments
GlassFish in Production Environments
 
Peering Inside the Black Box: A Case for Observability
Peering Inside the Black Box: A Case for ObservabilityPeering Inside the Black Box: A Case for Observability
Peering Inside the Black Box: A Case for Observability
 
Java 9 modularity
Java 9 modularityJava 9 modularity
Java 9 modularity
 
Nuxeo WebEngine and GlassFish v3
Nuxeo WebEngine and GlassFish v3Nuxeo WebEngine and GlassFish v3
Nuxeo WebEngine and GlassFish v3
 
Modular Java
Modular JavaModular Java
Modular Java
 
Developing modular Java applications
Developing modular Java applicationsDeveloping modular Java applications
Developing modular Java applications
 
Java modularization
Java modularizationJava modularization
Java modularization
 
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
 
GlassFish 3.1 – Simplifying your Java EE 6 Development and Deployment @ JAX L...
GlassFish 3.1 – Simplifying your Java EE 6 Development and Deployment @ JAX L...GlassFish 3.1 – Simplifying your Java EE 6 Development and Deployment @ JAX L...
GlassFish 3.1 – Simplifying your Java EE 6 Development and Deployment @ JAX L...
 
Serverless Java Challenges & Triumphs
Serverless Java Challenges & TriumphsServerless Java Challenges & Triumphs
Serverless Java Challenges & Triumphs
 
Java Modularity with OSGi
Java Modularity with OSGiJava Modularity with OSGi
Java Modularity with OSGi
 
Migrating From Applets to Java Desktop Apps in JavaFX
Migrating From Applets to Java Desktop Apps in JavaFXMigrating From Applets to Java Desktop Apps in JavaFX
Migrating From Applets to Java Desktop Apps in JavaFX
 
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
 
JavaCro'14 - WebLogic-GlassFish-JaaS Strategy and Roadmap – Duško Vukmanović
JavaCro'14 - WebLogic-GlassFish-JaaS Strategy and Roadmap – Duško VukmanovićJavaCro'14 - WebLogic-GlassFish-JaaS Strategy and Roadmap – Duško Vukmanović
JavaCro'14 - WebLogic-GlassFish-JaaS Strategy and Roadmap – Duško Vukmanović
 

Similar to Code One 2018 maven

MuleSoft Surat Virtual Meetup#15 - Caching Scope, Caching Strategy and Jenkin...
MuleSoft Surat Virtual Meetup#15 - Caching Scope, Caching Strategy and Jenkin...MuleSoft Surat Virtual Meetup#15 - Caching Scope, Caching Strategy and Jenkin...
MuleSoft Surat Virtual Meetup#15 - Caching Scope, Caching Strategy and Jenkin...Jitendra Bafna
 
Agile integration: Decomposing the monolith
Agile integration: Decomposing the monolithAgile integration: Decomposing the monolith
Agile integration: Decomposing the monolithJudy Breedlove
 
MuleSoft Surat Virtual Meetup#35 - Setting up MuleSoft Runtime and Anypoint C...
MuleSoft Surat Virtual Meetup#35 - Setting up MuleSoft Runtime and Anypoint C...MuleSoft Surat Virtual Meetup#35 - Setting up MuleSoft Runtime and Anypoint C...
MuleSoft Surat Virtual Meetup#35 - Setting up MuleSoft Runtime and Anypoint C...Jitendra Bafna
 
How to build a cloud adapter
How to build a cloud adapterHow to build a cloud adapter
How to build a cloud adapterMaarten Smeets
 
Apache Mesos Overview and Integration
Apache Mesos Overview and IntegrationApache Mesos Overview and Integration
Apache Mesos Overview and IntegrationAlex Baretto
 
MuleSoft Meetup Adelaide 7th April 2021
MuleSoft Meetup Adelaide 7th April 2021MuleSoft Meetup Adelaide 7th April 2021
MuleSoft Meetup Adelaide 7th April 2021Nicholas Bowman
 
Java Development on Bluemix
Java Development on BluemixJava Development on Bluemix
Java Development on BluemixRam Vennam
 
OSDC 2018 | Three years running containers with Kubernetes in Production by T...
OSDC 2018 | Three years running containers with Kubernetes in Production by T...OSDC 2018 | Three years running containers with Kubernetes in Production by T...
OSDC 2018 | Three years running containers with Kubernetes in Production by T...NETWAYS
 
Anypoint Tools and MuleSoft Automation (DRAFT).pptx
Anypoint Tools and MuleSoft Automation (DRAFT).pptxAnypoint Tools and MuleSoft Automation (DRAFT).pptx
Anypoint Tools and MuleSoft Automation (DRAFT).pptxAkshata Sawant
 
MuleSoft Meetup #9 - Anypoint Tools and MuleSoft Automation (FINAL).pptx
MuleSoft Meetup #9 - Anypoint Tools and MuleSoft Automation (FINAL).pptxMuleSoft Meetup #9 - Anypoint Tools and MuleSoft Automation (FINAL).pptx
MuleSoft Meetup #9 - Anypoint Tools and MuleSoft Automation (FINAL).pptxSteve Clarke
 
API Microservices with Node.js and Docker
API Microservices with Node.js and DockerAPI Microservices with Node.js and Docker
API Microservices with Node.js and DockerApigee | Google Cloud
 
Nyc mule soft_meetup_13_march_2021
Nyc mule soft_meetup_13_march_2021Nyc mule soft_meetup_13_march_2021
Nyc mule soft_meetup_13_march_2021NeerajKumar1965
 
Operator Framework Overview
Operator Framework OverviewOperator Framework Overview
Operator Framework OverviewRob Szumski
 
Containerize, PaaS, or Go Serverless!?
Containerize, PaaS, or Go Serverless!?Containerize, PaaS, or Go Serverless!?
Containerize, PaaS, or Go Serverless!?Phil Estes
 
Pivotal Cloud Foundry 2.6: A First Look
Pivotal Cloud Foundry 2.6: A First LookPivotal Cloud Foundry 2.6: A First Look
Pivotal Cloud Foundry 2.6: A First LookVMware Tanzu
 
Meet Magento Spain 2019 - Our Experience with Magento Cloud
Meet Magento Spain 2019 - Our Experience with Magento CloudMeet Magento Spain 2019 - Our Experience with Magento Cloud
Meet Magento Spain 2019 - Our Experience with Magento CloudLyzun Oleksandr
 
MuleSoft Surat Virtual Meetup#16 - Anypoint Deployment Option, API and Operat...
MuleSoft Surat Virtual Meetup#16 - Anypoint Deployment Option, API and Operat...MuleSoft Surat Virtual Meetup#16 - Anypoint Deployment Option, API and Operat...
MuleSoft Surat Virtual Meetup#16 - Anypoint Deployment Option, API and Operat...Jitendra Bafna
 
198970820 p-oooooooooo
198970820 p-oooooooooo198970820 p-oooooooooo
198970820 p-oooooooooohomeworkping4
 
OSDC 2018 | Highly Available Cloud Foundry on Kubernetes by Cornelius Schumacher
OSDC 2018 | Highly Available Cloud Foundry on Kubernetes by Cornelius SchumacherOSDC 2018 | Highly Available Cloud Foundry on Kubernetes by Cornelius Schumacher
OSDC 2018 | Highly Available Cloud Foundry on Kubernetes by Cornelius SchumacherNETWAYS
 

Similar to Code One 2018 maven (20)

MuleSoft Surat Virtual Meetup#15 - Caching Scope, Caching Strategy and Jenkin...
MuleSoft Surat Virtual Meetup#15 - Caching Scope, Caching Strategy and Jenkin...MuleSoft Surat Virtual Meetup#15 - Caching Scope, Caching Strategy and Jenkin...
MuleSoft Surat Virtual Meetup#15 - Caching Scope, Caching Strategy and Jenkin...
 
Agile integration: Decomposing the monolith
Agile integration: Decomposing the monolithAgile integration: Decomposing the monolith
Agile integration: Decomposing the monolith
 
MuleSoft Surat Virtual Meetup#35 - Setting up MuleSoft Runtime and Anypoint C...
MuleSoft Surat Virtual Meetup#35 - Setting up MuleSoft Runtime and Anypoint C...MuleSoft Surat Virtual Meetup#35 - Setting up MuleSoft Runtime and Anypoint C...
MuleSoft Surat Virtual Meetup#35 - Setting up MuleSoft Runtime and Anypoint C...
 
How to build a Oracle cloud adapter SOA, Integration & API's
How to build a Oracle cloud adapter  SOA, Integration & API'sHow to build a Oracle cloud adapter  SOA, Integration & API's
How to build a Oracle cloud adapter SOA, Integration & API's
 
How to build a cloud adapter
How to build a cloud adapterHow to build a cloud adapter
How to build a cloud adapter
 
Apache Mesos Overview and Integration
Apache Mesos Overview and IntegrationApache Mesos Overview and Integration
Apache Mesos Overview and Integration
 
MuleSoft Meetup Adelaide 7th April 2021
MuleSoft Meetup Adelaide 7th April 2021MuleSoft Meetup Adelaide 7th April 2021
MuleSoft Meetup Adelaide 7th April 2021
 
Java Development on Bluemix
Java Development on BluemixJava Development on Bluemix
Java Development on Bluemix
 
OSDC 2018 | Three years running containers with Kubernetes in Production by T...
OSDC 2018 | Three years running containers with Kubernetes in Production by T...OSDC 2018 | Three years running containers with Kubernetes in Production by T...
OSDC 2018 | Three years running containers with Kubernetes in Production by T...
 
Anypoint Tools and MuleSoft Automation (DRAFT).pptx
Anypoint Tools and MuleSoft Automation (DRAFT).pptxAnypoint Tools and MuleSoft Automation (DRAFT).pptx
Anypoint Tools and MuleSoft Automation (DRAFT).pptx
 
MuleSoft Meetup #9 - Anypoint Tools and MuleSoft Automation (FINAL).pptx
MuleSoft Meetup #9 - Anypoint Tools and MuleSoft Automation (FINAL).pptxMuleSoft Meetup #9 - Anypoint Tools and MuleSoft Automation (FINAL).pptx
MuleSoft Meetup #9 - Anypoint Tools and MuleSoft Automation (FINAL).pptx
 
API Microservices with Node.js and Docker
API Microservices with Node.js and DockerAPI Microservices with Node.js and Docker
API Microservices with Node.js and Docker
 
Nyc mule soft_meetup_13_march_2021
Nyc mule soft_meetup_13_march_2021Nyc mule soft_meetup_13_march_2021
Nyc mule soft_meetup_13_march_2021
 
Operator Framework Overview
Operator Framework OverviewOperator Framework Overview
Operator Framework Overview
 
Containerize, PaaS, or Go Serverless!?
Containerize, PaaS, or Go Serverless!?Containerize, PaaS, or Go Serverless!?
Containerize, PaaS, or Go Serverless!?
 
Pivotal Cloud Foundry 2.6: A First Look
Pivotal Cloud Foundry 2.6: A First LookPivotal Cloud Foundry 2.6: A First Look
Pivotal Cloud Foundry 2.6: A First Look
 
Meet Magento Spain 2019 - Our Experience with Magento Cloud
Meet Magento Spain 2019 - Our Experience with Magento CloudMeet Magento Spain 2019 - Our Experience with Magento Cloud
Meet Magento Spain 2019 - Our Experience with Magento Cloud
 
MuleSoft Surat Virtual Meetup#16 - Anypoint Deployment Option, API and Operat...
MuleSoft Surat Virtual Meetup#16 - Anypoint Deployment Option, API and Operat...MuleSoft Surat Virtual Meetup#16 - Anypoint Deployment Option, API and Operat...
MuleSoft Surat Virtual Meetup#16 - Anypoint Deployment Option, API and Operat...
 
198970820 p-oooooooooo
198970820 p-oooooooooo198970820 p-oooooooooo
198970820 p-oooooooooo
 
OSDC 2018 | Highly Available Cloud Foundry on Kubernetes by Cornelius Schumacher
OSDC 2018 | Highly Available Cloud Foundry on Kubernetes by Cornelius SchumacherOSDC 2018 | Highly Available Cloud Foundry on Kubernetes by Cornelius Schumacher
OSDC 2018 | Highly Available Cloud Foundry on Kubernetes by Cornelius Schumacher
 

More from Massimiliano Dessì

When Old Meets New: Turning Maven into a High Scalable, Resource Efficient, C...
When Old Meets New: Turning Maven into a High Scalable, Resource Efficient, C...When Old Meets New: Turning Maven into a High Scalable, Resource Efficient, C...
When Old Meets New: Turning Maven into a High Scalable, Resource Efficient, C...Massimiliano Dessì
 
Microservices in Go_Dessi_Massimiliano_Codemotion_2017_Rome
Microservices in Go_Dessi_Massimiliano_Codemotion_2017_Rome Microservices in Go_Dessi_Massimiliano_Codemotion_2017_Rome
Microservices in Go_Dessi_Massimiliano_Codemotion_2017_Rome Massimiliano Dessì
 
Dessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloudDessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloudMassimiliano Dessì
 
Web Marketing Training 2014 Community Online
Web Marketing Training 2014 Community OnlineWeb Marketing Training 2014 Community Online
Web Marketing Training 2014 Community OnlineMassimiliano Dessì
 
Vert.X like Node.js but polyglot and reactive on JVM
Vert.X like Node.js but polyglot and reactive on JVMVert.X like Node.js but polyglot and reactive on JVM
Vert.X like Node.js but polyglot and reactive on JVMMassimiliano Dessì
 
Reactive applications Linux Day 2013
Reactive applications Linux Day 2013Reactive applications Linux Day 2013
Reactive applications Linux Day 2013Massimiliano Dessì
 
Scala Italy 2013 extended Scalatra vs Spring MVC
Scala Italy 2013 extended Scalatra vs Spring MVCScala Italy 2013 extended Scalatra vs Spring MVC
Scala Italy 2013 extended Scalatra vs Spring MVCMassimiliano Dessì
 
Codemotion 2013 scalatra_play_spray
Codemotion 2013 scalatra_play_sprayCodemotion 2013 scalatra_play_spray
Codemotion 2013 scalatra_play_sprayMassimiliano Dessì
 
Why we cannot ignore functional programming
Why we cannot ignore functional programmingWhy we cannot ignore functional programming
Why we cannot ignore functional programmingMassimiliano Dessì
 
Three languages in thirty minutes
Three languages in thirty minutesThree languages in thirty minutes
Three languages in thirty minutesMassimiliano Dessì
 

More from Massimiliano Dessì (20)

When Old Meets New: Turning Maven into a High Scalable, Resource Efficient, C...
When Old Meets New: Turning Maven into a High Scalable, Resource Efficient, C...When Old Meets New: Turning Maven into a High Scalable, Resource Efficient, C...
When Old Meets New: Turning Maven into a High Scalable, Resource Efficient, C...
 
Hacking Maven Linux day 2017
Hacking Maven Linux day 2017Hacking Maven Linux day 2017
Hacking Maven Linux day 2017
 
Microservices in Go_Dessi_Massimiliano_Codemotion_2017_Rome
Microservices in Go_Dessi_Massimiliano_Codemotion_2017_Rome Microservices in Go_Dessi_Massimiliano_Codemotion_2017_Rome
Microservices in Go_Dessi_Massimiliano_Codemotion_2017_Rome
 
Dessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloudDessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloud
 
Docker dDessi november 2015
Docker dDessi november 2015Docker dDessi november 2015
Docker dDessi november 2015
 
Docker linuxday 2015
Docker linuxday 2015Docker linuxday 2015
Docker linuxday 2015
 
Openshift linuxday 2014
Openshift linuxday 2014Openshift linuxday 2014
Openshift linuxday 2014
 
Web Marketing Training 2014 Community Online
Web Marketing Training 2014 Community OnlineWeb Marketing Training 2014 Community Online
Web Marketing Training 2014 Community Online
 
Vert.X like Node.js but polyglot and reactive on JVM
Vert.X like Node.js but polyglot and reactive on JVMVert.X like Node.js but polyglot and reactive on JVM
Vert.X like Node.js but polyglot and reactive on JVM
 
Reactive applications Linux Day 2013
Reactive applications Linux Day 2013Reactive applications Linux Day 2013
Reactive applications Linux Day 2013
 
Scala Italy 2013 extended Scalatra vs Spring MVC
Scala Italy 2013 extended Scalatra vs Spring MVCScala Italy 2013 extended Scalatra vs Spring MVC
Scala Italy 2013 extended Scalatra vs Spring MVC
 
Codemotion 2013 scalatra_play_spray
Codemotion 2013 scalatra_play_sprayCodemotion 2013 scalatra_play_spray
Codemotion 2013 scalatra_play_spray
 
Why we cannot ignore functional programming
Why we cannot ignore functional programmingWhy we cannot ignore functional programming
Why we cannot ignore functional programming
 
Scala linux day 2012
Scala linux day 2012 Scala linux day 2012
Scala linux day 2012
 
Three languages in thirty minutes
Three languages in thirty minutesThree languages in thirty minutes
Three languages in thirty minutes
 
MongoDB dessi-codemotion
MongoDB dessi-codemotionMongoDB dessi-codemotion
MongoDB dessi-codemotion
 
MongoDB Webtech conference 2010
MongoDB Webtech conference 2010MongoDB Webtech conference 2010
MongoDB Webtech conference 2010
 
RESTEasy
RESTEasyRESTEasy
RESTEasy
 
Spring Roo Internals Javaday IV
Spring Roo Internals Javaday IVSpring Roo Internals Javaday IV
Spring Roo Internals Javaday IV
 
Spring Roo JaxItalia09
Spring Roo JaxItalia09Spring Roo JaxItalia09
Spring Roo JaxItalia09
 

Recently uploaded

Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineeringssuserb3a23b
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 

Recently uploaded (20)

Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineering
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Odoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting ServiceOdoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting Service
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 

Code One 2018 maven

  • 1. Turning Maven into a High scalable, resource efficient, cloud ready microservice Oracle Code One 24 Oct 2018 Alex Porcelli Business Automation Architect Max Dessì Senior Software Engineer
  • 2. Speakers Massimiliano Dessì has more than 18 years of experience in programming. Co-founder of Java User Group Sardegna, Manager of Google Developer Group Sardegna, Author of Spring 2.5 AOP (Packt) He works as a Senior Software Engineer for Red Hat in the BSIG (Business Systems and Intelligence Group) , on KIE projects (Knowledge Is Everything), he lives in Cagliari, Sardinia, Europe. Alex Porcelli is Principal Software Engineer at JBoss by Red Hat, proud member of the architecture group behind the Drools, jBPM and Business Central platform, and co-founder of AppFormer. Professional developer since 1996, has been working exclusively on Open Source projects for almost a decade. Since joined Red Hat he has been focusing on web enabled of the Drools&jBPM platforms redefining all web tooling. Porcelli is also a frequent speaker in tech events like QCon, JavaOne, CodeOne, Red Hat Summit and DevNation.
  • 3. QUICK INTRO TO BUSINESS CENTRAL
  • 4. ● KJAR ○ What is a KJAR ● Maven based packaging model ○ kie-maven-plugin ○ kie-takari-plugin 4 BUSINESS CENTRAL ALL ABOUT BUSINESS PROCESS AND RULES <groupId>com.example</groupId> <artifactId>user-project</artifactId> <packaging>kjar</packaging> <build> <plugins> <plugin> <groupId>org.kie</groupId> <artifactId>kie-maven-plugin</artifactId> <version>7.10.0.Final</version> <extensions>true</extensions> </plugin> </plugins> </build>
  • 5. 5 ● Multiple Personas ● Design ○ Practitioners & Devs ○ Modeling tools ○ Hides Tech details (ie. POM) ○ Git backed storage ○ Editors need access to project classloader for autocomplete ■ A build is needed on every user I/O action BUSINESS CENTRAL ALL ABOUT BUSINESS PROCESS AND RULES
  • 8. The GOOD ● Builds Incrementally ● Multi-thread support ● Uses POM.xml as input ● Just works ○ In production for ~6y 8 CURRENT IN-HOUSE BUILD SYSTEM The BAD ● Stateful ● Hard to scale out ● Hard to work on CI/CD ● Don’t respect Maven semantics ○ Problems from customers (RFE)
  • 11. 11 INCREMENTAL COMPILATION REQUIREMENT Business Central user shouldn’t have to wait for a full compilation if the user has just changed a POJO or a Business Rule. Most of Business Central rich editors provide some level of autocomplete that is based on the project content (Rules, Processes, POJOs, Configs, etc.). On every user I/O action, it needs trigger an incremental build.
  • 12. 12 RESPECT/PRESERVE USER’S POM Business Central users shouldn’t require to change their POM’s if they already work outside Business central. The system should be able to adapt on the fly User’s POM in order to make changed needed that result in a incremental build. REQUIREMENT
  • 13. 13 LOW LATENCY AND MEMORY FOOTPRINT REQUIREMENT Business Central is a web based tool, that has to support multiple concurrent users. Maven is designed as stateless, however its bootstrap is quite heavy (multiple containers have to be initialized, like plexus/sisu/guice).
  • 14. Business Central has different interactions that relies on the build system: Incremental for every user I/O operation, JUnit/Rules/Process execution, Packaging and Deployment. Every use case, requires some configuration/tweak of Maven execution. 14 ADJUSTABLE FOR DIFFERENT USE CASES REQUIREMENT
  • 15. Business Central should enable multiple users interact with projects, including collaboration in the same project. Everyone that had to check a Maven output log of a build with a “-T 2” knows that logs are not isolated per thread. Maven Embedder can’t even execute correctly more than 4 threads at same time (parameter parser get lost). 15 MULTI-THREAD REQUIREMENT
  • 16. Business Central users may work in the same project in a isolated way (forked). Avoid users step on other toes when consuming and producing artifacts (KJARs). 16 MULTI-USER/MULTI-M2REPO REQUIREMENT
  • 17. The build system should be consumed by Business Central “as a Service” and should be developed as a cloud native component. Builds could be executed co-located (within Business Central, suitable for incremental compilation) or executed remotely. It’s expect that on heavy load the build system be auto-scaled by cloud infrastructure. 17 µService/Cloud Native REQUIREMENT
  • 18. Business Central should be able to keep working even if a malicious code is executed by a Business Rule or Process (ie. System.exit). For efficient user interaction incremental compilation should be, as much as possible, be executed in the same JVM. However it’s necessary some isolation of JUnit/Rules/Process execution to avoid shut down the Application Server using System.exit. 18 In & Off-Process REQUIREMENT
  • 19. The kie-maven-plugin and kie-takari-plugin create some in-memory objects that are super heavy to create (basically all metadata information for all rules and process in a pre-compiled way). Original Maven API basically returns only two values: FAIL or SUCCESS. 19 RETURN RICH DATA STRUCTURES REQUIREMENT
  • 20. Compile, Packaging, JUnit Runs… or any Maven execution can take some time (like download the internet!), and we should not block Caller to wait for the completion of those heavy tasks. Useful also for remote execution. 20 ASYNC API REQUIREMENT
  • 21. 21 DETAILED REQUIREMENT LIST The devil is in the details ● Incremental compilation ● Respect/Preserve User’s POM ● Low latency and memory footprint ● Adjustable for Different Use Cases ○ Compilation, JUnit Run, etc ● Multi-thread ● Multi-user ○ Multi M2 repos ● µService/Cloud Native ○ Local and Remote executions ● Embedded & Off-process mode ● Return rich data structures ○ Beyond Fail/Success ○ Collect data from PlugIn’s ● Async API
  • 22. MAVEN AS A SERVICE FEATURES
  • 23. 23 THE SOLUTION Provide an “enhanced compiler” with request-response behavior as simple as possible in its use and configuration and rich in terms of objects in the response compared to “plain” Maven
  • 24. 24 ● Maven repo per request ● Project Path ● Maven CLI arguments ● Settings file ● Unique Compilation ID REQUEST interface CompilationRequest { AFCliRequest getKieCliRequest(); WorkspaceCompilationInfo getInfo(); String getMavenRepo(); String[] getOriginalArgs(); Map<String, Object> getMap(); String getRequestUUID(); Boolean skipAutoSourceUpdate(); Boolean skipProjectDependenciesCreationList(); Boolean getRestoreOverride(); }
  • 25. 25 ● Result of the build ● In Memory Log ● Dependency List ● Target folder content RESPONSE interface CompilationResponse { Boolean isSuccessful(); List<String> getMavenOutput(); Optional<Path> getWorkingDir(); List<String> getDependencies(); List<URI> getDependenciesAsURI(); List<URL> getDependenciesAsURL(); List<String> getTargetContent(); List<URI> getTargetContentAsURI(); List<URL> getTargetContentAsURL(); }
  • 26. 26 ● Drools live objects extracted from the Maven plugin ● Drools live objects generated on the fly (no .class file) ● Classloaders contents KIE RESPONSE EXTENSION interface KieCompilationResponse extends CompilationResponse { Optional<KieModuleMetaInfo> getKieModuleMetaInfo(); Optional<KieModule> getKieModule(); Map<String, byte[]> getProjectClassLoaderStore(); Set<String> getEventTypeClasses(); }
  • 27. We add objects to the Maven result (a simple int) and we use a pipeline of decorators to add behaviours before and after compilation 27 COMPILER interface AFCompiler<T extends CompilationResponse> { T compile(final CompilationRequest req); T compile(final CompilationRequest req, final Map<Path, InputStream> override); Boolean cleanInternalCache(); }
  • 28. PIPELINE: CHAIN OF DECORATORS ● Static factory for common use cases ● Configurable per object ● Possible to provide your own decorator 28
  • 29. MAVEN API VERY RESTRICT The first problem is how to open the “sealed” Maven API, we change the use of Plexus/Sisu we can reuse the same IoC container per project saving a huge amount of time, because the major part of the time in a Maven startup is the creation of this container 29
  • 30. CLASSLOADERS 30 Maven use classworlds to manage the various classloaders used for its tasks ● System Classloader ● Core Classloader ● Plugin Classloaders ● Custom Classloaders https://maven.apache.org/guides/mini/guide-maven-classloading.html
  • 31. CLASSLOADERS 31 If we want read an object inside the plugin and export it to the client code we have to cross the barriers of those classloaders. ● ReusableAFMavenCli ● BuildMojo ● BaseMavenCompiler
  • 32. IN MEMORY PLUGINS 32 A cool side effects when you cross the barriers of the classloaders is the option to turn the plugins impl from FS to in memory.
  • 33. INCREMENTAL COMPILER 33 To spent less time in front of a Maven build we change on the fly the pom to add the Takari compiler in every module of the project tied with the compiler
  • 34. POM PROCESSOR 34 The Compiler is aware of the plugins in the POM It changes on the fly the Pom turning off the Default Compiler and adds Takari and the Kie Plugin
  • 35. ASYNC API 35 interface AFCompilerService { CompletableFuture<KieCompilationResponse> build(Path projectPath, String mavenRepo); CompletableFuture<KieCompilationResponse> build(Path projectPath, String mavenRepo, Map<Path, InputStream> override); CompletableFuture<KieCompilationResponse> build(Path projectPath, String mavenRepo, Boolean skipPrjDependenciesCreationList); CompletableFuture<KieCompilationResponse> buildAndInstall(Path projectPath, String mavenRepo); CompletableFuture<KieCompilationResponse> buildAndInstall(Path projectPath, String mavenRepo, Boolean skipPrjDependenciesCreationList); CompletableFuture<KieCompilationResponse> buildSpecialized(Path projectPath, String mavenRepo, String[] args); CompletableFuture<KieCompilationResponse> buildSpecialized(Path projectPath, String mavenRepo, String[] args, Boolean skipPrjDependenciesCreationList); }
  • 36. COMPILER SERVICE 36 We could use the compiler core to enable a compiler service enabling local Maven executors or remote Maven executors on other nodes/pods/containers/VMs
  • 37. COMPILER SERVICE 37 We could demand a build to a remote node/pod/container/vm and reads a remote File System because the core compiler can use use a JGITCompilerBeforeDecorator
  • 38. LOCAL/REMOTE EXECUTORS 38 The compiler service need to know if the current “machine” owns enough resources to run a local executors or if is better to ask to a remote executor to satisfy the build. To invoke a remote executors It needs to know the address to reach the chosen instance.
  • 39. REST ENDPOINT 39 @Path("/build/maven/") @RequestScoped public class MavenRestHandler extends Application { @POST @Produces(MediaType.APPLICATION_OCTET_STREAM) public void postAsync(@Suspended AsyncResponse ar, @HeaderParam("project") String projectRepo, @HeaderParam("mavenrepo") String mavenRepo) throws Exception { CompletableFuture<KieCompilationResponse> response = compilerService.build(projectRepo, mavenRepo); response.whenCompleteAsync((kieCompilationResponse, throwable) -> { if (throwable != null) { logger.error(throwable.getMessage()); ar.resume(Response.serverError().build()); } else { byte[] bytes = RestUtils.serialize(new DefaultHttpCompilationResponse(kieCompilationResponse)); ar.resume(Response.ok(bytes).build()); } }); } }