SlideShare une entreprise Scribd logo
1  sur  38
Dropwizard 
-微服務架構框架- 
anthonychen
Once Upon a Time 
Hibernate 
Tomcat 
Spring 
JPA 
Spring 
MVC 
Jackson 
Freemarker 
or 
Thymeleaf 
Logback
Dropwizard 
Full Stack Framework 
with microservice architecture
Drop...wizard?
Jackson 
mustache 
JDBI 
Full Stack, RESTful and Open Source
Dropwizard Modules (v0.7.1) 
dropwizard-assets dropwizard-jackson dropwizard-migrations 
dropwizard-auth dropwizard-jdbi dropwizard-servlets 
dropwizard-client dropwizard-jersey dropwizard-spdy 
dropwizard-configuration dropwizard-jetty dropwizard-testing 
dropwizard-core dropwizard-lifecycle dropwizard-util 
dropwizard-db dropwizard-logging dropwizard-validation 
dropwizard-example dropwizard-metrics-ganglial dropwizard-views-freemarker 
dropwizard-forms dropwizard-metrics-graphite dropwizard-views-mustache 
dropwizard-hibernate dropwizard-metrics dropwizard-views
Microservice 
Architecture 
The microservice architectural 
style is an approach to 
developing a single application as 
a suite of small services, each 
running in its own process and 
communicating with lightweight 
mechanisms, often an HTTP 
resource API. These services are 
built around business capabilities 
and independently deployable by 
fully automated deployment 
machinery. 
- Martin Fowler
Monolithic Micro Services 
pid 1234 8GB heap 
pid 5678 
2GB heap 
pid 5978 
2GB heap 
pid 1234 
2GB heap 
pid 9527 
2GB heap
Scalability
Project Management
P 
R 
O 
X 
Y 
Extensibility
Phlyty 
a microframework using ZF2 components. 
SleepyA RESTful framework for Go 
Microservice Frameworks
Why 
DropWizard?
http://www.oracle.com/us/technologies/java/gimmejava/usage-terms/index.html
Dropwizard - Pros 
Productivity – Do one thing at a time 
Do your best with what you have 
Simple & Lightweight 
Easy Test, Deployment and Management 
Performance
Dropwizard - Pros 
Productivity – Do one thing at a time 
Do your best with what you have 
Simple & Lightweight 
Easy Test, Deployment and Management 
Performance
http://www.techempower.com/benchmarks/#section=data-r9&hw=i7&test=json&f=311c-1hq8-0-0
http://www.techempower.com/benchmarks/#section=data-r9&hw=i7&test=db&f=311c-1hq8-0-0
http://www.techempower.com/benchmarks/#section=data-r9&hw=i7&test=query&f=311c-1hq8-0-0
Dropwizard - Cons 
Frequently and Large-Scale Changes 
Nano-Service Architecture 
Complexity at Infrastructure Level 
No Application Server 
Put More Effort on Monitoring and
How to Start 
DropWizard?
Overview 
Resource 
Application Bundle 
Configuration 
Representation 
Environment 
Views
Project Orginization 
com.example.myapplication: 
 api: Representations. 
 cli: Commands 
 client: Client implementation for your application 
 core: Domain implementation 
 jdbi: Database access classes 
 health: Health Checks 
 resources: Resources 
 MyApplication: The application class 
 MyApplicationConfiguration: configuration class
