Developing, managing and opening the hood of JVM REST services - L Pfannenschmidt

876 views

Published on

Most modern applications targeting web or mobile use cases rely heavily on REST API backends. Being able to document, develop, deploy and scale such APIs has therefore become an essential capability in software development. In particular for agile teams aiming for continuous deployment and continuous monitoring such a setup is crucial.

Swookiee (derived from “shaved wookiee” - http://swookiee.com is a shining new open source runtime environment that was built with the main intention to reduce the architectural burden of developers and therefore enabling them to focus [even more] on the implementation of features, be they implemented in Java, Groovy or Scala.

This presentation introduces swookiee and shows how it provides JVM-based REST services powered by JAX-RS 2 with Jersey, Jetty and Jackson on top of the Equinox OSGi runtime. How clients and colleagues can understand and consume these services using swagger documentation. How a lightweight implementation of the OSGi RFC-182 enables remote management of swookiee instances through REST. How to increase introspection by feeding log output into logstash and kibana. And how to achieve total introspection into every aspect of your application using metrics from the number of calls by HTTP status code to measurements deep in the application like queue sizes or execution times.

It even sports a basic OAuth2 provider, which enables you to provide customers out of the box with a modern authentication mechanism that isn't a pain.

Bio:
Lars is interested in Mobile Applications, Smart Home, Domain Specific Languages, Machine Learning, Big Data and agile development methodologies such as Scrum and Kanban.

Lars is currently a Senior Software Engineer at Intuit (through Level Up Analytics acquisition) and is Founder of mobile.cologne.

Published in: Technology, Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
876
On SlideShare
0
From Embeds
0
Number of Embeds
15
Actions
Shares
0
Downloads
34
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Developing, managing and opening the hood of JVM REST services - L Pfannenschmidt

  1. 1. OSGi DevCon / QCon New York 2014 Developing, managing and opening the hood of JVM REST services/Lars Pfannenschmidt @leastangle
  2. 2. What is swookiee?/Lars Pfannenschmidt @leastangle
  3. 3. Pfannen-what? Fun-an-schmidt Data Products @ Intuit Data Engineering & Analytics Founder of User Group ★ ★ ★ @mobilecgn ★@leastangle
  4. 4. What is swookiee? OSGi Runtime for REST Services JAX-RS 2 Jersey, Jetty, Jackson Services in Java, Groovy, Scala Swagger integration Metrics / Graphite Support JSON Logging Support Remote Controllable (RFC-182) EPL ★ ★ ★ ★ ★ ★ ★ ★ ★
  5. 5. 10 (-6+1)  - Services
  6. 6. Agenda Building REST Services Swagger documentation Metrics JSON Logging Remote Control ★ ★ ★ ★ ★
  7. 7. Fizz Buzzhttps://flic.kr/p/6ae8KK by Luis Linero - Some rights reserved CC BY 2.0
  8. 8. Any number divisible by three is replaced by the word fizz and any divisible by five by the word buzz. Numbers divisible by three and five become fizz buzz.
  9. 9. FizzBuzz v1
  10. 10. FizzBuzz v2
  11. 11. Documentationhttps://flic.kr/p/dELbZF Books HD by Abhi Sharma - Some rights reserved CC BY 2.0
  12. 12. FizzBuzz v3
  13. 13. Alternatives Good old WADL? [ ] Apiary (http://apiary.io/) RAML (http://raml.org/) ... ★ here ★ ★ ★
  14. 14. Metrics Opening the hood https://flic.kr/p/byHbPG Broken down by orangebrompton - Some rights reserved CC BY-NC-SA 2.0
  15. 15. FizzBuzz v4
  16. 16. Logginghttps://flic.kr/p/fE5Wgb Pitt River Logs by James Wheeler - Some rights reserved CC BY-NC-SA 2.0
  17. 17. Enabling JSON Logging productionLogging = true loggingDirectory = logs Generated logs can be found in logs/osgi- log.json
  18. 18. Sample Log Entry { "timestamp":"1402051840211", "level":"INFO", "thread":"ComponentResolveThread(Bundle48)", "logger":"com.swookiee.runtime.metrics.MetricsToGraphiteReporter", "message":"GraphiteReporterstartedusingconfiguration:GraphiteReporterConfiguration[graph "context":"default" }
  19. 19. Messages in JSON? Map<String,Object>map=newHashMap<>(); map.put("limit",limit); map.put("result",result); logger.info("{}",map); { "timestamp":"1401544478570", "level":"INFO", "thread":"qtp1201555453-33", "logger":"com.swookiee.demo.logging.impl.FizzBuzzService", "message":{ "result":[ "1", "2", "Fizz", "4", "Buzz" ], "limit":5 }, "context":"default" }
  20. 20. Remotehttps://flic.kr/p/hm8mFS Chernobyl NPP - Control Room No. 2 by Michael Kötter - Some rights reserved CC BY-NC-SA 2.0
  21. 21. Some REST calls
  22. 22. Deploy privateSwookieeClientgetSwookieeClient()throwsSwookieeClientException{ SwookieClientBuilderswookieClientBuilder=SwookieClientBuilder .newTarget("localhost") .withPort(8080) .withUsernamePassword("admin","admin123"); returnswookieClientBuilder.create(); } try(SwookieeClientswookieeClient=getSwookieeClient()){ StringinstalledBundle=swookieeClient.installBundle(file,true); swookieeClient.startBundle(installedBundle); }catch(SwookieeClientExceptionex){ logger.error("Couldnotinstall/startbundle:'{}'",ex.getMessage(),ex); }
  23. 23. Future Release version JVM languages? OAuth2 provider Integration testing ★ ★ ★ ★
  24. 24. Thank You! swookiee.com /Lars Pfannenschmidt @leastangle

×