![Page 1: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/1.jpg)
WSO2 Microservices Framework for Java 2.0.0
Overview
![Page 2: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/2.jpg)
Agenda
• Introduction
• Core Features
• Performance
• Deployment
2
![Page 3: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/3.jpg)
Introduction
3
![Page 4: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/4.jpg)
Microservices
• Small independent processes achieving small tasks, which work together to ultimately compose a complex application
4
Ref: http://martinfowler.com/articles/microservices/images/sketch.png
![Page 5: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/5.jpg)
Microservices Architecture
• Modular and composable
• Easy to maintain - Components can be easily replaced and bugs in one component can be fixed without affecting others
• Highly scalable
• Easy deployment
5
![Page 6: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/6.jpg)
WSO2 Microservices Framework for Java
• A lightweight, high performance framework for building microservices in Java
• Simple Java based programming model with JAX-RS and Swagger based annotations
• Fast boot up - microservices can be booted in a few milliseconds in a Docker container and can be easily added to a Docker image
• Secures microservices leveraging JWT, BasicAuth and OAuth2 and has the capability to integrate with third-party authentication servers
• Monitors microservices service behavior with analytics dashboards
6
![Page 7: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/7.jpg)
Vision of WSO2 MSF4J
• Lightweight and fast runtime
• Use Java annotations as a way of defining microservices APIs as well as met
• Provide simple ways to develop and deploy microservices
• Built-in metrics and analytics APIs with OOB integration with WSO2 Data Analytics Server (WSO2 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 interactions
7
![Page 8: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/8.jpg)
Implementation of WSO2 MSF4J
• Based on the new WSO2 Carbon 5.0 Kernel
• Transport is based on Netty 4.0
• Supports streaming
• High performance
• 9MB pack size
• Starts within 300 ms
• Less than 25 MB memory consumption for the framework
8
![Page 9: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/9.jpg)
Core Features
9
![Page 10: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/10.jpg)
Annotation-based Programming Model
• Supports JAX-RS based annotations • Class-level annotations
• Method-level annotations
• Parameter-level annotations
• Lifecycle callback method annotations
• Supports Swagger based annotations • Enables generating Swagger API definition from a single API call
• Humans and computers can discover and understand the capabilities of each service
10
![Page 11: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/11.jpg)
Spring-based Microservices
• WSO2 MSF4J Supports a Spring-native development model with • Dependency Injection (DI)
• Standard configuration annotations (e.g. @Configuration, @Component, @AutoWired)
• Makes it easy to bring in other 3rd party libraries & wire them in at runtime
• For example those who are familiar with Spring-JPA can use the Spring-JPA library to integrate the Hibernate ORM framework with an WSO2 MSF4J service
11
![Page 12: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/12.jpg)
Server-less Execution
• Supports server-less execution with fat JAR
• Fat JAR is a JAR file with all dependencies in one fat (uber) JAR
• Creating a fat JAR and running it in a Java process is referred to as server-less execution
• Server-less execution does not involve unzipping a file and helps to start an app without a shell script
• Supports service lifecycle methods
• Easy to run within a container-friendly model
12
![Page 13: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/13.jpg)
Streaming
• WSO2 MSF4J adopts an efficient model to handle Streaming Input (request messages) and Streaming Output (response messages)
• Streaming Input - HTTP chunked requests can be handled in two ways:
• Zero-copy method – Each chunk of a request is treated separately • chunk() method is called when requests arrive • finished () method is called after the last chunk arrives • error () method called if an error occurs while processing the request
• Chunk aggregation – Aggregates all chunks of the request and presents it as a full http request to the resource method
• Streaming Output – Useful when handling large data volumes – no need to load into memory
13
![Page 14: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/14.jpg)
Custom Interceptors
• Custom interceptors can be used to perform certain actions before or after a request arrives to resource methods
• Custom interceptors should implement theorg.wso2.msf4j.Interceptor interface
14
![Page 15: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/15.jpg)
File Handling
• Serve files from the resource methods by returning either of the following • java.io.File • java.io.InputStream • javax.ws.rs.core.Response object with a java.io.File • java.io.InputStream entity
• Streaming is supported by default for java.io.File and java.io.InputStream entities
• javax.ws.rs.core.StreamingOutput is also supported by WSO2 MSF4J - provides the service author more control over the chunk size
15
![Page 16: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/16.jpg)
Templates
• Enables dynamic Web pages to be easily developed as microservices
• Any data model can be easily rendered with a template and exposed as a REST service using this concept
16
![Page 17: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/17.jpg)
Exception Mapper
• Supports JAXRS ExceptionMapper, which allows the creation of custom responses when exceptions are thrown from MSF4J services
• The following code segment shows how ExceptionMappers are registered with the WSO2 MSF4J runtime:
17
![Page 18: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/18.jpg)
Circuit Breaker
• Nygard's circuit breaker pattern is supported in
WSO2 MSF4J using the Netflix Hystrix library
18
![Page 19: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/19.jpg)
Thread Model
19
![Page 20: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/20.jpg)
Security
• Security is done via a central server issuing JWT tokens
• The JWTSecurityInterceptor verifies the signature, expiry and claims in the token
20
![Page 21: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/21.jpg)
Analytics and Monitoring
• Supports annotations • Timed – measures execution time • Metered – measures rate of events • Counted – counts the total number of invocations • HTTPMonitored – monitors HTTP requests
21
![Page 22: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/22.jpg)
Metrics Output to Console
22
![Page 23: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/23.jpg)
JMX Metrics
23
![Page 24: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/24.jpg)
Dashboards
24
![Page 25: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/25.jpg)
Performance
25
![Page 26: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/26.jpg)
26
![Page 27: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/27.jpg)
27
![Page 28: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/28.jpg)
28
![Page 29: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/29.jpg)
29
![Page 30: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/30.jpg)
30
![Page 31: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/31.jpg)
31
![Page 32: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/32.jpg)
Deployment
32
![Page 33: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/33.jpg)
33
WSO2 Platform Deployment Options
o Stand-‐alone servers o Private clouds:
e.g. Stratos, Kubernetes o Public Clouds:
e.g. AWS o Hybrid deployments
o Dedicated hosKng of any WSO2-‐based soluKons
o WSO2 operaKons team is managing the deployment and keeps it running
o 99.99% upKme SLA o Any AWS region of choice o Can be VPNed to local network o Includes monitoring, backups,
patching, updates
o Shared public cloud, o Currently available for applicaKon and
API hosKng (hosted API Manager and App Factory),
o Preset mulKtenant deployment in AWS US East run by WSO2,
o Month-‐to-‐month credit card payment
![Page 34: WSO2 Microservices Framework for Java - Product Overview](https://reader034.vdocuments.net/reader034/viewer/2022042507/58a131ae1a28abd34f8b5803/html5/thumbnails/34.jpg)
CONTACT US !