Configuration Class 
public class BlogConfiguration extends Configuration { 
@Valid 
@NotNull 
@JsonProperty("database") 
private DataSourceFactory database = new DataSourceFactory(); 
public DataSourceFactory getDatabase() { 
return database; 
}}
Configuration File 
(YAML) 
server: 
type: simple 
applicationContextPath: /application 
adminContextPath: /admin 
database: 
driverClass: com.mysql.jdbc.Driver 
user: anthonychen 
password: anthonychen 
url: jdbc:mysql://localhost:3306/blog 
validationQuery: "/* MyApplication Health Check */ SELECT 1"
Representation Class 
public class Notification { 
private String text; 
public Notification(String text) { 
this.text = text; 
} 
@JsonProperty 
public String getText() { 
return text; 
} 
@JsonProperty 
public void setText(String text) { 
this.text = text; 
}}
Application Class - Bundle 
public class BlogApplication extends Application<BlogConfiguration> { 
public static void main(String[] args) throws Exception { 
new BlogApplication().run(args); 
} 
@Override 
public void initialize(Bootstrap<BlogConfiguration> bootstrap) { 
bootstrap.addBundle(hibernateBundle); 
bootstrap.addBundle(new ViewBundle()); 
bootstrap.addBundle(new AssetsBundle("/assets/js", "/js", null, "js")); 
}}
Application Class – Environment 
@Override 
public void run(BlogConfiguration configuration, Environment environment) throws Exception { 
// Crete DAOs 
final ArticleDAO articleDAO = new ArticleDAO(hibernateBundle.getSessionFactory()); 
final UserDAO userDAO = new UserDAO(hibernateBundle.getSessionFactory()); 
// Create healthchecks 
final SessionFactoryHealthCheck dbHealthCheck = new SessionFactoryHealthCheck( 
hibernateBundle.getSessionFactory(), configuration.getDatabase().getValidationQuery() 
); 
// Register resources, filters and healthchecks 
environment.jersey().register(new BlogResource(configuration.getSiteName(), articleDAO)); 
environment.jersey().register(new ArticleResource(articleDAO, userDAO)); 
environment.healthChecks().register("databaseHealthcheck", dbHealthCheck); 
}}
View Layer 
Freemarker - http://freemarker.org 
Mustache - http://mustache.github.io
Health Check 
public class DatabaseHealthCheck extends HealthCheck { 
private final Database database; 
public DatabaseHealthCheck(Database database) { 
this.database = database; 
} 
@Override 
protected Result check() throws Exception { 
if (database.isConnected()) { 
return Result.healthy(); 
} else { 
return Result.unhealthy("Cannot connect to " + database.getUrl()); 
} 
} 
}
Demo- 
A Sample Blog
Build - A Fat JAR 
An easy maintainable, single deployable 
artifact 
maven-shade or maven-assembly-plugin
Run 
Command line: 
java -jar blog-sample-0.0.1-SNAPSHOT.jar server blog.yml 
exec-maven-plugin
More 
DropWizard?
Metric
AngularJS & 
DropWizard
Spring & 
DropWizard

Contenu connexe

Tendances

Using React with Grails 3
Using React with Grails 3Using React with Grails 3
Using React with Grails 3Zachary Klein
 
Micronaut For Single Page Apps
Micronaut For Single Page AppsMicronaut For Single Page Apps
Micronaut For Single Page AppsZachary Klein
 
The Past Year in Spring for Apache Geode
The Past Year in Spring for Apache GeodeThe Past Year in Spring for Apache Geode
The Past Year in Spring for Apache GeodeVMware Tanzu
 
Maven and j unit introduction
Maven and j unit introductionMaven and j unit introduction
Maven and j unit introductionSergii Fesenko
 
Spring5 New Features
Spring5 New FeaturesSpring5 New Features
Spring5 New FeaturesJay Lee
 
W-JAX 2011: OSGi with Apache Karaf
W-JAX 2011: OSGi with Apache KarafW-JAX 2011: OSGi with Apache Karaf
W-JAX 2011: OSGi with Apache KarafJerry Preissler
 
The Making of the Oracle R2DBC Driver and How to Take Your Code from Synchron...
The Making of the Oracle R2DBC Driver and How to Take Your Code from Synchron...The Making of the Oracle R2DBC Driver and How to Take Your Code from Synchron...
The Making of the Oracle R2DBC Driver and How to Take Your Code from Synchron...VMware Tanzu
 
Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017Matthew Groves
 
Anatomy of a Modern Node.js Application Architecture
Anatomy of a Modern Node.js Application Architecture Anatomy of a Modern Node.js Application Architecture
Anatomy of a Modern Node.js Application Architecture AppDynamics
 
Managing user's data with Spring Session
Managing user's data with Spring SessionManaging user's data with Spring Session
Managing user's data with Spring SessionDavid Gómez García
 
