java and graalvm runtime for microservices - restheart
TRANSCRIPT
RESTHeart
Java and GraalVM Runtime for Microservices
Designed to radically simplify server-side development and deployment
Software Design & Development Company, based in Milan, Italy
https://softinstigate.com/en
We develop RESTHeart
http://github.com/softinstigate/restheart
Our relationship with MongoDB
SoftInstigate isMongoDB ISV and Technical
Partner
Read our story on https://www.mongodb.com/customers/softinstigate
Real case example
● The project leverages RESTHeart+MongoDB and Angular
● Project start: mid September 2019
● In production: end of December 2019
● It took 215 man-days to go online
Thanks to RESTHeart, only 11 man-days were required for
the development of the back-end
● Most of the team focused on UX/UI
Backend 5%
frontend 95%
Project run by SoftInstigate
Complex B2B and C2B marketplace for used cars
Motivation
There are fundamental features every application always need to implement:
● Security
● Data Persistence
● Custom logic API
RESTHeart provides out-of-the-box data persistence on MongoDB , secure
authentication and role-based authorization, and a Java and JavaScript
framework to develop services.
Main Features
Security
Authenticate clients via multiple schemes and
enforce role-based authorization policies.
Security can be easily customized to integrate
external providers or implement fine-grained
security policies.
Development Framework
Develop Web Services in minutes or execute
custom behaviours on different stages of the
request / response life-cycle.
Deploy custom services by just copying plugins
into a folder.
Data API
RESTHeart leverages MongoDB to provide all
data functionalities required by modern
applications
Supports all the features of MongoDB including queries, aggregations, change streams and
transactions.
Proxy
Use RESTHeart as the Ingress for your
microservices and handle them under the same security context.
This makes possible to use external
microservices, made with Node.js, Spring
Boot, or AWS Lambda.
Core RuntimeRESTHeart exposes a complete API that follows the REST paradigm and uses JSON as the representation format.
RESTHeart simplifies client-server interaction
● Clients interact with RESTHeart using
plain HTTP requests and JSON.
● REST + GraphQL make the API clean,
self-describing and easy to use.
● Works seamlessly with SPA frameworks
(React, Angular, Vue, ecc) .
● Clients (e.g. Mobile Apps) just require a
HTTP client library.
What's new in RESTHeart v6
● GraphQL API for MongoDB
● JavaScript Development Framework
● Available as native image for instant startup and small
memory footprint (fully supports GraalVM)
● Enhanced and Simpler Security
https://restheart.org/docs/upgrade-to-v6
Discussion about v7
Technical Specifications
● Runs on Java and GraalVM and as native image
● Uses MongoDB and compatible databases for data persistence
● Super fast (handles over 100k requests per seconds per instance)
● Docker images are available (~ 1 M download)
● Kubernetes friendly
● Can be easily deployed both on Cloud and On Premises.
RESTHeart supports all MongoDB’s features, and more
Read / Write JSON documents
Binary data with GridFS
Aggregations
Transactions
Data streams with
WebSockets
Data transformation & validation
DB Management API
Upload data from CSV files
Supported databases
RESTHeart is tested and supported with:
● MongoDB Community
● MongoDB Enterprise
● Percona Server for MongoDB
● Amazon DocumentDB (*)
● Microsoft Azure Cosmos DB (*)
(*) Both databases are API-compatible with MongoDB v3, but with some specific limitations.
Example: Query data with JavaScript
const url = encodeURI('https://demo.restheart.org/messages?filter={"from":"Bob"}&pagesize=1 ');
fetch(url) .then(response => response.json()) .then(json => JSON.stringify(json, null, 2)) .then(docs => console.log(docs))
HTTP/1.1 200 OK...
[{ "_id": { "$oid": "5db0067615f384eda89e5fab" }, "message": "hi there!", "from": "Bob", "timestamp": { "$date": 1571817078280 }}]
Run it
Development Framework
RESTHeart provides a modern Development Framework
● Services are bound to an URI to handle HTTP requests
● Interceptors can read or modify requests and responses on the fly
Languages: Java, Kotlin and JavaScript (from v6)
See examples at https://github.com/SoftInstigate/restheart-examples
Example: HelloWorld Web Service in Java
$ curl 127.0.0.1:8080/greetings
HTTP/1.1 200 OK
{ "message": "Hello World" }
@RegisterPlugin(name = "greetings", description = "just another Hello World")public class GreeterService implements JsonService { @Override public void handle(JsonRequest req, JsonResponse res) { switch(req.getMethod()) { case GET -> res.setContent(object().put("message", "Hello World!")); case OPTIONS -> handleOptions(req); default -> res.setStatusCode(HttpStatus.SC_METHOD_NOT_ALLOWED); } }}
export const options = { name: "helloWorldService", description: "just another Hello World", uri: "/hello"}
export function handle(req, res) { res.setContent(JSON.stringify({ msg: 'Hello World' })); res.setContentTypeAsJson();}
JavaScript Example
$ curl 127.0.0.1:8080/hello
HTTP/1.1 200 OK
{ "message": "Hello World" }
On-premises
Buy license keys for running RESTHeart in production without incurring in the limitations of the Open Source license, including 12 months of first-class enterprise support.
https://restheart.com/#onPremises
Cloud
Fully managed Cloud service with all the out-of-the-box features of RESTHeart (including Authenticaton+Authorization and the Data API), where you can run your own plugins.
https://restheart.com/cloud
Support
First-class support from the RESTHeart development team
You get Enterprise Support if you have an active RESTHeart Cloud account or if you own a RESTHeart commercial license, during the validity of the subscription period.
All included
The support team is available for you via Jira. Whatever it is a discussion around a scalability problem, a feature request, an hint about the best approach to develop a custom plugin or how to use the API from a client application, or just a question, we are here to help.Service Level Agreement
Contact us
Contact us to request more information
https://restheart.com/#contact
Visit the web site https://restheart.org
For any question [email protected]
Legal office
SoftInstigate srl
Via G. D'Annunzio 28, 67100 L'Aquila, Italy
Head office
SoftInstigate srl
Via Copernico 38, 20125, Milano, Italy
Viale Marconi 29, 65126, Pescara, Italy
Web: https://www.softinstigate.com | Email: [email protected]
RESTHeart is a division of SoftInstigate