SlideShare a Scribd company logo
Classificatie: vertrouwelijk
Microservices in
real life –
with Node &
Dapr.io
March 2022
Lucas Jellema
Architect & CTO AMIS | Conclusion
labs: https://github.com/lucasjellema/fontys-2022-microservices-kafka-dapr
Classificatie: vertrouwelijk
Microservices in real life – with Node & Dapr.io
Founded in 1991 by students
from University of Twente –
Aircraft Maintenance Information
System (AMIS)
80 colleagues,
located in
Nieuwegein
the core of what we do:
working with Data.
partnering with peers
and companies in
several countries
Lucas Jellema (2002)
Cloud Solution Architect & CTO
lucas.jellema@amis.nl | technology.amis.nl | @lucasjellema | lucas-jellema
Classificatie: vertrouwelijk
Microservices in real life – with Node & Dapr.io
Data Engineering, Data Analytics
(& Data Science)
Data &
Application
Integration
web
applications
Internet of Things
cloud, DevOps, PaaS,
streaming, microservices,
Software Studio, database,
software engineering
Oracle, Microsoft Azure,
open source, Java, SQL,
NodeJS, Python,
React/Angular
Classificatie: vertrouwelijk
Microservices in real life – with Node & Dapr.io
Classificatie: vertrouwelijk
Microservices in real life – with Node & Dapr.io
Classificatie: vertrouwelijk
Microservices in real life – with Node & Dapr.io
Classificatie: vertrouwelijk
Microservices in real life – with Node & Dapr.io
Classificatie: vertrouwelijk
Microservices in real life – with Node & Dapr.io
and you are invited to come do an internship and explore job opportunities with us!
Classificatie: Public
Publiek
Moving On. Our Main Story today (and next week)
• Applications
• more specifically:
Microservices – the best form of applications we have come up with so far
• How they are designed
• How they interact
• How they can be implemented
• Using:
• Dapr.io – distributed application runtime
• Node – popular, full stack, omnipresent programming language
• Apache Kafka – distributed message broker, enterprise backbone
Microservices in real life – with Node & Dapr.io
Classificatie: Public
Publiek
Overview
• Part One (today)
• Microservices recap
• Dapr.io – personal assistant for applications & distributed application runtime
• Handson with Dapr.io
• Quick Intro to programming in Node[.js]
• Handson Microservice implementation with Node and Dapr.io
• Part Two (next week, 30 March)
• Asynchronous interactions through Apache Kafka
• Handson with Apache Kafka and Node
• Real world use cases and scenarios with Apache Kafka
• Handson Multi-microservice set up with Apache Kafka, Node and Dapr.io
Microservices in real life – with Node & Dapr.io
Classificatie: Public
Publiek
Assumed is
• A development environment with VS Code, Docker and the ability to install
• Knowledge of
• HTTP, REST, JSON
• Containers, Docker (and Kubernetes)
• Java or C#
• SQL and a database (MySQL or PostgreSQL or SQL Server)
• perhaps Message Broker/Event Queue (RabbitMQ?), Cache (Redis?)
• Cloud fundamentals
• Microservices concepts
Microservices in real life – with Node & Dapr.io
Classificatie: Public
Publiek
What is an Application?
• Collection of (business) functionality
• implemented with COTS, code, platform & infra
Microservices in real life – with Node & Dapr.io
standard custom
Compute (Containers, VMs, bare
metal servers)
Storage Network
Database
IAM/
LDAP
Event / Message
Broker
Web
Server
API
Gateway
Data Center Power Cooling
Custom
hardware
Custom
platform
Operating System
Language Runtime
use as is
out of the box
(pre-)integrated
application
platform, to be
custom configured
best of breed
applications per
functional domain.
(custom
integration)
low code tools
for workflow,
automation,
integration en
frontends
high code technology
for bit & pixel perfect
software with tailored
fit (functionally & non-
functionally)
Classificatie: Public
Publiek
What is a microservice?
• Why is a microservice?
• Problems with (BIG) applications
• complex
• inflexible to change (when roll out changes)
• long test, long build
• impossible to upgrade technology (everything is affected)
• hard to scale
• hard to migrate (to different technology)
• hard to learn (for new staff)
Microservices in real life – with Node & Dapr.io
Classificatie: Public
Publiek
Final Demo
• Microservice
Microservices in real life – with Node & Dapr.io
Classificatie: Public
Publiek
What is a microservice?
• Not TOO big (but not too small either)
• understandable by normal human beings – easy to on board new team members
• easy to change – allow for agile functional and non functional evolution
• functionally cohesive/logical collection of features => domain
• design time decoupled, clear standards based external interfaces: API & events
• low external impact of: change, refactor, move, migrate, scale, failure
• reliable, robust, resilient
• clear ownership (business sponsor; one IT team builds it, runs it, evolves it)
• contains everything needed to run [on a generic platform]
• application software, libraries/frameworks, platform configuration
• pipelines for CI and CD, tests, documentation, infra as code
Microservices in real life – with Node & Dapr.io
Classificatie: Public
Publiek
What is IT all about?
Application
Production Runtime
Microservices in real life – with Node & Dapr.io
Classificatie: Public
Publiek
What is IT all about?
Application
Production Runtime
Platform
Microservices in real life – with Node & Dapr.io
Business
value
Classificatie: Public
Publiek
What is IT all about?
Application
Platform
Production Runtime
Operations
Monitoring &
Management
Platform
Platform
Microservices in real life – with Node & Dapr.io
Classificatie: Public
Publiek
Production Runtime is the Result of Preparation Runtime
Application
Platform
Production Runtime
Operations
Monitoring &
Management
Application
Preparation Runtime
Platform
Development
CD
Agile Design,
Build, Test
Microservices in real life – with Node & Dapr.io
Classificatie: Public
Publiek
One team has Agile responsibility through full lifecyle
Application
Platform
Production Runtime
Operations
Monitoring &
Management
Application
Preparation Runtime
Platform
Development
CD
Agile Design,
Build, Test
Microservices in real life – with Node & Dapr.io
Classificatie: Public
Publiek
One team has Agile responsibility through full lifecyle
Application
Platform
Production Runtime
Operations
Monitoring &
Management
Application
Preparation Runtime
Platform
Development
CD
Agile Design,
Build, Test
Microservices in real life – with Node & Dapr.io
Classificatie: Public
Publiek
One team has Agile responsibility through full lifecyle
Application
Platform
Application
Platform
Microservices in real life – with Node & Dapr.io
Classificatie: Public
Publiek
A microservice is owned by one team through its full lifecyle
Microservice
Microservices in real life – with Node & Dapr.io
Classificatie: Public
Publiek
The Microservice
API
HTTP REST/JSON
Microservices in real life – with Node & Dapr.io
µ
Classificatie: Public
Publiek
Independent microservices and an integrated front end
Microservices in real life – with Node & Dapr.io
Classificatie: Public
Publiek
Independent microservices and an integrated front end
Microservices in real life – with Node & Dapr.io
microservice / team
Classificatie: Public
Publiek
The Microservices Platform
Microservices in real life – with Node & Dapr.io
Runtime Platform
API
µ
API
µ
API
µ
API
µ
Classificatie: Public
Publiek
The Microservices Platform
Cloud Native Application Development- on Oracle Cloud | APAC OGB Tour 2021
power cooling
rack
space
physical real estate
IAM
Certificate
Management
Vulnerability
Scanning
Logging
Monitoring Auditing
Cloud Usage
Analysis
Resource
Manager
APIs
Cloud
Events
Notifications Cloud Guard
Tagging
Search
Serverless
Functions
Container
engine
API
Gateway
Load
Balancer
Container
Registry
Artifact
Repository
Job
Scheduling Build & Deploy
Pipelines
Code
Repository
Web Application
Firewall
CDN
Virtual
Machines
API
µ
Classificatie: Public
Publiek
The Microservices Platform
Cloud Native Application Development- on Oracle Cloud | APAC OGB Tour 2021
power cooling
rack
space
physical real estate
IAM
Certificate
Management
Vulnerability
Scanning
Logging
Monitoring Auditing
Cloud Usage
Analysis
Resource
Manager
APIs
Cloud
Events
Notifications Cloud Guard
Tagging
Search
SQL
Database Serverless
Functions
Container
engine
Vault
API
Gateway
Load
Balancer
Message/
Event Broker
Data
Lake
Container
Registry
Artifact
Repository
Job
Scheduling Build & Deploy
Pipelines
NoSQL
Database
Data
Cache
Code
Repository
Web Application
Firewall
CDN
Virtual
Machines
File Storage
API
µ
Classificatie: Public
Publiek
The Microservices Platform
Cloud Native Application Development- on Oracle Cloud | APAC OGB Tour 2021
power cooling
rack
space
physical real estate
IAM
Certificate
Management
Vulnerability
Scanning
Logging
Monitoring Auditing
Cloud Usage
Analysis
Resource
Manager
APIs
Cloud
Events
Notifications Cloud Guard
Tagging
Search
SQL
Database Serverless
Functions
Container
engine
Vault
API
Gateway
Load
Balancer
Message/
Event Broker
Data
Lake
Container
Registry
Artifact
Repository
Job
Scheduling Build & Deploy
Pipelines
NoSQL
Database
Data
Cache
Code
Repository
Web Application
Firewall
CDN
Virtual
Machines
File Storage
API
µ
Zipin
Classificatie: Public
Publiek
What do most microservices do?
• Store and retrieve state
• Read runtime secrets and configuration values
• Publish “observability data”
• Subscribe to event topic and handle incoming events
• Publish events to event topic
• Interact with other microservices
• Invoke external services
• Run microservice specific business logic
Microservices in real life – with Node & Dapr.io
This requires quite a bit of
repetitive “plumbing” tied to
specific technologies
– not meaningful effort
[from a business functionality
perspective]
Classificatie: Public
Publiek
Dapr
Distributed Application Runtime
quick introduction
Classificatie: Public
Publiek
Dapr
• Runtime
• Personal Assistant for Applications and Microservices
• Distributed Application Runtime
• Microservice architecture
• Decoupling
Microservices in real life – with Node & Dapr.io
Classificatie: Public
Publiek
Dapr.io
• Launched by Microsoft (2019)
• Application runtime framework –
supporting cloud native and serverless
• Every application gets a uniform Personal Assistant
that takes care of common tasks
• remember (take note and reproduce)
• keep log
• restrict access
• handle incoming
• route outgoing
• interact with
other PAs (and
their apps)
Microservices in real life – with Node & Dapr.io
Application
Microservice or
Monolith
Personal
Assistant
(Dapr)
Personal
Assistant
(Dapr)
Personal
Assistant
(Dapr)
Personal
Assistant
(Dapr)
Personal
Assistant
(Dapr)
Personal
Assistant
(Dapr)
Classificatie: Public
Publiek
Dapr.io
• Personal Assistant is Dapr Side Car
• companion process or side car container in Kubernetes Pod
Microservices in real life – with Node & Dapr.io
My App Dapr API
HTTP/gRPC
Application
Dapr sidecar
Classificatie: Public
Publiek
key value
myApp-weapon "DeathStar"
State management
My App
POST
http://localhost:3500/v1.0/state/corpdb
[{
"key": "weapon",
"value": "DeathStar"
}]
Redis Cache
Classificatie: Public
Publiek
State management
My App
key value
myApp-weapon "DeathStar"
Redis Cache
GET
http://localhost:3500/v1.0/state/corpdb/planet
"DeathStar"
Classificatie: Public
Publiek
State management
My App
key value
myApp-weapon "DeathStar"
Azure CosmosDB
GET
http://localhost:3500/v1.0/state/corpdb/planet
"DeathStar"
Classificatie: Public
Publiek
Dapr state API
Save state
POST /v1.0/state/corpdb
Retrieve state
GET /v1.0/state/corpdb/mystate
Delete state
DELETE /v1.0/state/corpdb/mystate
Get bulk state
POST /v1.0/state/corpdb/bulk
Submit multiple state transactions
POST /v1.0/state/corpdb/transaction
corpdb-redis.yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: corpdb
spec:
type: state.redis
version: v1
metadata:
- name: redisHost
value: redis-master.default.svc.cluster.local:6379
- name: redisPassword
secretKeyRef:
name: redis-secret
key: redis-password
Classificatie: Public
Publiek
Dapr state API
Save state
POST /v1.0/state/corpdb
Retrieve state
GET /v1.0/state/corpdb/mystate
Delete state
DELETE /v1.0/state/corpdb/mystate
Get bulk state
POST /v1.0/state/corpdb/bulk
Submit multiple state transactions
POST /v1.0/state/corpdb/transaction
corpdb-cosmosdb.yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: corpdb
spec:
type: state.azure.cosmosdb
version: v1
metadata:
- name: url
value: corpdb.documents.azure.com
- name: masterKey
secretKeyRef:
name: master-key
key: cosmos-key
- name: database
value: orders
- name: collection
value: processed
Classificatie: Public
Publiek
HTTP API gRPC API
Microservice building blocks
Service-
to-service
invocation
State
management
Publish
and
subscribe
Resource
bindings
and triggers
Actors Observability Secrets Extensible
Classificatie: Public
Publiek
Standard APIs accessed over http/gRPC protocols from
user service code
Runs as local “side car library” dynamically loaded
at runtime for each service
HTTP API gRPC API
Any language and framework
Application code
Microservices written in
Any code or framework…
Service-
to-service
invocation
State
management
Publish
and
subscribe
Resource
bindings
and triggers
Actors Observability Secrets Extensible
Classificatie: Public
Publiek
HTTP API gRPC API
Any cloud or edge infrastructure
Application code
Microservices written in
Any code or framework…
Service-
to-service
invocation
State
management
Publish
and
subscribe
Resource
bindings
and triggers
Actors Observability Secrets Extensible
Hosting infrastructure
On-Premises
Azure Arc
Classificatie: Public
Publiek
Service invocation
Service A
My App
mDNS
Multicast DNS component for
service discovery
mTLS encryption
POST
http://localhost:3500/v1.0/invoke/servicea/method/neworder
{"data":"Hello World"}
POST
http://10.0.0.2:8000/neworder
{"data":"Hello World"}
Classificatie: Public
Publiek
Publish and subscribe
Service B
My App Redis
Cache
Service A
POST
http://localhost:3500/v1.0/publish/orders/processed
{"data":"Hello World"}
POST
http://10.0.0.2:8000/orders
http://10.0.0.4:8000/factory/orders
{"data":"Hello World"}
Classificatie: Public
Publiek
Input triggers
My App
Twitter
POST
http://10.0.0.2:8000/newtweet
{"data":“📢 We are excited
to announce the …"}
Classificatie: Public
Publiek
Output bindings
My App
Twilio
POST
http://localhost:3500/v1.0/bindings/twilio
{"data":"Hello World"}
Hello World
Classificatie: Public
Publiek
Secrets
My App
GET
http://localhost:3500/v1.0/secrets/vault/mysecret
"supersecret"
HashiCorp
Vault
key value
mysecret "supersecret"
Classificatie: Public
Publiek
Observability
OpenTelemetry collector
Logging &
tracing extensions
My App Redis
Cache
Twitter
Service B
Service A
Classificatie: Public
Publiek
Dapr hosting environments
• Get started with dapr init -k
• Fully managed Dapr control plane
• Deploys dashboard, placement, operator,
sentry, and injector pods
• Automatically inject Dapr sidecar into
all annotated pods
• Upgrade with dapr upgrade or Helm
• Get started with dapr init
• Easy setup with Docker images
• Sets up placement, Zipkin, Redis
• slim-init available without Docker
• Run any application with Dapr sidecar
using dapr run
Self-hosted
Classificatie: Public
Publiek
Dapr in self-hosted Docker mode
Local dev machine or virtual machine
Zipkin
tracing
Zipkin
Redis
state store
Redis
My App
State Stores
PubSub
Brokers
Secret Stores
Bindings
& Triggers
Observability
Dapr Components
dapr run myapp
Use components
Launch application
Launch sidecar process
Set env variables
Save and retrieve state
Publish and subscribe to messages
Send distributed tracing
Classificatie: Public
Publiek
Hands On Lab 1
In a Linux compatible environment with Docker CLI set up
• Download and Install Dapr.io
• with out of the box state management and pub/sub based on Redis and
telemetry observation by Zipkin
• Run Dapr Sidecar
• Explore Dapr State Management APIs
• from the command line (cURL HTTP calls)
• Run MySQL container and have Dapr manage state in a MySQL database
• Explore Dapr Telemetry collection and presentation in Zipkin
Microservices in real life – with Node & Dapr.io
labs: https://github.com/lucasjellema/fontys-2022-microservices-kafka-dapr
Classificatie: Public
Publiek
Dapr in self-hosted Docker mode – add MySQL Database
Local dev machine or virtual machine
Zipkin
tracing
Zipkin
MySQL
database
Redis
state store
Redis
myotherapp
daprdapr run --app-id myotherapp --dapr-http-port 3510 --components-path .
Launch application
Launch sidecar process
Set env variables
Save and retrieve state
mysql-statestore.yaml
Classificatie: vertrouwelijk
Introduction
Node
Classificatie: Public
Publiek
General Purpose Programming Languages
• C & C++
• COBOL, Fortran, ALGOL, BASIC, Pascal
• SmallTalk
• Visual Basic
• Python
• PHP, Perl, Ruby
• Java
• JavaScript (ECMAScript, ES)
• C#
• Go
• Kotlin
• Rust
Microservices in real life – with Node & Dapr.io
Classificatie: Public
Publiek
Node == Server Side JavaScript
• Script: Not statically typed, not compiled – interpreted at runtime
• Node(JS) – open source, runtime based on Chrome V8 JavaScript engine
• initial release: 2009
• Full stack development – server side and client side can leverage JavaScript
• for example: MEAN stack (MongoDB, Express, Angular, NodeJS)
• Light weight, quick startup, support for high concurrency
• Skills widely available, many resources, tools and libraries
• Easy to get started, quite high productivity and fun factor
• Functions are primary citizens – functional programming
well supported
• Quite suitable for microservices –
including containerized and serverless
• Available everywhere – cross platform, all public clouds
• Note: TypeScript compiles to Node that is interpreted at runtime
Microservices in real life – with Node & Dapr.io
Classificatie: Public
Publiek
Introducing Node – Single Thread model
• Multi-thread languages – such as Java –
typically block when file system or network operations take place
• Parallel processing continues in parallel threads
• Threads consume resources and are only somewhat scalable
• JavaScript has a main (single thread) event loop and uses
asynchronous processing
• Non-blocking handling of file system
interactions, HTTP calls, network
operations and other blocking actions
• Scalable, very quick startup
Microservices in real life – with Node & Dapr.io
Classificatie: Public
Publiek
Introducing Node - NPM
• NPM = Node Package Manager
• To include libraries from the ecosystem
• Leverages npm registry (> 1.3M NPM Modules available)
• Acquired by Microsoft – March 2020
• To build and run Node applications
• similar to Maven & Gradle (Java)
or pip (Python)
• Yarn and Turbo are popular
alternatives
Microservices in real life – with Node & Dapr.io
Classificatie: Public
Publiek
Hello World in Node
• app.js
• with the code to execute
• (optional) package.json
• with NPM dependencies, build and run configuration
(compare Maven pom.xml)
• Create Node application:
• npm init (optional, you can just create a text file by hand instead)
• Run Node application
• node app.js
• npm start
• Add dependencies
• npm install <name of module> --save
Microservices in real life – with Node & Dapr.io
Classificatie: Public
Publiek
Functions
• Functions
• have a name
• take zero, one or multiple untyped input parameters
• return zero or one untyped result
• or an exception instead of a result
Microservices in real life – with Node & Dapr.io
Classificatie: Public
Publiek
Functions
• Function references
• can be assigned to a variable
• can be passed around
• can be invoked
• Note: function name without
parentheses is not a call to the
function but a reference
• print vs print()
Microservices in real life – with Node & Dapr.io
Classificatie: Public
Publiek
Functions
• Function references can be
closures – function + state
• closures contain values of
local context at the time
of instantiation
Microservices in real life – with Node & Dapr.io
Hello 1
World 2
Classificatie: Public
Publiek
Require – to import a module
• Node contains many out of the box modules
• for example: file, os, http, stream, crypto, net, url
• The NPM package manager adds more than 1M modules to make us of
• You can create your own (reusable) modules
• To access elements from a module, that module needs to be identified,
using: const <logical name> = require('module name')
• Module name can be reference to a local file, to a global module or to the
name of a module defined in package.json (and installed in the
application’s node-modules directory)
Microservices in real life – with Node & Dapr.io
Classificatie: Public
Publiek
Node – Asynchronous calls
• JavaScript is single threaded – no parallel threads can be started from your
code
• Any action in Node that requires network or file system interaction is
typically performed asynchronously:
• the command is started and handed to the
Node background processes;
the main thread continues with other work
• when the background processes have completed
the task, the results are returned to the invoker
(when the main thread has an opening)
Microservices in real life – with Node & Dapr.io
Classificatie: Public
Publiek
Node – Asynchronous HTTP calls
• Many modules are available
for HTTP communications
from Node
• The standard HTTP
module is not the most
convenient
• An HTTP request is
processed asynchronously in
all cases
• main program loop
proceeds while request is
made
Microservices in real life – with Node & Dapr.io
asynchronous HTTP request
response
Classificatie: Public
Publiek
Asynchronous –
waiting for one or more asynchronous results
• A function is declared to be asynchronous using the async keyword
• The result of an asynchronous function is an object of type Promise
• in order to get the actual value – the Promise must be “resolved”
• this can be waited for using the keyword await
• Alternatively – especially when multiple asynchronous results are waited for at the
same time – we can use Promise.then( <callback function>) or Promise.all(
<callback function>) to wait for Promise results to come available
Microservices in real life – with Node & Dapr.io
Classificatie: Public
Publiek
Hello World Web Application
• Node is very good at handling HTTP Requests
• It is a great technology to implement REST APIs and backends for Web and Mobile applications
• fast, scalable, easy to develop and to deploy
Microservices in real life – with Node & Dapr.io
define the function that
handles each HTTP
request and prepares the
response
Classificatie: Public
Publiek
Dapr and Node Applications
• HTTP (or gRPC) with Dapr SideCar
• easier yet: Node SDK for Dapr
• Leverage Dapr and its building blocks for
• simple state management
• simple publication of messages
• subscription to incoming messages
• retrieving secrets
• retrieving configuration data
• invoking external services (database, message broker, store, API)
• register as listener to inbound requests and messages for external
services
• decoupled interaction between microservices – implemented in
potentially very different languages
Microservices in real life – with Node & Dapr.io
components.yaml
sidecar (the personal assistant)
Node SDK
for Dapr
Observability
Prometheus AppInsights Jaeger
Zipkin
Bindings
& Triggers
GCP
Storage
AWS
S3 Kafka
Azure
Storage Twilio
State
Stores
Firebase Cassandra
Redis
Azure
CosmosDB
AWS
DynamoDB
Secret
Stores
AWS
Secrets Manager
Azure
KeyVault
GCP
Secret Manager
HashiCorp
Vault
Kubernetes
Secret
PubSub
Brokers
Redis
AWS
SQS
Azure
Service Bus
RabbitMQ
GCP
Pub/Sub
Classificatie: Public
Publiek
State Management with Dapr from Node application
Microservices in real life – with Node & Dapr.io
sidecar (the personal assistant)
Node SDK
for Dapr
State Store
components
set & get state
components.yaml
State
Stores
state store
interface
Classificatie: Public
Publiek
State Management with Dapr from Node application
Microservices in real life – with Node & Dapr.io
sidecar (the personal assistant)
Node SDK
for Dapr
State Store
components
set & get state
components.yaml
State
Stores
state store
interface
connect to
sidecar
retrieve
state
setstate
Classificatie: Public
Publiek
State Management with Dapr from Node application -
switch to MySQL state store with configuration change
Microservices in real life – with Node & Dapr.io
sidecar (the personal assistant)
Node SDK
for Dapr
State Store
components
set & get state
components.yaml
State
Stores
state store
interface
connect to
sidecar
retrieve
state
setstate
Classificatie: Public
Publiek
State Management with Dapr from any application
- either through SDK or using HTTP or gRPC
Microservices in real life – with Node & Dapr.io
sidecar (the personal assistant)
SDK for
Dapr
State Store
components
set & get state
components.yaml
State
Stores
state store
interface
Classificatie: Public
Publiek
Pub/Sub with Dapr from Node applications
Microservices in real life – with Node & Dapr.io
sidecar (the personal assistant)
Node SDK
for Dapr
Pub/Sub
components
publish message
components.yaml
PubSub
Brokers
pub/sub
interface
Node SDK
for Dapr
components.yaml
subscribe on topic
with handler function
message sent to handler
Classificatie: Public
Publiek
Pub/Sub with Dapr from Node applications
Microservices in real life – with Node & Dapr.io
sidecar (the personal assistant)
Node SDK
for Dapr
Pub/Sub
components
publish message
components.yaml
PubSub
Brokers
Node SDK
for Dapr
components.yaml
subscribe on topic
with handler function
message sent to handler
pub/sub
interface
publish
message
Classificatie: Public
Publiek
Pub/Sub with Dapr from Node applications
Microservices in real life – with Node & Dapr.io
sidecar (the personal assistant)
Node SDK
for Dapr
Pub/Sub
components
publish message
ponents.yaml
PubSub
Brokers
Node SDK
for Dapr
components.yaml
pub/sub
interface
subscribe
on topic
message sent
to handler
Classificatie: Public
Publiek
Asynchronous Interaction between Microservices
Microservices in real life – with Node & Dapr.io
Front App
http
State
Stores
PubSub
Brokers
Node App
get get & set
publish
subscribe
consume
name = John
Classificatie: Public
Publiek
Telemetry Observation in Zipkin
Microservices in real life – with Node & Dapr.io
greeter
http
State
Stores
PubSub
Brokers
name-processor
get get & set
publish
subscribe
consume
name = John
Telemetry
Data
Classificatie: Public
Publiek
Telemetry Observation in Zipkin
Microservices in real life – with Node & Dapr.io
Telemetry
Data
Front App
http
State
Stores
PubSub
Brokers
Node App
get get & set
publish
subscribe
consume
name = John
Classificatie: Public
Publiek
Handson Lab 2
• Install Node (and npm) runtime
• Explore Node
• hello world
• functions
• asynchronous
• http server
• Explore Node and Dapr
• add state management to Node application – through Dapr sidecar
• implement pub/sub for Node applications – through Dapr sidecar
• realize asynchronous communication between Node based microservices
through Daprized pub/sub
• Explore Telemetry for asynchronous interactions
Microservices in real life – with Node & Dapr.io
labs: https://github.com/lucasjellema/fontys-2022-microservices-kafka-dapr
Classificatie: Public
Publiek
Microservices in real life – with Node & Dapr.io
State
Stores
app.js
get & set
Node SDK
for Dapr
components.yaml
dapr_host,
dapr_http_port
app_port
key value
John
Monty
3
2
name,
instance count
Default, out
of the box
?name=John
Handson Lab 2
Classificatie: vertrouwelijk
Microservices in
real life –
with Node &
Dapr.io &
30 March 2022
Lucas Jellema
Architect & CTO AMIS | Conclusion
Next Week:
Apache Kafka

More Related Content

What's hot (20)

PDF
왜 쿠버네티스는 systemd로 cgroup을 관리하려고 할까요
Jo Hoon
 
PPTX
What's New in API Connect & DataPower Gateway in 1H 2018
IBM API Connect
 
PPT
Monitoring using Prometheus and Grafana
Arvind Kumar G.S
 
PPTX
Kubernetes CI/CD with Helm
Adnan Abdulhussein
 
PPSX
Microservices Docker Kubernetes Istio Kanban DevOps SRE
Araf Karsh Hamid
 
PDF
OpenShift Overview
roundman
 
PDF
Kubernetes architecture
Janakiram MSV
 
PDF
Docker & kubernetes
NexThoughts Technologies
 
PPTX
Getting started with Docker
Ravindu Fernando
 
PDF
Introduction to Red Hat OpenShift 4
HngNguyn748044
 
PDF
Ansible - Introduction
Stephane Manciot
 
PPSX
Event Sourcing & CQRS, Kafka, Rabbit MQ
Araf Karsh Hamid
 
PPTX
Kafka Tutorial - Introduction to Apache Kafka (Part 1)
Jean-Paul Azar
 
PDF
Support distributed computing and caching avec hazelcast
ENSET, Université Hassan II Casablanca
 
PPTX
Introduction to microservices
Anil Allewar
 
PDF
Understanding MicroSERVICE Architecture with Java & Spring Boot
Kashif Ali Siddiqui
 
PPTX
Introduction à spring boot
Antoine Rey
 
PDF
Designing a complete ci cd pipeline using argo events, workflow and cd products
Julian Mazzitelli
 
PPTX
Continuous Delivery with Jenkins
Jadson Santos
 
PDF
컨테이너 (PaaS) 환경으로의 애플리케이션 전환 방법과 고려사항
Opennaru, inc.
 
왜 쿠버네티스는 systemd로 cgroup을 관리하려고 할까요
Jo Hoon
 
What's New in API Connect & DataPower Gateway in 1H 2018
IBM API Connect
 
Monitoring using Prometheus and Grafana
Arvind Kumar G.S
 
Kubernetes CI/CD with Helm
Adnan Abdulhussein
 
Microservices Docker Kubernetes Istio Kanban DevOps SRE
Araf Karsh Hamid
 
OpenShift Overview
roundman
 
Kubernetes architecture
Janakiram MSV
 
Docker & kubernetes
NexThoughts Technologies
 
Getting started with Docker
Ravindu Fernando
 
Introduction to Red Hat OpenShift 4
HngNguyn748044
 
Ansible - Introduction
Stephane Manciot
 
Event Sourcing & CQRS, Kafka, Rabbit MQ
Araf Karsh Hamid
 
Kafka Tutorial - Introduction to Apache Kafka (Part 1)
Jean-Paul Azar
 
Support distributed computing and caching avec hazelcast
ENSET, Université Hassan II Casablanca
 
Introduction to microservices
Anil Allewar
 
Understanding MicroSERVICE Architecture with Java & Spring Boot
Kashif Ali Siddiqui
 
Introduction à spring boot
Antoine Rey
 
Designing a complete ci cd pipeline using argo events, workflow and cd products
Julian Mazzitelli
 
Continuous Delivery with Jenkins
Jadson Santos
 
컨테이너 (PaaS) 환경으로의 애플리케이션 전환 방법과 고려사항
Opennaru, inc.
 

Similar to Microservices, Node, Dapr and more - Part One (Fontys Hogeschool, Spring 2022) (20)

PDF
APIDays 2018 - APIOps & Microservices - What is MICRO by the Way ?
FABERNOVEL TECHNOLOGIES
 
PDF
Microservice Best Practices The 8020 Way.pdf
Simform
 
PDF
CWIN17 Utrecht / cg u services - frank van der wal
Capgemini
 
PDF
Microservices Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
PDF
MongoUK 2012
Monica Wilkinson
 
PDF
3298 microservices and how they relate to esb api and messaging - inter con...
Kim Clark
 
PDF
Building Microservices Software practics
muhammed84essa
 
PDF
Microservice - Intro and Discussion
SagarDevkota8
 
PPT
Webinar_102317_Heffner.ppt
ssuserc04f7b
 
PPTX
Best Practices Building Cloud Scale Apps with Microservices
Jim (张建军) Zhang
 
PDF
#ATAGTR2020 Presentation - Microservices – Explored
Agile Testing Alliance
 
PDF
Production-Ready_Microservices_excerpt.pdf
ajcob123
 
PDF
Microservices Examples.pdf
Simform
 
PDF
Everything you want to know about microservices
Youness Lasmak
 
PDF
PDF Microservices for the Enterprise 1st Edition Prabath Siriwardena download
boykeyyateem95
 
PDF
Building Fintech with Microservices and Kubernetes @ API World 2018
Irakli Nadareishvili
 
PPTX
Microservices-101
Subhashish Bhattacharjee
 
PDF
Microservices - Yet another buzzword
Ovidiu Dimulescu
 
PDF
A Gentle introduction to microservices
Gianluca Padovani
 
PPTX
Dapr: the glue to your microservices
Moaid Hathot
 
APIDays 2018 - APIOps & Microservices - What is MICRO by the Way ?
FABERNOVEL TECHNOLOGIES
 
Microservice Best Practices The 8020 Way.pdf
Simform
 
CWIN17 Utrecht / cg u services - frank van der wal
Capgemini
 
Microservices Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
MongoUK 2012
Monica Wilkinson
 
3298 microservices and how they relate to esb api and messaging - inter con...
Kim Clark
 
Building Microservices Software practics
muhammed84essa
 
Microservice - Intro and Discussion
SagarDevkota8
 
Webinar_102317_Heffner.ppt
ssuserc04f7b
 
Best Practices Building Cloud Scale Apps with Microservices
Jim (张建军) Zhang
 
#ATAGTR2020 Presentation - Microservices – Explored
Agile Testing Alliance
 
Production-Ready_Microservices_excerpt.pdf
ajcob123
 
Microservices Examples.pdf
Simform
 
Everything you want to know about microservices
Youness Lasmak
 
PDF Microservices for the Enterprise 1st Edition Prabath Siriwardena download
boykeyyateem95
 
Building Fintech with Microservices and Kubernetes @ API World 2018
Irakli Nadareishvili
 
Microservices-101
Subhashish Bhattacharjee
 
Microservices - Yet another buzzword
Ovidiu Dimulescu
 
A Gentle introduction to microservices
Gianluca Padovani
 
Dapr: the glue to your microservices
Moaid Hathot
 
Ad

More from Lucas Jellema (20)

PPTX
Introduction to web application development with Vue (for absolute beginners)...
Lucas Jellema
 
PPTX
Making the Shift Left - Bringing Ops to Dev before bringing applications to p...
Lucas Jellema
 
PPTX
Lightweight coding in powerful Cloud Development Environments (DigitalXchange...
Lucas Jellema
 
PPTX
Apache Superset - open source data exploration and visualization (Conclusion ...
Lucas Jellema
 
PPTX
CONNECTING THE REAL WORLD TO ENTERPRISE IT – HOW IoT DRIVES OUR ENERGY TRANSI...
Lucas Jellema
 
PPTX
Help me move away from Oracle - or not?! (Oracle Community Tour EMEA - LVOUG...
Lucas Jellema
 
PPTX
Op je vingers tellen... tot 1000!
Lucas Jellema
 
PPTX
IoT - from prototype to enterprise platform (DigitalXchange 2022)
Lucas Jellema
 
PPTX
Who Wants to Become an IT Architect-A Look at the Bigger Picture - DigitalXch...
Lucas Jellema
 
PPTX
Steampipe - use SQL to retrieve data from cloud, platforms and files (Code Ca...
Lucas Jellema
 
PPTX
Automation of Software Engineering with OCI DevOps Build and Deployment Pipel...
Lucas Jellema
 
PPTX
Introducing Dapr.io - the open source personal assistant to microservices and...
Lucas Jellema
 
PPTX
How and Why you can and should Participate in Open Source Projects (AMIS, Sof...
Lucas Jellema
 
PPTX
6Reinventing Oracle Systems in a Cloudy World (RMOUG Trainingdays, February 2...
Lucas Jellema
 
PPTX
Help me move away from Oracle! (RMOUG Training Days 2022, February 2022)
Lucas Jellema
 
PPTX
Tech Talks 101 - DevOps (jan 2022)
Lucas Jellema
 
PPTX
Conclusion Code Cafe - Microcks for Mocking and Testing Async APIs (January 2...
Lucas Jellema
 
PPTX
Cloud Native Application Development - build fast, low TCO, scalable & agile ...
Lucas Jellema
 
PPTX
Software Engineering as the Next Level Up from Programming (Oracle Groundbrea...
Lucas Jellema
 
PPTX
Triple C - Centralize, Cloudify and Consolidate Dozens of Oracle Databases (O...
Lucas Jellema
 
Introduction to web application development with Vue (for absolute beginners)...
Lucas Jellema
 
Making the Shift Left - Bringing Ops to Dev before bringing applications to p...
Lucas Jellema
 
Lightweight coding in powerful Cloud Development Environments (DigitalXchange...
Lucas Jellema
 
Apache Superset - open source data exploration and visualization (Conclusion ...
Lucas Jellema
 
CONNECTING THE REAL WORLD TO ENTERPRISE IT – HOW IoT DRIVES OUR ENERGY TRANSI...
Lucas Jellema
 
Help me move away from Oracle - or not?! (Oracle Community Tour EMEA - LVOUG...
Lucas Jellema
 
Op je vingers tellen... tot 1000!
Lucas Jellema
 
IoT - from prototype to enterprise platform (DigitalXchange 2022)
Lucas Jellema
 
Who Wants to Become an IT Architect-A Look at the Bigger Picture - DigitalXch...
Lucas Jellema
 
Steampipe - use SQL to retrieve data from cloud, platforms and files (Code Ca...
Lucas Jellema
 
Automation of Software Engineering with OCI DevOps Build and Deployment Pipel...
Lucas Jellema
 
Introducing Dapr.io - the open source personal assistant to microservices and...
Lucas Jellema
 
How and Why you can and should Participate in Open Source Projects (AMIS, Sof...
Lucas Jellema
 
6Reinventing Oracle Systems in a Cloudy World (RMOUG Trainingdays, February 2...
Lucas Jellema
 
Help me move away from Oracle! (RMOUG Training Days 2022, February 2022)
Lucas Jellema
 
Tech Talks 101 - DevOps (jan 2022)
Lucas Jellema
 
Conclusion Code Cafe - Microcks for Mocking and Testing Async APIs (January 2...
Lucas Jellema
 
Cloud Native Application Development - build fast, low TCO, scalable & agile ...
Lucas Jellema
 
Software Engineering as the Next Level Up from Programming (Oracle Groundbrea...
Lucas Jellema
 
Triple C - Centralize, Cloudify and Consolidate Dozens of Oracle Databases (O...
Lucas Jellema
 
Ad

Recently uploaded (20)

PPTX
Tally software_Introduction_Presentation
AditiBansal54083
 
PPTX
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
PPTX
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
PDF
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
PDF
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
PDF
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
PDF
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
PPTX
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
PDF
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
PDF
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
PDF
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 
PPTX
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
PDF
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
PDF
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
PDF
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
PPTX
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
PDF
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
PDF
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
PDF
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
Tally software_Introduction_Presentation
AditiBansal54083
 
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 

Microservices, Node, Dapr and more - Part One (Fontys Hogeschool, Spring 2022)

  • 1. Classificatie: vertrouwelijk Microservices in real life – with Node & Dapr.io March 2022 Lucas Jellema Architect & CTO AMIS | Conclusion labs: https://github.com/lucasjellema/fontys-2022-microservices-kafka-dapr
  • 2. Classificatie: vertrouwelijk Microservices in real life – with Node & Dapr.io Founded in 1991 by students from University of Twente – Aircraft Maintenance Information System (AMIS) 80 colleagues, located in Nieuwegein the core of what we do: working with Data. partnering with peers and companies in several countries Lucas Jellema (2002) Cloud Solution Architect & CTO [email protected] | technology.amis.nl | @lucasjellema | lucas-jellema
  • 3. Classificatie: vertrouwelijk Microservices in real life – with Node & Dapr.io Data Engineering, Data Analytics (& Data Science) Data & Application Integration web applications Internet of Things cloud, DevOps, PaaS, streaming, microservices, Software Studio, database, software engineering Oracle, Microsoft Azure, open source, Java, SQL, NodeJS, Python, React/Angular
  • 4. Classificatie: vertrouwelijk Microservices in real life – with Node & Dapr.io
  • 5. Classificatie: vertrouwelijk Microservices in real life – with Node & Dapr.io
  • 6. Classificatie: vertrouwelijk Microservices in real life – with Node & Dapr.io
  • 7. Classificatie: vertrouwelijk Microservices in real life – with Node & Dapr.io
  • 8. Classificatie: vertrouwelijk Microservices in real life – with Node & Dapr.io and you are invited to come do an internship and explore job opportunities with us!
  • 9. Classificatie: Public Publiek Moving On. Our Main Story today (and next week) • Applications • more specifically: Microservices – the best form of applications we have come up with so far • How they are designed • How they interact • How they can be implemented • Using: • Dapr.io – distributed application runtime • Node – popular, full stack, omnipresent programming language • Apache Kafka – distributed message broker, enterprise backbone Microservices in real life – with Node & Dapr.io
  • 10. Classificatie: Public Publiek Overview • Part One (today) • Microservices recap • Dapr.io – personal assistant for applications & distributed application runtime • Handson with Dapr.io • Quick Intro to programming in Node[.js] • Handson Microservice implementation with Node and Dapr.io • Part Two (next week, 30 March) • Asynchronous interactions through Apache Kafka • Handson with Apache Kafka and Node • Real world use cases and scenarios with Apache Kafka • Handson Multi-microservice set up with Apache Kafka, Node and Dapr.io Microservices in real life – with Node & Dapr.io
  • 11. Classificatie: Public Publiek Assumed is • A development environment with VS Code, Docker and the ability to install • Knowledge of • HTTP, REST, JSON • Containers, Docker (and Kubernetes) • Java or C# • SQL and a database (MySQL or PostgreSQL or SQL Server) • perhaps Message Broker/Event Queue (RabbitMQ?), Cache (Redis?) • Cloud fundamentals • Microservices concepts Microservices in real life – with Node & Dapr.io
  • 12. Classificatie: Public Publiek What is an Application? • Collection of (business) functionality • implemented with COTS, code, platform & infra Microservices in real life – with Node & Dapr.io standard custom Compute (Containers, VMs, bare metal servers) Storage Network Database IAM/ LDAP Event / Message Broker Web Server API Gateway Data Center Power Cooling Custom hardware Custom platform Operating System Language Runtime use as is out of the box (pre-)integrated application platform, to be custom configured best of breed applications per functional domain. (custom integration) low code tools for workflow, automation, integration en frontends high code technology for bit & pixel perfect software with tailored fit (functionally & non- functionally)
  • 13. Classificatie: Public Publiek What is a microservice? • Why is a microservice? • Problems with (BIG) applications • complex • inflexible to change (when roll out changes) • long test, long build • impossible to upgrade technology (everything is affected) • hard to scale • hard to migrate (to different technology) • hard to learn (for new staff) Microservices in real life – with Node & Dapr.io
  • 14. Classificatie: Public Publiek Final Demo • Microservice Microservices in real life – with Node & Dapr.io
  • 15. Classificatie: Public Publiek What is a microservice? • Not TOO big (but not too small either) • understandable by normal human beings – easy to on board new team members • easy to change – allow for agile functional and non functional evolution • functionally cohesive/logical collection of features => domain • design time decoupled, clear standards based external interfaces: API & events • low external impact of: change, refactor, move, migrate, scale, failure • reliable, robust, resilient • clear ownership (business sponsor; one IT team builds it, runs it, evolves it) • contains everything needed to run [on a generic platform] • application software, libraries/frameworks, platform configuration • pipelines for CI and CD, tests, documentation, infra as code Microservices in real life – with Node & Dapr.io
  • 16. Classificatie: Public Publiek What is IT all about? Application Production Runtime Microservices in real life – with Node & Dapr.io
  • 17. Classificatie: Public Publiek What is IT all about? Application Production Runtime Platform Microservices in real life – with Node & Dapr.io Business value
  • 18. Classificatie: Public Publiek What is IT all about? Application Platform Production Runtime Operations Monitoring & Management Platform Platform Microservices in real life – with Node & Dapr.io
  • 19. Classificatie: Public Publiek Production Runtime is the Result of Preparation Runtime Application Platform Production Runtime Operations Monitoring & Management Application Preparation Runtime Platform Development CD Agile Design, Build, Test Microservices in real life – with Node & Dapr.io
  • 20. Classificatie: Public Publiek One team has Agile responsibility through full lifecyle Application Platform Production Runtime Operations Monitoring & Management Application Preparation Runtime Platform Development CD Agile Design, Build, Test Microservices in real life – with Node & Dapr.io
  • 21. Classificatie: Public Publiek One team has Agile responsibility through full lifecyle Application Platform Production Runtime Operations Monitoring & Management Application Preparation Runtime Platform Development CD Agile Design, Build, Test Microservices in real life – with Node & Dapr.io
  • 22. Classificatie: Public Publiek One team has Agile responsibility through full lifecyle Application Platform Application Platform Microservices in real life – with Node & Dapr.io
  • 23. Classificatie: Public Publiek A microservice is owned by one team through its full lifecyle Microservice Microservices in real life – with Node & Dapr.io
  • 24. Classificatie: Public Publiek The Microservice API HTTP REST/JSON Microservices in real life – with Node & Dapr.io µ
  • 25. Classificatie: Public Publiek Independent microservices and an integrated front end Microservices in real life – with Node & Dapr.io
  • 26. Classificatie: Public Publiek Independent microservices and an integrated front end Microservices in real life – with Node & Dapr.io microservice / team
  • 27. Classificatie: Public Publiek The Microservices Platform Microservices in real life – with Node & Dapr.io Runtime Platform API µ API µ API µ API µ
  • 28. Classificatie: Public Publiek The Microservices Platform Cloud Native Application Development- on Oracle Cloud | APAC OGB Tour 2021 power cooling rack space physical real estate IAM Certificate Management Vulnerability Scanning Logging Monitoring Auditing Cloud Usage Analysis Resource Manager APIs Cloud Events Notifications Cloud Guard Tagging Search Serverless Functions Container engine API Gateway Load Balancer Container Registry Artifact Repository Job Scheduling Build & Deploy Pipelines Code Repository Web Application Firewall CDN Virtual Machines API µ
  • 29. Classificatie: Public Publiek The Microservices Platform Cloud Native Application Development- on Oracle Cloud | APAC OGB Tour 2021 power cooling rack space physical real estate IAM Certificate Management Vulnerability Scanning Logging Monitoring Auditing Cloud Usage Analysis Resource Manager APIs Cloud Events Notifications Cloud Guard Tagging Search SQL Database Serverless Functions Container engine Vault API Gateway Load Balancer Message/ Event Broker Data Lake Container Registry Artifact Repository Job Scheduling Build & Deploy Pipelines NoSQL Database Data Cache Code Repository Web Application Firewall CDN Virtual Machines File Storage API µ
  • 30. Classificatie: Public Publiek The Microservices Platform Cloud Native Application Development- on Oracle Cloud | APAC OGB Tour 2021 power cooling rack space physical real estate IAM Certificate Management Vulnerability Scanning Logging Monitoring Auditing Cloud Usage Analysis Resource Manager APIs Cloud Events Notifications Cloud Guard Tagging Search SQL Database Serverless Functions Container engine Vault API Gateway Load Balancer Message/ Event Broker Data Lake Container Registry Artifact Repository Job Scheduling Build & Deploy Pipelines NoSQL Database Data Cache Code Repository Web Application Firewall CDN Virtual Machines File Storage API µ Zipin
  • 31. Classificatie: Public Publiek What do most microservices do? • Store and retrieve state • Read runtime secrets and configuration values • Publish “observability data” • Subscribe to event topic and handle incoming events • Publish events to event topic • Interact with other microservices • Invoke external services • Run microservice specific business logic Microservices in real life – with Node & Dapr.io This requires quite a bit of repetitive “plumbing” tied to specific technologies – not meaningful effort [from a business functionality perspective]
  • 33. Classificatie: Public Publiek Dapr • Runtime • Personal Assistant for Applications and Microservices • Distributed Application Runtime • Microservice architecture • Decoupling Microservices in real life – with Node & Dapr.io
  • 34. Classificatie: Public Publiek Dapr.io • Launched by Microsoft (2019) • Application runtime framework – supporting cloud native and serverless • Every application gets a uniform Personal Assistant that takes care of common tasks • remember (take note and reproduce) • keep log • restrict access • handle incoming • route outgoing • interact with other PAs (and their apps) Microservices in real life – with Node & Dapr.io Application Microservice or Monolith Personal Assistant (Dapr) Personal Assistant (Dapr) Personal Assistant (Dapr) Personal Assistant (Dapr) Personal Assistant (Dapr) Personal Assistant (Dapr)
  • 35. Classificatie: Public Publiek Dapr.io • Personal Assistant is Dapr Side Car • companion process or side car container in Kubernetes Pod Microservices in real life – with Node & Dapr.io My App Dapr API HTTP/gRPC Application Dapr sidecar
  • 36. Classificatie: Public Publiek key value myApp-weapon "DeathStar" State management My App POST http://localhost:3500/v1.0/state/corpdb [{ "key": "weapon", "value": "DeathStar" }] Redis Cache
  • 37. Classificatie: Public Publiek State management My App key value myApp-weapon "DeathStar" Redis Cache GET http://localhost:3500/v1.0/state/corpdb/planet "DeathStar"
  • 38. Classificatie: Public Publiek State management My App key value myApp-weapon "DeathStar" Azure CosmosDB GET http://localhost:3500/v1.0/state/corpdb/planet "DeathStar"
  • 39. Classificatie: Public Publiek Dapr state API Save state POST /v1.0/state/corpdb Retrieve state GET /v1.0/state/corpdb/mystate Delete state DELETE /v1.0/state/corpdb/mystate Get bulk state POST /v1.0/state/corpdb/bulk Submit multiple state transactions POST /v1.0/state/corpdb/transaction corpdb-redis.yaml apiVersion: dapr.io/v1alpha1 kind: Component metadata: name: corpdb spec: type: state.redis version: v1 metadata: - name: redisHost value: redis-master.default.svc.cluster.local:6379 - name: redisPassword secretKeyRef: name: redis-secret key: redis-password
  • 40. Classificatie: Public Publiek Dapr state API Save state POST /v1.0/state/corpdb Retrieve state GET /v1.0/state/corpdb/mystate Delete state DELETE /v1.0/state/corpdb/mystate Get bulk state POST /v1.0/state/corpdb/bulk Submit multiple state transactions POST /v1.0/state/corpdb/transaction corpdb-cosmosdb.yaml apiVersion: dapr.io/v1alpha1 kind: Component metadata: name: corpdb spec: type: state.azure.cosmosdb version: v1 metadata: - name: url value: corpdb.documents.azure.com - name: masterKey secretKeyRef: name: master-key key: cosmos-key - name: database value: orders - name: collection value: processed
  • 41. Classificatie: Public Publiek HTTP API gRPC API Microservice building blocks Service- to-service invocation State management Publish and subscribe Resource bindings and triggers Actors Observability Secrets Extensible
  • 42. Classificatie: Public Publiek Standard APIs accessed over http/gRPC protocols from user service code Runs as local “side car library” dynamically loaded at runtime for each service HTTP API gRPC API Any language and framework Application code Microservices written in Any code or framework… Service- to-service invocation State management Publish and subscribe Resource bindings and triggers Actors Observability Secrets Extensible
  • 43. Classificatie: Public Publiek HTTP API gRPC API Any cloud or edge infrastructure Application code Microservices written in Any code or framework… Service- to-service invocation State management Publish and subscribe Resource bindings and triggers Actors Observability Secrets Extensible Hosting infrastructure On-Premises Azure Arc
  • 44. Classificatie: Public Publiek Service invocation Service A My App mDNS Multicast DNS component for service discovery mTLS encryption POST http://localhost:3500/v1.0/invoke/servicea/method/neworder {"data":"Hello World"} POST http://10.0.0.2:8000/neworder {"data":"Hello World"}
  • 45. Classificatie: Public Publiek Publish and subscribe Service B My App Redis Cache Service A POST http://localhost:3500/v1.0/publish/orders/processed {"data":"Hello World"} POST http://10.0.0.2:8000/orders http://10.0.0.4:8000/factory/orders {"data":"Hello World"}
  • 46. Classificatie: Public Publiek Input triggers My App Twitter POST http://10.0.0.2:8000/newtweet {"data":“📢 We are excited to announce the …"}
  • 47. Classificatie: Public Publiek Output bindings My App Twilio POST http://localhost:3500/v1.0/bindings/twilio {"data":"Hello World"} Hello World
  • 49. Classificatie: Public Publiek Observability OpenTelemetry collector Logging & tracing extensions My App Redis Cache Twitter Service B Service A
  • 50. Classificatie: Public Publiek Dapr hosting environments • Get started with dapr init -k • Fully managed Dapr control plane • Deploys dashboard, placement, operator, sentry, and injector pods • Automatically inject Dapr sidecar into all annotated pods • Upgrade with dapr upgrade or Helm • Get started with dapr init • Easy setup with Docker images • Sets up placement, Zipkin, Redis • slim-init available without Docker • Run any application with Dapr sidecar using dapr run Self-hosted
  • 51. Classificatie: Public Publiek Dapr in self-hosted Docker mode Local dev machine or virtual machine Zipkin tracing Zipkin Redis state store Redis My App State Stores PubSub Brokers Secret Stores Bindings & Triggers Observability Dapr Components dapr run myapp Use components Launch application Launch sidecar process Set env variables Save and retrieve state Publish and subscribe to messages Send distributed tracing
  • 52. Classificatie: Public Publiek Hands On Lab 1 In a Linux compatible environment with Docker CLI set up • Download and Install Dapr.io • with out of the box state management and pub/sub based on Redis and telemetry observation by Zipkin • Run Dapr Sidecar • Explore Dapr State Management APIs • from the command line (cURL HTTP calls) • Run MySQL container and have Dapr manage state in a MySQL database • Explore Dapr Telemetry collection and presentation in Zipkin Microservices in real life – with Node & Dapr.io labs: https://github.com/lucasjellema/fontys-2022-microservices-kafka-dapr
  • 53. Classificatie: Public Publiek Dapr in self-hosted Docker mode – add MySQL Database Local dev machine or virtual machine Zipkin tracing Zipkin MySQL database Redis state store Redis myotherapp daprdapr run --app-id myotherapp --dapr-http-port 3510 --components-path . Launch application Launch sidecar process Set env variables Save and retrieve state mysql-statestore.yaml
  • 55. Classificatie: Public Publiek General Purpose Programming Languages • C & C++ • COBOL, Fortran, ALGOL, BASIC, Pascal • SmallTalk • Visual Basic • Python • PHP, Perl, Ruby • Java • JavaScript (ECMAScript, ES) • C# • Go • Kotlin • Rust Microservices in real life – with Node & Dapr.io
  • 56. Classificatie: Public Publiek Node == Server Side JavaScript • Script: Not statically typed, not compiled – interpreted at runtime • Node(JS) – open source, runtime based on Chrome V8 JavaScript engine • initial release: 2009 • Full stack development – server side and client side can leverage JavaScript • for example: MEAN stack (MongoDB, Express, Angular, NodeJS) • Light weight, quick startup, support for high concurrency • Skills widely available, many resources, tools and libraries • Easy to get started, quite high productivity and fun factor • Functions are primary citizens – functional programming well supported • Quite suitable for microservices – including containerized and serverless • Available everywhere – cross platform, all public clouds • Note: TypeScript compiles to Node that is interpreted at runtime Microservices in real life – with Node & Dapr.io
  • 57. Classificatie: Public Publiek Introducing Node – Single Thread model • Multi-thread languages – such as Java – typically block when file system or network operations take place • Parallel processing continues in parallel threads • Threads consume resources and are only somewhat scalable • JavaScript has a main (single thread) event loop and uses asynchronous processing • Non-blocking handling of file system interactions, HTTP calls, network operations and other blocking actions • Scalable, very quick startup Microservices in real life – with Node & Dapr.io
  • 58. Classificatie: Public Publiek Introducing Node - NPM • NPM = Node Package Manager • To include libraries from the ecosystem • Leverages npm registry (> 1.3M NPM Modules available) • Acquired by Microsoft – March 2020 • To build and run Node applications • similar to Maven & Gradle (Java) or pip (Python) • Yarn and Turbo are popular alternatives Microservices in real life – with Node & Dapr.io
  • 59. Classificatie: Public Publiek Hello World in Node • app.js • with the code to execute • (optional) package.json • with NPM dependencies, build and run configuration (compare Maven pom.xml) • Create Node application: • npm init (optional, you can just create a text file by hand instead) • Run Node application • node app.js • npm start • Add dependencies • npm install <name of module> --save Microservices in real life – with Node & Dapr.io
  • 60. Classificatie: Public Publiek Functions • Functions • have a name • take zero, one or multiple untyped input parameters • return zero or one untyped result • or an exception instead of a result Microservices in real life – with Node & Dapr.io
  • 61. Classificatie: Public Publiek Functions • Function references • can be assigned to a variable • can be passed around • can be invoked • Note: function name without parentheses is not a call to the function but a reference • print vs print() Microservices in real life – with Node & Dapr.io
  • 62. Classificatie: Public Publiek Functions • Function references can be closures – function + state • closures contain values of local context at the time of instantiation Microservices in real life – with Node & Dapr.io Hello 1 World 2
  • 63. Classificatie: Public Publiek Require – to import a module • Node contains many out of the box modules • for example: file, os, http, stream, crypto, net, url • The NPM package manager adds more than 1M modules to make us of • You can create your own (reusable) modules • To access elements from a module, that module needs to be identified, using: const <logical name> = require('module name') • Module name can be reference to a local file, to a global module or to the name of a module defined in package.json (and installed in the application’s node-modules directory) Microservices in real life – with Node & Dapr.io
  • 64. Classificatie: Public Publiek Node – Asynchronous calls • JavaScript is single threaded – no parallel threads can be started from your code • Any action in Node that requires network or file system interaction is typically performed asynchronously: • the command is started and handed to the Node background processes; the main thread continues with other work • when the background processes have completed the task, the results are returned to the invoker (when the main thread has an opening) Microservices in real life – with Node & Dapr.io
  • 65. Classificatie: Public Publiek Node – Asynchronous HTTP calls • Many modules are available for HTTP communications from Node • The standard HTTP module is not the most convenient • An HTTP request is processed asynchronously in all cases • main program loop proceeds while request is made Microservices in real life – with Node & Dapr.io asynchronous HTTP request response
  • 66. Classificatie: Public Publiek Asynchronous – waiting for one or more asynchronous results • A function is declared to be asynchronous using the async keyword • The result of an asynchronous function is an object of type Promise • in order to get the actual value – the Promise must be “resolved” • this can be waited for using the keyword await • Alternatively – especially when multiple asynchronous results are waited for at the same time – we can use Promise.then( <callback function>) or Promise.all( <callback function>) to wait for Promise results to come available Microservices in real life – with Node & Dapr.io
  • 67. Classificatie: Public Publiek Hello World Web Application • Node is very good at handling HTTP Requests • It is a great technology to implement REST APIs and backends for Web and Mobile applications • fast, scalable, easy to develop and to deploy Microservices in real life – with Node & Dapr.io define the function that handles each HTTP request and prepares the response
  • 68. Classificatie: Public Publiek Dapr and Node Applications • HTTP (or gRPC) with Dapr SideCar • easier yet: Node SDK for Dapr • Leverage Dapr and its building blocks for • simple state management • simple publication of messages • subscription to incoming messages • retrieving secrets • retrieving configuration data • invoking external services (database, message broker, store, API) • register as listener to inbound requests and messages for external services • decoupled interaction between microservices – implemented in potentially very different languages Microservices in real life – with Node & Dapr.io components.yaml sidecar (the personal assistant) Node SDK for Dapr Observability Prometheus AppInsights Jaeger Zipkin Bindings & Triggers GCP Storage AWS S3 Kafka Azure Storage Twilio State Stores Firebase Cassandra Redis Azure CosmosDB AWS DynamoDB Secret Stores AWS Secrets Manager Azure KeyVault GCP Secret Manager HashiCorp Vault Kubernetes Secret PubSub Brokers Redis AWS SQS Azure Service Bus RabbitMQ GCP Pub/Sub
  • 69. Classificatie: Public Publiek State Management with Dapr from Node application Microservices in real life – with Node & Dapr.io sidecar (the personal assistant) Node SDK for Dapr State Store components set & get state components.yaml State Stores state store interface
  • 70. Classificatie: Public Publiek State Management with Dapr from Node application Microservices in real life – with Node & Dapr.io sidecar (the personal assistant) Node SDK for Dapr State Store components set & get state components.yaml State Stores state store interface connect to sidecar retrieve state setstate
  • 71. Classificatie: Public Publiek State Management with Dapr from Node application - switch to MySQL state store with configuration change Microservices in real life – with Node & Dapr.io sidecar (the personal assistant) Node SDK for Dapr State Store components set & get state components.yaml State Stores state store interface connect to sidecar retrieve state setstate
  • 72. Classificatie: Public Publiek State Management with Dapr from any application - either through SDK or using HTTP or gRPC Microservices in real life – with Node & Dapr.io sidecar (the personal assistant) SDK for Dapr State Store components set & get state components.yaml State Stores state store interface
  • 73. Classificatie: Public Publiek Pub/Sub with Dapr from Node applications Microservices in real life – with Node & Dapr.io sidecar (the personal assistant) Node SDK for Dapr Pub/Sub components publish message components.yaml PubSub Brokers pub/sub interface Node SDK for Dapr components.yaml subscribe on topic with handler function message sent to handler
  • 74. Classificatie: Public Publiek Pub/Sub with Dapr from Node applications Microservices in real life – with Node & Dapr.io sidecar (the personal assistant) Node SDK for Dapr Pub/Sub components publish message components.yaml PubSub Brokers Node SDK for Dapr components.yaml subscribe on topic with handler function message sent to handler pub/sub interface publish message
  • 75. Classificatie: Public Publiek Pub/Sub with Dapr from Node applications Microservices in real life – with Node & Dapr.io sidecar (the personal assistant) Node SDK for Dapr Pub/Sub components publish message ponents.yaml PubSub Brokers Node SDK for Dapr components.yaml pub/sub interface subscribe on topic message sent to handler
  • 76. Classificatie: Public Publiek Asynchronous Interaction between Microservices Microservices in real life – with Node & Dapr.io Front App http State Stores PubSub Brokers Node App get get & set publish subscribe consume name = John
  • 77. Classificatie: Public Publiek Telemetry Observation in Zipkin Microservices in real life – with Node & Dapr.io greeter http State Stores PubSub Brokers name-processor get get & set publish subscribe consume name = John Telemetry Data
  • 78. Classificatie: Public Publiek Telemetry Observation in Zipkin Microservices in real life – with Node & Dapr.io Telemetry Data Front App http State Stores PubSub Brokers Node App get get & set publish subscribe consume name = John
  • 79. Classificatie: Public Publiek Handson Lab 2 • Install Node (and npm) runtime • Explore Node • hello world • functions • asynchronous • http server • Explore Node and Dapr • add state management to Node application – through Dapr sidecar • implement pub/sub for Node applications – through Dapr sidecar • realize asynchronous communication between Node based microservices through Daprized pub/sub • Explore Telemetry for asynchronous interactions Microservices in real life – with Node & Dapr.io labs: https://github.com/lucasjellema/fontys-2022-microservices-kafka-dapr
  • 80. Classificatie: Public Publiek Microservices in real life – with Node & Dapr.io State Stores app.js get & set Node SDK for Dapr components.yaml dapr_host, dapr_http_port app_port key value John Monty 3 2 name, instance count Default, out of the box ?name=John Handson Lab 2
  • 81. Classificatie: vertrouwelijk Microservices in real life – with Node & Dapr.io & 30 March 2022 Lucas Jellema Architect & CTO AMIS | Conclusion Next Week: Apache Kafka

Editor's Notes

  • #2: Wat is een microservice? (waarom, problemen met monolitische applicaties, hoe microservice architectuur, generieke voorzieningen & platform voor microservices, data & events als glue tussen microservices) Hier alvast stilstaan bij het belang van een event broker en een korte intro van Kafka (meer in college 2) Implementatie van microservices: afhandelen van http requests, consumeren en publiceren van events, doen van http calls:  wat zijn activiteiten die iedere microservice moet uitvoeren? (state mgt, pub/sub, secrets, config mgt, aanroepen 3rd party (cloud) services, ..) Introductie en demo van Dapr.io framework – de personal assistant die iedere applicatie eenvoudig laat aansluiten op generieke voorzieningen én die applicaties (microservices) met elkaar laat interacteren op ontkoppelde wijze; note: ik zal wijzen op de ondersteuning in Dapr.io voor diverse technologieën zoals RabbitMQ, MySQL, Redis Handson met Dapr – meegeleverde applicaties in Java en C# Zelf implementeren van microservice – introductie van NodeJS ; Handson: afbouwen eenvoudige services in NodeJs en via Dapr.io interactie met elkaar en met generieke voorzieningen
  • #54: https://github.com/lucasjellema/fontys-2022-microservices-kafka-dapr
  • #57: Implementatie van microservices: afhandelen van http requests, consumeren en publiceren van events, doen van http calls: wat zijn activiteiten die iedere microservice moet uitvoeren? (state mgt, pub/sub, secrets, config mgt, aanroepen 3rd party (cloud) services, ..) Introductie en demo van Dapr.io framework – de personal assistant die iedere applicatie eenvoudig laat aansluiten op generieke voorzieningen én die applicaties (microservices) met elkaar laat interacteren op ontkoppelde wijze; note: ik zal wijzen op de ondersteuning in Dapr.io voor diverse technologieën zoals RabbitMQ, MySQL, Redis Handson met Dapr – meegeleverde applicaties in Java en C# Zelf implementeren van microservice – introductie van NodeJS ; Handson: afbouwen eenvoudige services in NodeJs en via Dapr.io interactie met elkaar en met generieke voorzieningen     College 2 – Kafka als backbone van microservice gebaseerde applicaties, containers & Kubernetes als deployment vehikel en runtime platform Korte recap – microservices, API & Events, Dapr.io , Kafka; Intro & Demo van Kafka en plek van Kafka in microservices architecture (en gebruik van Kafka bij grote organisaties) Handson: interactie met Kafka vanuit eenvoudige NodeJS applicatie Handson: interactie tussen NodeJS applicaties via Kafka Kafka via Dapr.io Handson: microservice pub/sub interactie via Dapr.io sidecar en Kafka; wissel Kafka en Redis base pub/sub (dit kan met NodeJS maar ook met Java of C#) Handson: microservice binding interactie via Dapr.io sidecar met externe Kafka broker ; studenten kunnen events met elkaars microservices uitwisselen Intro Kafka Connectors HerIntro Containers & Kubernetes Microservices met Containers op Kubernetes plus plek van Dapr.io Handson: lokaal draaien van Kubernetes (met minikube of k3s), Dapr.io op lokaal cluster Bouw microservice tot Dapr-enabled container en deploy op lokaal cluster; test microservice Voeg tweede microservice toe die met de eerste interactie heeft Bonus: horizontaal schalen van eerste service – load balancing door Dapr in aanroepen naar de twee of meer instanties van de eerste service  
  • #60: http://www.modulecounts.com/
  • #89: Wat is een microservice? (waarom, problemen met monolitische applicaties, hoe microservice architectuur, generieke voorzieningen & platform voor microservices, data & events als glue tussen microservices) Hier alvast stilstaan bij het belang van een event broker en een korte intro van Kafka (meer in college 2) Implementatie van microservices: afhandelen van http requests, consumeren en publiceren van events, doen van http calls:  wat zijn activiteiten die iedere microservice moet uitvoeren? (state mgt, pub/sub, secrets, config mgt, aanroepen 3rd party (cloud) services, ..) Introductie en demo van Dapr.io framework – de personal assistant die iedere applicatie eenvoudig laat aansluiten op generieke voorzieningen én die applicaties (microservices) met elkaar laat interacteren op ontkoppelde wijze; note: ik zal wijzen op de ondersteuning in Dapr.io voor diverse technologieën zoals RabbitMQ, MySQL, Redis Handson met Dapr – meegeleverde applicaties in Java en C# Zelf implementeren van microservice – introductie van NodeJS ; Handson: afbouwen eenvoudige services in NodeJs en via Dapr.io interactie met elkaar en met generieke voorzieningen