My "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails ProjectsMy "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails ProjectsGR8Conf
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring BootTrey Howard
 
vJUG - The JavaFX Ecosystem
vJUG - The JavaFX EcosystemvJUG - The JavaFX Ecosystem
vJUG - The JavaFX EcosystemAndres Almiray
 
Building Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And TricksBuilding Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And TricksMike Hugo
 
Spring Boot Revisited with KoFu and JaFu
Spring Boot Revisited with KoFu and JaFuSpring Boot Revisited with KoFu and JaFu
Spring Boot Revisited with KoFu and JaFuVMware Tanzu
 
Service oriented web development with OSGi
Service oriented web development with OSGiService oriented web development with OSGi
Service oriented web development with OSGiCarsten Ziegeler
 

Tendances (20)

Using React with Grails 3
Using React with Grails 3Using React with Grails 3
Using React with Grails 3
 
Micronaut For Single Page Apps
Micronaut For Single Page AppsMicronaut For Single Page Apps
Micronaut For Single Page Apps
 
Serverless Java on Kubernetes
Serverless Java on KubernetesServerless Java on Kubernetes
Serverless Java on Kubernetes
 
The Past Year in Spring for Apache Geode
The Past Year in Spring for Apache GeodeThe Past Year in Spring for Apache Geode
The Past Year in Spring for Apache Geode
 
Maven and j unit introduction
Maven and j unit introductionMaven and j unit introduction
Maven and j unit introduction
 
Spring5 New Features
Spring5 New FeaturesSpring5 New Features
Spring5 New Features
 
W-JAX 2011: OSGi with Apache Karaf
W-JAX 2011: OSGi with Apache KarafW-JAX 2011: OSGi with Apache Karaf
W-JAX 2011: OSGi with Apache Karaf
 
The Making of the Oracle R2DBC Driver and How to Take Your Code from Synchron...
The Making of the Oracle R2DBC Driver and How to Take Your Code from Synchron...The Making of the Oracle R2DBC Driver and How to Take Your Code from Synchron...
The Making of the Oracle R2DBC Driver and How to Take Your Code from Synchron...
 
Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Anatomy of a Modern Node.js Application Architecture
Anatomy of a Modern Node.js Application Architecture Anatomy of a Modern Node.js Application Architecture
Anatomy of a Modern Node.js Application Architecture
 
Managing user's data with Spring Session
Managing user's data with Spring SessionManaging user's data with Spring Session
Managing user's data with Spring Session
 
My "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails ProjectsMy "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails Projects
 
Springを用いた社内ライブラリ開発
Springを用いた社内ライブラリ開発Springを用いた社内ライブラリ開発
Springを用いた社内ライブラリ開発
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
 
Angular beans
Angular beansAngular beans
Angular beans
 
vJUG - The JavaFX Ecosystem
vJUG - The JavaFX EcosystemvJUG - The JavaFX Ecosystem
vJUG - The JavaFX Ecosystem
 
Building Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And TricksBuilding Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And Tricks
 
Spring Boot Revisited with KoFu and JaFu
Spring Boot Revisited with KoFu and JaFuSpring Boot Revisited with KoFu and JaFu
Spring Boot Revisited with KoFu and JaFu
 
Service oriented web development with OSGi
Service oriented web development with OSGiService oriented web development with OSGi
Service oriented web development with OSGi
 

Similaire à Dropwizard Introduction

JavaFX Enterprise (JavaOne 2014)
JavaFX Enterprise (JavaOne 2014)JavaFX Enterprise (JavaOne 2014)
JavaFX Enterprise (JavaOne 2014)Hendrik Ebbers
 
From Web App Model Design to Production with Wakanda
From Web App Model Design to Production with WakandaFrom Web App Model Design to Production with Wakanda
From Web App Model Design to Production with WakandaAlexandre Morgaut
 
Cloud Application Blueprints with Apache Brooklyn by Alex Henevald
Cloud Application Blueprints with Apache Brooklyn by Alex HenevaldCloud Application Blueprints with Apache Brooklyn by Alex Henevald
Cloud Application Blueprints with Apache Brooklyn by Alex Henevaldbuildacloud
 
