RESTful Microservices In Java With Jersey Jakub Podlešák Software Engineer Oracle, Application Server Group September 29, 2014 Copyright © 2014, Oracle.

Slides:



Advertisements
Similar presentations
Enhancing Productivity with MySQL 5.6 New Features
Advertisements

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 1.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 of the corporate.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Your customer as a segment of one That changes every second! Hein Van Der Merwe Chief.
MVC in JavaEE 8 Manfred Riem Principal Member of Technical Staff September, 2014 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Internet of Things Security Architecture
Jim Ferrentino Elizabeth West
Virtualization of Fixed Network Functions on the Oracle Fabric Krishna Srinivasan Director, Product Management Oracle Networking Savi Venkatachalapathy.
A Java Architecture for the Internet of Things Noel Poore, Architect Pete St. Pierre, Product Manager Java Platform Group, Internet of Things September.
Oracle Cloud Marketplace Neelesh Gurnani Director, Product Development Arif Khan Director, Product Management September 29, 2014 Copyright © 2014, Oracle.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Oracle SQL Developer What’s New in Version 4.1 Jeff Smith
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Safe Harbor Statement The following is intended to outline our general product direction.
CON Software-Defined Networking in a Hybrid, Open Data Center Krishna Srinivasan Senior Principal Product Strategy Manager Oracle Virtual Networking.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 2 Hidden Gems of APEX David Gale Software Engineer Oracle Application Express November,
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Oracle SQL Developer For the DBA Jeff Smith
The Safe Harbor The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated.
HOL9396: Oracle Event Processing 12c
Best Practices for Upgrading Oracle PeopleSoft Environments
Oracle Database 12c Data Protection and Multitenancy on Oracle Solaris 11 Xiaosong Zhu Senior Software Engineer Copyright © 2014, Oracle and/or its affiliates.
American Airlines AAdvantage®:
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. JD Edwards Summit The Newest JDE Module – Rental Management Joel Sandberg Sales Consultant.
QAD .Net UI: New Enhancements
Getting Started with Oracle Compute Cloud
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. JD Edwards Summit PaaS from an Applications Perspective Charles McGuinness Director,
Oracle Confidential – Internal/Restricted/Highly RestrictedCopyright © 2014, Oracle and/or its affiliates. All rights reserved. | Oracle Identity Management.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 1.
1Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8 Reporting from Contract.
A New IMS-Like Architecture for Enterprise Applications Reid Stidolph Master Principle Solutions Architect Communications Global Business Unit October.
What Is New and Noteworthy in Jersey Miroslav Fuksa, Jakub Podlešák Software Developers Oracle, Application Server Group October 1, 2014 Copyright ©
RMB Billing UX Design Concepts / Proposals Peter Picone.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Improving Agility in Product Development and Pricing to Gain a Competitive Edge.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. An Auto-Join Network of Things Wong, H. and Wesson, B. Oracle Confidential – Internal/Restricted/Highly.
Hadoop 2 cluster with Oracle Solaris Zones, ZFS and unified archives Orgad Kimchi - Principal Software Engineer September 29, 2014 Oracle Confidential.
1Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8 Contract Management.
Learning Oracle ADF Grant Ronald Director of Product Management Mobility and Development Tools September, 2014 Copyright © 2014, Oracle and/or its affiliates.
| Building the Effective Enterprise The Power of.Net Upgrade Jeffrey Steele – Solution Consultant, QAD.
CON Software-Defined Networking in a Hybrid, Open Data Center Krishna Srinivasan Senior Principal Product Strategy Manager Oracle Virtual Networking.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. JD Edwards Summit Really Cool Demo Stuff – 2015 Edition!!!!! For demo content, please.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Using Edition-based redefinition with PL/SQL How to deploy database code changes.
1Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. Community Insight for Marketing Technology Procurement Russell Rothstein, IT Central.
Workforce Scheduling Release 5.0 for Windows Implementation Overview OWS Development Team.
Build Mobile Apps for Oracle E-Business Suite with Oracle Mobile Platform Bruce Bailey Principal Mobile/Social Solutions Consultant Jagadeesh Maira Senior.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Planning & Budgeting Cloud Service (PBCS) Overview Business Analytics Product Group.
WebCenter in Education & Research A Transformation in Digital Business Session: CON7709 Golden Gate C3 Room, Marriott Marquis Moderator: Kevin Roebuck,
Industry specific cover image Girish Jashnani What’s new in R12 – A technology perspective Jan 17 th 2007.
Performance/Scalability with JDBC, UCP & Oracle Database 12c
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. JD Edwards Summit Recruit and Learn Solutions Extend HR into the Cloud Marie Scott.
Travel and Transportation General Session and Industry Excellence Awards Vijay Anand, Oracle Sundar Swaminathan, Oracle September 30, 2014 Copyright ©
Oracle Business Intelligence Event 22 nd February 2012 Saxon Hotel, Johannesburg Business Intelligence Strategy Recommendations for Customers Using Oracle.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 1.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 5 Lifehacks for the Apex Development environment Five frameworks you should use.
CON8473 – Oracle Distribution of OpenStack Ronen Kofman Director of Product Management Oracle OpenStack September, 2014 Copyright © 2014, Oracle and/or.
Oracle Java Cloud Service Oracle Develop July 2013.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Daddy, what's a middle wear? An incredibly oversimplified explanation of what Middleware.
Self-Contained Systems
Build a Web App with Oracle REST Data Services &
Blazingly Fast Machine Learning Inference
Project Helidon Introduction
OpenWorld 2018 How to Combine Data from Source Sites
Confidential – Oracle Internal/Restricted/Highly Restricted
QAD Reporting Framework
Project Helidon Deep Dive
The following is intended to outline our general product direction
Confidential – Oracle Internal/Restricted/Highly Restricted
Principal Product Manager Oracle Data Science Platform
1.
Oracle Java SE Subscriptions; Protect Your Investment in Java SE
Presentation transcript:

