Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0
-
Upload
afkhamazeez -
Category
Technology
-
view
445 -
download
4
Transcript of Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0
![Page 1: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/1.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/2.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/3.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/4.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/5.jpg)
MSF4J- Performance Comparison
![Page 6: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/6.jpg)
MSF4J- Memory Consumption Comparison
![Page 7: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/7.jpg)
MSF4J- Latency Comparison
![Page 8: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/8.jpg)
MSF4J– Thread Model
![Page 9: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/9.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/10.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/11.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/12.jpg)
Getting Started• Start from Maven archetype• Start from Swagger definition
12
![Page 13: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/13.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/14.jpg)
Start from Swagger Def
14
![Page 15: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/15.jpg)
![Page 16: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/16.jpg)
Runner
![Page 17: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/17.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/18.jpg)
ExceptionMapper
18
![Page 19: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/19.jpg)
Circuit Breaker
19
![Page 20: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/20.jpg)
Swagger Annotations
20
![Page 21: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/21.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/22.jpg)
Request Streaming
22
![Page 23: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/23.jpg)
Response Streaming
23
![Page 24: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/24.jpg)
Form Processing• @FormParam• @FormDataParam• FormParamIterator
24
![Page 25: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/25.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/26.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/27.jpg)
Analytics & Monitoring
![Page 28: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/28.jpg)
Metrics Output to Console
![Page 29: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/29.jpg)
JMX Metrics
![Page 30: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/30.jpg)
Analytics & Monitoring
![Page 31: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/31.jpg)
MSF4J Pet store sample
![Page 32: Introduction to WSO2 Microservices Framework for Java (MSF4J) 2.0](https://reader035.fdocuments.us/reader035/viewer/2022062306/5870a3f41a28abcb078b556d/html5/thumbnails/32.jpg)
MSF4J Pet store sample