Modular Test-driven SPAs with Spring and AngularJS
Modular Test-driven SPAs with Spring and AngularJSModular Test-driven SPAs with Spring and AngularJS
Modular Test-driven SPAs with Spring and AngularJSGunnar Hillert
 
Maxim Salnikov - Service Worker: taking the best from the past experience for...
Maxim Salnikov - Service Worker: taking the best from the past experience for...Maxim Salnikov - Service Worker: taking the best from the past experience for...
Maxim Salnikov - Service Worker: taking the best from the past experience for...Codemotion
 
using Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'susing Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'sAntônio Roberto Silva
 
Camel on Cloud by Christina Lin
Camel on Cloud by Christina LinCamel on Cloud by Christina Lin
Camel on Cloud by Christina LinTadayoshi Sato
 
Patterns Are Good For Managers
Patterns Are Good For ManagersPatterns Are Good For Managers
Patterns Are Good For ManagersAgileThought
 
Rapid Application Development with WSO2 Platform
Rapid Application Development with WSO2 PlatformRapid Application Development with WSO2 Platform
Rapid Application Development with WSO2 PlatformWSO2
 
Vaadin 7 CN
Vaadin 7 CNVaadin 7 CN
Vaadin 7 CNjojule
 
Reactive Relational Database Connectivity
Reactive Relational Database ConnectivityReactive Relational Database Connectivity
Reactive Relational Database ConnectivityVMware Tanzu
 
Spring Performance Gains
Spring Performance GainsSpring Performance Gains
Spring Performance GainsVMware Tanzu
 
점진적인 레거시 웹 애플리케이션 개선 과정
점진적인 레거시 웹 애플리케이션 개선 과정점진적인 레거시 웹 애플리케이션 개선 과정
점진적인 레거시 웹 애플리케이션 개선 과정Arawn Park
 
Meetup 2022 - APIs with Quarkus.pdf
Meetup 2022 - APIs with Quarkus.pdfMeetup 2022 - APIs with Quarkus.pdf
Meetup 2022 - APIs with Quarkus.pdfRed Hat
 
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitJava Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitIMC Institute
 
Workshop: Building Vaadin add-ons
Workshop: Building Vaadin add-onsWorkshop: Building Vaadin add-ons
Workshop: Building Vaadin add-onsSami Ekblad
 
Openshift operator insight
Openshift operator insightOpenshift operator insight
Openshift operator insightRyan ZhangCheng
 

Similaire à Dropwizard Introduction (20)

JavaFX Enterprise (JavaOne 2014)
JavaFX Enterprise (JavaOne 2014)JavaFX Enterprise (JavaOne 2014)
JavaFX Enterprise (JavaOne 2014)
 
From Web App Model Design to Production with Wakanda
From Web App Model Design to Production with WakandaFrom Web App Model Design to Production with Wakanda
From Web App Model Design to Production with Wakanda
 
Cloud Application Blueprints with Apache Brooklyn by Alex Henevald
Cloud Application Blueprints with Apache Brooklyn by Alex HenevaldCloud Application Blueprints with Apache Brooklyn by Alex Henevald
Cloud Application Blueprints with Apache Brooklyn by Alex Henevald
 
Modular Test-driven SPAs with Spring and AngularJS
Modular Test-driven SPAs with Spring and AngularJSModular Test-driven SPAs with Spring and AngularJS
Modular Test-driven SPAs with Spring and AngularJS
 
Maxim Salnikov - Service Worker: taking the best from the past experience for...
Maxim Salnikov - Service Worker: taking the best from the past experience for...Maxim Salnikov - Service Worker: taking the best from the past experience for...
Maxim Salnikov - Service Worker: taking the best from the past experience for...
 
using Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'susing Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API's
 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
 
Camel on Cloud by Christina Lin
Camel on Cloud by Christina LinCamel on Cloud by Christina Lin
Camel on Cloud by Christina Lin
 
Patterns Are Good For Managers
Patterns Are Good For ManagersPatterns Are Good For Managers
Patterns Are Good For Managers
 
