SlideShare a Scribd company logo
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

More Related Content

What's hot

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 Apps
Zachary Klein
 
Serverless Java on Kubernetes
Serverless Java on KubernetesServerless Java on Kubernetes
Serverless Java on Kubernetes
Krzysztof Sobkowiak
 
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
VMware Tanzu
 
Maven and j unit introduction
Maven and j unit introductionMaven and j unit introduction
Maven and j unit introduction
Sergii Fesenko
 
Spring5 New Features
Spring5 New FeaturesSpring5 New Features
Spring5 New Features
Jay 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 Karaf
Jerry 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 2017
Matthew Groves
 
Spring Boot
Spring BootSpring Boot
Spring Boot
Jiayun Zhou
 
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 Session
David 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 Projects
GR8Conf
 
Springを用いた社内ライブラリ開発
Springを用いた社内ライブラリ開発Springを用いた社内ライブラリ開発
Springを用いた社内ライブラリ開発
Recruit Lifestyle Co., Ltd.
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
Trey Howard
 
Angular beans
Angular beansAngular beans
Angular beans
Bessem Hmidi
 
vJUG - The JavaFX Ecosystem
vJUG - The JavaFX EcosystemvJUG - The JavaFX Ecosystem
vJUG - The JavaFX Ecosystem
Andres 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 JaFu
VMware Tanzu
 
Service oriented web development with OSGi
Service oriented web development with OSGiService oriented web development with OSGi
Service oriented web development with OSGi
Carsten Ziegeler
 

What's hot (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
 

Similar to 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 Wakanda
Alexandre 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 Henevald
buildacloud
 
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
Gunnar 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's
Antônio Roberto Silva
 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
Software Park Thailand
 
Camel on Cloud by Christina Lin
Camel on Cloud by Christina LinCamel on Cloud by Christina Lin
Camel on Cloud by Christina Lin
Tadayoshi Sato
 
Patterns Are Good For Managers
Patterns Are Good For ManagersPatterns Are Good For Managers
Patterns Are Good For Managers
AgileThought
 
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 CN
jojule
 
Reactive Relational Database Connectivity
Reactive Relational Database ConnectivityReactive Relational Database Connectivity
Reactive Relational Database Connectivity
VMware Tanzu
 
Spring Performance Gains
Spring Performance GainsSpring Performance Gains
Spring Performance Gains
VMware 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.pdf
Red 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 Toolkit
IMC Institute
 
Workshop: Building Vaadin add-ons
Workshop: Building Vaadin add-onsWorkshop: Building Vaadin add-ons
Workshop: Building Vaadin add-ons
Sami Ekblad
 
Google app engine by example
Google app engine by exampleGoogle app engine by example
Google app engine by example
Alexander Zamkovyi
 
Openshift operator insight
Openshift operator insightOpenshift operator insight
Openshift operator insight
Ryan ZhangCheng
 
Arquitecturas de microservicios - Medianet Software
Arquitecturas de microservicios   -  Medianet SoftwareArquitecturas de microservicios   -  Medianet Software
Arquitecturas de microservicios - Medianet Software
Ernesto Hernández Rodríguez
 

Similar to 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
 

Recently uploaded

DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 

Recently uploaded (20)

DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 

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

Editor's Notes

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