RESTful Microservices In Java With Jersey Jakub Podlešák Software Engineer Oracle, Application Server Group September 29, 2014 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 4

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Goal of The Presentation 5 To show how Jersey as JAX-RS 2.0 implementation could be used outside of a Java EE container in a light-weight fashion to implement RESTful micro- services in Java

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Program Agenda Microservices Primer JAX-RS/Jersey Primer Jersey features to support Microservices development

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Microservices Primer See this: 7

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Microservices primer Do not try to solve complex problems at once – I.e. avoid building a single monolithic application Break the big thing into several small parts You will end up with a number of small loosely coupled applications – That can work together 8

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Why to break it down? It is easier to design a small application that only does one thing Testing is easier … as well as deployment and maintenance Individual parts could evolve at different pace 9

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Desired properties of you microservices Small enough that it could fit into your head – Every application does only one thing (and does it well) Could be easily thrown away and re-written Clear boundaries – Remotely accessible uniform interface 10

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Application interface Be of the web not on the web! HTTP and universal media types can be consumed by different clients Looks familiar? You are right, this is REST 11

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Deployment Select whatever container fits you best Standalone “container-less” deployment often recommended – Single jar file/OS service vs. a WAR in an application server Container selection does not matter to application consumers – You have this uniform interface and clear boundaries, don’t you? – But you might also have some throughput requirements – Auto-scaling 12

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Microservices summary Many small apps Every app does only one thing (and does it well) REST interface Decoupled from each other and it’s clients Deployable/Testable/Scalable individually 13

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. JAX-RS/Jersey primer JAX-RS 2.0 – part of Java EE 7 (2013) – defines a standard API for Implementing RESTful web services in Java REST client API Jersey 2 – provides production ready JAX-RS 2.0 reference implementation – brings several non-standard features 14

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Why JAX-RS/Jersey? REST is the natural way how to design Microservice interface JAX-RS provides widely adopted Java API for REST Jersey brings additional features that could help with other aspects – Lightweight container support (switch back to Java EE if needed) – Testing – Monitoring (Auto-scale) – Security – Redeploy – … 15

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Selected Jersey features Grizzly HTTP server support Test framework Application monitoring 16

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Grizzly HTTP server support URI AppURI = URI.create(" HttpServer httpServer = GrizzlyHttpServerFactory.createHttpServer( AppURI, new JaxRsApplication()); 17

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Grizzly HTTP server support – thread pool config HttpServer httpServer = GrizzlyHttpServerFactory.createHttpServer(AppURI, new JaxRsApplication(), false); NetworkListener grizzlyListener = httpServer.getListener("grizzly"); grizzlyListener.getTransport().setSelectorRunnersCount(4); grizzlyListener.getTransport().setWorkerThreadPoolConfig( ThreadPoolConfig.defaultConfig().setCorePoolSize(16).setMaxPoolSize(16)); httpServer.start(); 18

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Other supported containers Simple HTTP Server Jetty HTTP Container (Jetty Server Handler) Java SE HTTP Server (HttpHandler) Other containers could be plugged in via org.glassfish.jersey.server.spi.ContainerProvider SPI 19

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Jersey Test Framework Based on JUnit Support for TestNG available Multiple container support – Grizzly – In memory – Java SE Http Server – Jetty – External container support 20

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. External Test Container You can test any (already running) REST application No need to have Jersey on the other side Use the following parameters: mvn test \ -Djersey.config.test.container.factory=org.glassfish.jersey.test.external.ExternalTestContainerFactory \ -Djersey.test.host=localhost -Djersey.config.test.container.port=

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Monitoring support Must be explicitly enabled – ServerProperties.MONITORING_STATISTICS_ENABLED – ServerProperties.MONITORING_STATISTICS_MBEANS_ENABLED – Register your own event listeners MonitoringStatistics could be injected into any resource and MonitoringStatistics stats; 22

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Summary When writing microservices in Java, JAX-RS is a natural choice to implement REST interface Jersey brings several non-standard options that might be handy: – Lightweight container support (switch back to Java EE container if needed) – Test framework – Monitoring features (auto-scaling) There is more to come in future Jersey versions 23

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Several Related sessions Client Orchestration and Reactive Programming in JAX-RS Applications [CON3408] Tuesday, Sep 30, 12:30 PM, Parc 55 – Mission Real-World RESTful Service Development Problems and Solutions [BOF2105] Monday, Sep 29, 7:00 PM, Moscone South 303 Securing JAX-RS Services With OAuth 2 [CON3774] Tuesday, Sep 30, 12:30 PM, Hilton Golden Gate 6/7/8 24

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. THANK YOU!

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. BACKUP JAX-RS/CDI demo on Grizzly HTTP server 26