Rapid Application Development with WSO2 Platform
Rapid Application Development with WSO2 PlatformRapid Application Development with WSO2 Platform
Rapid Application Development with WSO2 Platform
 
Vaadin 7 CN
Vaadin 7 CNVaadin 7 CN
Vaadin 7 CN
 
Reactive Relational Database Connectivity
Reactive Relational Database ConnectivityReactive Relational Database Connectivity
Reactive Relational Database Connectivity
 
Spring Performance Gains
Spring Performance GainsSpring Performance Gains
Spring Performance Gains
 
점진적인 레거시 웹 애플리케이션 개선 과정
점진적인 레거시 웹 애플리케이션 개선 과정점진적인 레거시 웹 애플리케이션 개선 과정
점진적인 레거시 웹 애플리케이션 개선 과정
 
Meetup 2022 - APIs with Quarkus.pdf
Meetup 2022 - APIs with Quarkus.pdfMeetup 2022 - APIs with Quarkus.pdf
Meetup 2022 - APIs with Quarkus.pdf
 
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitJava Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
 
Workshop: Building Vaadin add-ons
Workshop: Building Vaadin add-onsWorkshop: Building Vaadin add-ons
Workshop: Building Vaadin add-ons
 
Google app engine by example
Google app engine by exampleGoogle app engine by example
Google app engine by example
 
Openshift operator insight
Openshift operator insightOpenshift operator insight
Openshift operator insight
 
Arquitecturas de microservicios - Medianet Software
Arquitecturas de microservicios   -  Medianet SoftwareArquitecturas de microservicios   -  Medianet Software
Arquitecturas de microservicios - Medianet Software
 

Dernier

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 

