Developing, managing and opening the hood of JVM REST services / - - PowerPoint PPT Presentation

developing managing and opening the hood of jvm rest
SMART_READER_LITE
LIVE PREVIEW

Developing, managing and opening the hood of JVM REST services / - - PowerPoint PPT Presentation

OSGi DevCon / QCon New York 2014 Developing, managing and opening the hood of JVM REST services / Lars Pfannenschmidt @leastangle What is swookiee? / Lars Pfannenschmidt @leastangle Pfannen-what? Fun-an-schmidt Data Products @


slide-1
SLIDE 1

OSGi DevCon / QCon New York 2014

Developing, managing and

  • pening the

hood of JVM REST services

/

Lars Pfannenschmidt @leastangle

slide-2
SLIDE 2

What is swookiee?

/

Lars Pfannenschmidt @leastangle

slide-3
SLIDE 3

Pfannen-what?

Fun-an-schmidt Data Products @ Intuit Data Engineering & Analytics Founder of User Group ★ ★ ★ @mobilecgn ★@leastangle

slide-4
SLIDE 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 ★ ★ ★ ★ ★ ★ ★ ★ ★

slide-5
SLIDE 5

10

(-6+1) - Services

slide-6
SLIDE 6

Agenda

Building REST Services Swagger documentation Metrics JSON Logging Remote Control ★ ★ ★ ★ ★

slide-7
SLIDE 7

Fizz Buzz

https://flic.kr/p/6ae8KK by Luis Linero - Some rights reserved CC BY 2.0

slide-8
SLIDE 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.

slide-9
SLIDE 9

FizzBuzz v1

slide-10
SLIDE 10
slide-11
SLIDE 11

FizzBuzz v2

slide-12
SLIDE 12

Documentation

https://flic.kr/p/dELbZF Books HD by Abhi Sharma - Some rights reserved CC BY 2.0

slide-13
SLIDE 13

FizzBuzz v3

slide-14
SLIDE 14

Alternatives

Good old WADL? [ ] Apiary (http://apiary.io/) RAML (http://raml.org/) ... ★ here ★ ★ ★

slide-15
SLIDE 15

Metrics

Opening the hood

https://flic.kr/p/byHbPG Broken down by orangebrompton - Some rights reserved CC BY-NC-SA 2.0

slide-16
SLIDE 16

FizzBuzz v4

slide-17
SLIDE 17

Logging

https://flic.kr/p/fE5Wgb Pitt River Logs by James Wheeler - Some rights reserved CC BY-NC-SA 2.0

slide-18
SLIDE 18

Enabling JSON Logging

productionLogging = true loggingDirectory = logs Generated logs can be found in logs/osgi- log.json

slide-19
SLIDE 19

Sample Log Entry

{ "timestamp":"1402051840211", "level":"INFO", "thread":"Component Resolve Thread (Bundle 48)", "logger":"com.swookiee.runtime.metrics.MetricsToGraphiteReporter", "message":"Graphite Reporter started using configuration: GraphiteReporterConfiguration [graphiteHost=localhost, graphitePort=2003, reportingIntervalInSeconds=10, reportingEnabled=true, reportingPrefix=Demo]" "context":"default" }

slide-20
SLIDE 20

Messages in JSON?

Map<String, Object> map = new HashMap<>(); 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" }

slide-21
SLIDE 21

Remote

https://flic.kr/p/hm8mFS

Chernobyl NPP - Control Room No. 2 by Michael Kötter - Some rights reserved CC BY-NC-SA 2.0

slide-22
SLIDE 22

Some REST calls

slide-23
SLIDE 23

Deploy

private SwookieeClient getSwookieeClient() throws SwookieeClientException { SwookieClientBuilder swookieClientBuilder = SwookieClientBuilder .newTarget("localhost") .withPort(8080) .withUsernamePassword("admin", "admin123"); return swookieClientBuilder.create(); } try ( SwookieeClient swookieeClient = getSwookieeClient() ) { String installedBundle = swookieeClient.installBundle(file, true); swookieeClient.startBundle(installedBundle); } catch (SwookieeClientException ex) { logger.error("Could not install/start bundle: '{}'", ex.getMessage(), ex); }

slide-24
SLIDE 24

Future

Release version JVM languages? OAuth2 provider Integration testing ★ ★ ★ ★

slide-25
SLIDE 25

Thank You!

swookiee.com

/

Lars Pfannenschmidt @leastangle