introduction to wso2 microservices framework for java (msf4j) 2.0

33
Introduction to MSF4J 2.0 Afkham Azeez Senior Director, Platform Architecture, WSO2,Inc. @afkham_azeez http:// me.afkham.org

Upload: afkhamazeez

Post on 07-Jan-2017

447 views

Category:

Technology


4 download

TRANSCRIPT

Page 1: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0

Introduction to MSF4J 2.0

Afkham AzeezSenior Director, Platform Architecture, WSO2,Inc.@afkham_azeez http://me.afkham.org

Page 2: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0

What is MSF4J?

A lightweight, high performance framework for building microservices in Java

Page 3: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0

Vision for MSF4J• Lightweight & fast runtime

• Use Java annotations as a way of defining microservices APIs as

well as metrics

• Provide simple ways to develop & deploy microservices

• Built-in Metrics & Analytics APIs with out of the box integration with

WSO2 Data Analytics Server (DAS)

• To be used in the WSO2 platform as a way of replacing all admin

services as well as defining other microservices for inter-component

interactions3

Page 4: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0

MSF4J Implementation• Based on the new Carbon 5.0 kernel

• Transport is based on Netty 4.0

• Supports streaming

• High performance

• 9MB pack size

• Starts within 300ms

• Less than 25MB memory consumption for the framework

Page 5: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0

MSF4J- Performance Comparison

Page 6: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0

MSF4J- Memory Consumption Comparison

Page 7: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0

MSF4J- Latency Comparison

Page 8: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0

MSF4J– Thread Model

Page 9: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0

Download

o MSF4J 2.0.0 release is available athttps://github.com/wso2/msf4j/releases/tag/v2.0.0o Refer to the getting started guide in GitHubo A good place to start is the samples

Page 10: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0

Core Features (1/2)• Quick & simple development model using simple

annotations

• Supports Spring annotations & runtime

• Swagger support

• ExceptionMapper

• Form processing – FormParam, FormDataParam, FormIterator

• Custom interceptors10

Page 11: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0

Core Features (2/2)• JWT based security

• Metrics gathering & publishing

• Streaming input & streaming output support

• Circuit breaker support

• WSO2 DevStudio based tooling for generating microservices projects starting from a Swagger API definition

• Comprehensive samples demonstrating how to develop microservices application

11

Page 12: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0

Getting Started• Start from Maven archetype• Start from Swagger definition

12

Page 13: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0

Start from Maven Archetypemvn archetype:generate -DarchetypeGroupId=org.wso2.msf4j \-DarchetypeArtifactId=msf4j-microservice -DarchetypeVersion=2.0.0 \-DgroupId=org.example -DartifactId=Hello-Service -Dversion=1.0.0-SNAPSHOT \-Dpackage=org.example.service -DserviceClass=HelloService

13

Page 14: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0

Start from Swagger Def

14

Page 15: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0
Page 16: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0

Runner

Page 17: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0

Spring Support• Supports standard Spring configuration annotations

such as @Configuration, @Component, @AutoWired etc. and other Spring features work with MSF4J

• Bring in other 3rd party libraries & wire them in at runtime. • e.g. Spring-JPA library to integrate the Hibernate ORM

framework with an MSF4J service

17

Page 18: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0

ExceptionMapper

18

Page 19: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0

Circuit Breaker

19

Page 20: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0

Swagger Annotations

20

Page 21: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0

Swagger Definition • http://localhost:8080/swagger• http://localhost:8080/swagger?path=/stockquote

21

Page 22: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0

Request Streaming

22

Page 23: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0

Response Streaming

23

Page 24: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0

Form Processing• @FormParam• @FormDataParam• FormParamIterator

24

Page 25: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0

Security

• Security is done via a central server issuing JWT tokens

• The JWTSecurityInterceptor verifies the signature, expiry & claims in the token

Page 26: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0

Analytics & Monitoring

• Supports annotations• Timed – measures execution time

• Metered – measures rate of events

• Counted – Counts the total invocations

• HTTPMonitored – monitors HTTP requests

Page 27: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0

Analytics & Monitoring

Page 28: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0

Metrics Output to Console

Page 29: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0

JMX Metrics

Page 30: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0

Analytics & Monitoring

Page 31: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0

MSF4J Pet store sample

Page 32: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0

MSF4J Pet store sample