Dernier (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

Dropwizard Introduction

  • 2. Once Upon a Time Hibernate Tomcat Spring JPA Spring MVC Jackson Freemarker or Thymeleaf Logback
  • 3. Dropwizard Full Stack Framework with microservice architecture
  • 5.
  • 6. Jackson mustache JDBI Full Stack, RESTful and Open Source
  • 7. Dropwizard Modules (v0.7.1) dropwizard-assets dropwizard-jackson dropwizard-migrations dropwizard-auth dropwizard-jdbi dropwizard-servlets dropwizard-client dropwizard-jersey dropwizard-spdy dropwizard-configuration dropwizard-jetty dropwizard-testing dropwizard-core dropwizard-lifecycle dropwizard-util dropwizard-db dropwizard-logging dropwizard-validation dropwizard-example dropwizard-metrics-ganglial dropwizard-views-freemarker dropwizard-forms dropwizard-metrics-graphite dropwizard-views-mustache dropwizard-hibernate dropwizard-metrics dropwizard-views
  • 8. Microservice Architecture The microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery. - Martin Fowler
  • 9. Monolithic Micro Services pid 1234 8GB heap pid 5678 2GB heap pid 5978 2GB heap pid 1234 2GB heap pid 9527 2GB heap
  • 12. P R O X Y Extensibility
  • 13. Phlyty a microframework using ZF2 components. SleepyA RESTful framework for Go Microservice Frameworks
  • 16. Dropwizard - Pros Productivity – Do one thing at a time Do your best with what you have Simple & Lightweight Easy Test, Deployment and Management Performance
  • 17. Dropwizard - Pros Productivity – Do one thing at a time Do your best with what you have Simple & Lightweight Easy Test, Deployment and Management Performance
  • 21. Dropwizard - Cons Frequently and Large-Scale Changes Nano-Service Architecture Complexity at Infrastructure Level No Application Server Put More Effort on Monitoring and
  • 22. How to Start DropWizard?
  • 23. Overview Resource Application Bundle Configuration Representation Environment Views
  • 24. Project Orginization com.example.myapplication:  api: Representations.  cli: Commands  client: Client implementation for your application  core: Domain implementation  jdbi: Database access classes  health: Health Checks  resources: Resources  MyApplication: The application class  MyApplicationConfiguration: configuration class
  • 25. Configuration Class public class BlogConfiguration extends Configuration { @Valid @NotNull @JsonProperty("database") private DataSourceFactory database = new DataSourceFactory(); public DataSourceFactory getDatabase() { return database; }}
  • 26. Configuration File (YAML) server: type: simple applicationContextPath: /application adminContextPath: /admin database: driverClass: com.mysql.jdbc.Driver user: anthonychen password: anthonychen url: jdbc:mysql://localhost:3306/blog validationQuery: "/* MyApplication Health Check */ SELECT 1"
  • 27. Representation Class public class Notification { private String text; public Notification(String text) { this.text = text; } @JsonProperty public String getText() { return text; } @JsonProperty public void setText(String text) { this.text = text; }}
  • 28. Application Class - Bundle public class BlogApplication extends Application<BlogConfiguration> { public static void main(String[] args) throws Exception { new BlogApplication().run(args); } @Override public void initialize(Bootstrap<BlogConfiguration> bootstrap) { bootstrap.addBundle(hibernateBundle); bootstrap.addBundle(new ViewBundle()); bootstrap.addBundle(new AssetsBundle("/assets/js", "/js", null, "js")); }}
  • 29. Application Class – Environment @Override public void run(BlogConfiguration configuration, Environment environment) throws Exception { // Crete DAOs final ArticleDAO articleDAO = new ArticleDAO(hibernateBundle.getSessionFactory()); final UserDAO userDAO = new UserDAO(hibernateBundle.getSessionFactory()); // Create healthchecks final SessionFactoryHealthCheck dbHealthCheck = new SessionFactoryHealthCheck( hibernateBundle.getSessionFactory(), configuration.getDatabase().getValidationQuery() ); // Register resources, filters and healthchecks environment.jersey().register(new BlogResource(configuration.getSiteName(), articleDAO)); environment.jersey().register(new ArticleResource(articleDAO, userDAO)); environment.healthChecks().register("databaseHealthcheck", dbHealthCheck); }}
  • 30. View Layer Freemarker - http://freemarker.org Mustache - http://mustache.github.io
  • 31. Health Check public class DatabaseHealthCheck extends HealthCheck { private final Database database; public DatabaseHealthCheck(Database database) { this.database = database; } @Override protected Result check() throws Exception { if (database.isConnected()) { return Result.healthy(); } else { return Result.unhealthy("Cannot connect to " + database.getUrl()); } } }
  • 33. Build - A Fat JAR An easy maintainable, single deployable artifact maven-shade or maven-assembly-plugin
  • 34. Run Command line: java -jar blog-sample-0.0.1-SNAPSHOT.jar server blog.yml exec-maven-plugin

Notes de l'éditeur

  1. 單一應用程式可以拆解為數個小型服務,以符合各自的需求,也容易了解、修改與維護 與舊系統整合,老酒裝新瓶,無須大幅翻新 可以針對負擔較重的服務特別擴充其資源 可以只佈署個別服務,而不用每次均佈署整個應用程式 每個服務無須使用相同的程式語言 --> 殺雞焉用牛刀 每個服務都可以有自己的小開發團隊  強迫程式設計師面對佈署與了解服務整合需求 收斂程式語言與框架的多樣性
  2. 單一應用程式可以拆解為數個小型服務,以符合各自的需求,也容易了解、修改與維護 與舊系統整合,老酒裝新瓶,無須大幅翻新 可以針對負擔較重的服務特別擴充其資源 可以只佈署個別服務,而不用每次均佈署整個應用程式 每個服務無須使用相同的程式語言 --> 殺雞焉用牛刀 每個服務都可以有自己的小開發團隊  強迫程式設計師面對佈署與了解服務整合需求 收斂程式語言與框架的多樣性
  3. 避免變成奈米服務架構 nano-service architecture 服務間變得更鬆散,依賴性降低,程式庫的版本會更難管裡 (如果要管理的話) 程式語言平台環境可能變得很複雜
  4. 避免變成奈米服務架構 nano-service architecture 服務間變得更鬆散,依賴性降低,程式庫的版本會更難管裡 (如果要管理的話) 程式語言平台環境可能變得很複雜