SlideShare une entreprise Scribd logo
1  sur  89
msf4j –
Microservices Framework for Java
Workshop
Edgar Silva
edgar @wso2.com
o This workshop is intend to cover how to use the WSO2
Microservices Server for Java – msf4j, we will cover
some basic overview about some concepts, but we
strongly recommend you look for more detailed basics
about Microservices.
o Recommended reading:
o http://nginx.com/blog/introduction-to-microservices/
o https://www.nginx.com/blog/building-microservices-using-an-api-
gateway/
2
3
4
Basics Pre-Reqs
o Java 8
o Maven
o See the MSF4J releases page:
o https://github.com/wso2/msf4j
o Let’s work direct from the source:
o Git pull
o https://github.com/wso2/msf4j
o Or simply download from this url: (easier)
https://github.com/wso2/msf4j/archive/master.zip
5
7
8
o So, cd
<msf4j_HOME>/samples
o Make you sure you could
import the project
hello_world
9
o Go to the dir:
o <msf4j_HOME>/samples/hello_world
o Type:
mvn package
10
o After Maven process
o ( be pacient with downloading  )
o What is happening:
o The pom.xml inside the sample, inherits the dependencies
from the root’s pom.xml, that’s why you don’t need to worry
with this process
o In a few (seconds) you will have a hello_service....jar into
your target folder.
11
12
• Msf4j is booting in my case in about less than 300ms
• In the previous maven process, every dependency from other jars were
included into your helloworld-1.0.0-SNAPSHOT.jar, including the reference
to the Main Java Class.
• Everything you need is ready 
13
package org.wso2.carbon.msf4j.example;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
/**
* Hello service resource class.
*/
@Path("/hello")
public class HelloService {
@GET
@Path("/{name}")
public String hello(@PathParam("name") String name) {
return "Hello " + name;
}
}
}
JAX-RS
Simple class (REST Endpoint
REST Java Method
o The simplest Java Class startup
o See the main method:
14
public class Application {
public static void main(String[] args) {
new MicroservicesRunner()
.deploy(new HelloService())
.start();
}
15
edgar$ curl -v http://localhost:8080/hello/valentina
o Take a look on this:
o http://www.confusedbycode.com/curl/
16
o Thanks @jpviragine for that great tip:
https://github.com/jkbrzt/httpie
o Really great tool, works like cURL, but much better and more user friendly
o Syntax: http <options> service or URL
o But if you prefer to be “roots”, ok, continue if cURL
17
18
public class Application {
public static void main(String[] args) {
new MicroservicesRunner(7888, 8888)
.deploy(new HelloService())
.start();
}
Services exposed through different ports(*)
(*) Default port is 8080 when no ports are specified
19
1. Enter in the
<msf4j_home>/samples/stockquote-service
2. mvn package
3. java -jar target/stockquote-service-1.0.0-
SNAPSHOT.jar
20
o In the console type: (Windows Users
o curl -v http://localhost:8080/stockquote/GOOG
21
o Now we will send a POST message to our Service:
o Please type (or copy and paste) the following command:
o curl -v -X POST -H "Content-Type:application/json" -d
'{"symbol":"BVMF","name":
"Bovespa","last":149.62,"low":150.78,"high":149.18,"createdByHost":"localh
ost"}' http://localhost:8080/stockquote
o This command will save a new Symbol into our Stock Quote Service
22
o You had used:
o Java 8 + maven for building our samples and
exercises
o Executed Microservices with basic jar –jar approach
o You saw how easy you can build REST Services
using Microservices approach
23
24
o Several approaches for a “decoupled SOA”
o In this tutorial we will use the “Container-based
approach”
o Microservices are about:
o Lighter
o Business Need Oriented
o Composable
25
26
Web
Server
ASP.NET ADO.NET
Windows OS
.NET CLR RuntimeFront-Store
HTML
27
Web
Server
Web
Framework
(JSF,
Struts, etc)
Persitence
(JPA,
Hibernate,Sprin
gTemplates)
Any OS
JVM
Other
(JMS, JTA
etc)
App Server
Front-Store
HTML
28
Product Service
get /products
post /products
get /products/{id}
get /products/offset/10/1
CustomerService
get /customers
post /customers
get /customers/{id}
get /customers/export
AddressService
get /address
post /address/{zip}
get /address/geo/{x}/{y}
3Examples
29
Product Service
CustomerService
AddressService
AddressService ProductService
Customer
Service
AddressService Customer Service
SinglePage APP
HTML
FrontStoreService
Delivery Service
o Quick deployments
o You are deploying a loosely-coupled, modular
component only 
o Not a huge EAR with dozens of Jars as you used to do in a
monolithic enterprise App
30
31
Monolithic
Microservices
Reference: http://martinfowler.com/articles/microservices.html#ComponentizationViaServices
32
Paulo Merson https://insights.sei.cmu.edu/saturn/2015/11/defining-microservices.html
Great definition, written by another Brazilian 
From an architecture perspective, the microservice style belongs primarily to
the deployment view.
It dictates that the deployment unit should contain only one service or
just a few cohesive services.
The deployment constraint is the distinguishing factor. As a result,
microservices are easier to deploy, become more scalable, and can be
developed more independently by different teams using different
technologies.
“
o Benefits of using microservices:
o Deployability
o Availability
o Scalability
o Modifiability
o Management
33
Paulo Merson https://insights.sei.cmu.edu/saturn/2015/11/microservices-beyond-the-hype-what-you-gain-and-what-you-lose.html
( Great post )
o I would add:
o Deployability
o Availability (Auto-Scaling via Containers)
o Analytics
o Scalability
o Modifiability
o Management
34
Paulo Merson https://insights.sei.cmu.edu/saturn/2015/11/microservices-beyond-the-hype-what-you-gain-and-what-you-lose.html
35
o Part 2:
We ship in the distro
an example showing how to
run a whole deploy from several
different container machines managed
by Kubernetes.
36
o In your command line, go to your:
<msf4j_home>/samples/petstore
o Enter in deployment folder and execute: run.sh
o That’s all, time to get some juice, it will download everything you need:
o Vagrant
o CoreOS
o Kubernetes
o Docker
37
o https://github.com/wso2/product-
msf4j/tree/master/samples/petstore/deployment/kubernet
es-vagrant-coreos-cluster
o Disclaimer: This tutorial is focused on WSO2 Micro
Services Server – msf4j, and some introduction to the
basics on Kubernetes is strongly recommended before
you move forward on this tutorial.
38
39
This step will get a few minutes, according to your internet and machine,
So get relaxed while you can enjoy some “Matrix-like” in your console
http://thenextweb.com/wp-content/blogs.dir/1/files/2013/11/relax-at-work.jpg
 Double check if your JAVA_HOME is Java 8
 Please , if you are using MacOS, make sure you that you have wget
installed.
 Recommend you use brew install wget
 If you get errors communicating with Kubernetes nodes, please add this
variable before execute run.sh:
 export KUBERNETES_MASTER=http://172.17.8.101:8080
 That will be the default Kubernetes UI Console and API Address
40
41
Our traditional Pet Store Sample
has the following Microservices …
fileserver frontend-admin frontend-user
Pet (store) transactionsecurity
o If you are using VirtualBox as the Hypervisor
(recommended), you will see the following 3
VMs started
42
o Please, execute the command:
o kubectl get pods
o The result must be like this:
43
All the pods, must be
Like this, keep repeating
This process until all get
ready
o Please, execute the command:
o kubectl get pods
o The result must be like this:
44
Troubleshooting:
If your pet-xxx appears
the READY info as 0/1
It might be not initialized
Syncronized with Redis.
To solve that, execute:
./clean.sh and later on
./petstore.sh
o Kubernetes UI
o Nodes
o Services
o Pods
o General Info
o Pet Store Admin (PHP App)
o Pet Store Site (PHP App)
45
http://172.17.8.101:8080/ui
Here is the Kubernetes Admin that you can open in your browser
46
Relationship between the VMs and Kubernetes (Nodes)
47
Here you can see the Ips
Attached to the each Node
48
Viewing the Pods
http://kubernetes.io/v1.0/docs/user-guide/pods.html
49
Viewing the Pods
http://kubernetes.io/v1.0/docs/user-guide/pods.html
50
Viewing the Services
51
Viewing Replication Controllers
In Kubernetes, the base unit of deployment is a pod (intro to pods), which is a
group of containers that work together and therefore are logically grouped. The
replication controller stores a pod template in order to create new pods if
needed.
https://coreos.com/kubernetes/docs/latest/replication-controller.html
52
Your Machine OS
Hypervisor
Kubernetes Cluster-Master
K8S Node 01 K8S Node 02
Pods Pods
Replication Controller
Service
53
Your Machine OS
Hypervisor
Kubernetes Cluster-Master
K8S Node 01 K8S Node 02
Pods Pods
Replication Controller
Service
Browser
54
Your Machine OS
Hypervisor
Kubernetes Cluster-Master
K8S Node 01 K8S Node 02
Pods Pods
Replication Controller
Service
Browser
NGINX
55
Getting Actual pods:
$ kubectl get pods
56
Getting details about some pod, for instance
$ kubectl describe pods store-fe-r43hm
57
Getting details about some pod, for instance
$ kubectl describe pods store-fe-r43hm
Please, note here which is the
Pod internal IP: 10.244.36.23
And in which Node this pod
Is actually running
Important: notice that the pod’s id
will change if you restart your
environment 
In my actual case, my pod is
store-fe-<id>, id= r43m
58
Getting Actual Services:
$ kubectl describe service store-fe
59
Persistence Repository / Services
"Containerized” Microservices based in pure java –jar approach
Client Apps (PHP)
petstore-admin petstore
60
You will need to browse the service: admin-fe
http:// Node Server IP: Node Port
Ex: http://172.17.8.102:30984/
61
admin/admin
fileserver
65
You will need to browse the service: store-fe
http:// Node Server IP: Node Port
Ex: http://172.17.8.102:31466/
Here the Microservices Transaction
Is invoked.
o Executing the petstore sample
o Understanding the basics from Kubernetes and
its concepts, such as pods, services and
Replication Controller.
o Executing the Services and Apps
o Proposed Lab:
o Execute the previous samples from Part1 in
Kubernetes + Docker
69
70
o Please go to : http://wso2.com/products/data-analytics-server/
o Download the product
o Install the product:
1. Unzip
2. That’s all
3. Let’s call your installation destination folder as DAS_HOME from now
on
o MySQL for this sample is also required
71
o Step 1: Configure WSO2 DAS
1. Go to <msf4j_HOME>/analytics/das-setup and execute setup.sh :
1. /setup.sh -d <DAS_HOME> -u admin -p
2. Done, everything will be done by the script!
72
o Step 2: Execute DAS Server
1. Enter in DAS_HOME
2. Make sure that Java 8 is in the path
3. Type sh bin/wso2server.sh
4. Wait until to see a message in the console like this:
5. Open this browser URL, it will let you see the WSO2
Data Analytics Server Console (default user admin
and password admin)
73
74
WSO2 DAS is ready and configured!
o Step 3: (based on
https://github.com/wso2/product-
msf4j/tree/master/samples/metrics)
1. Go to <msf4j_HOME>/samples/metrics
2. Execute mvn clean install
3. Please, export the following system variables:
1. export METRICS_REPORTING_DAS_DATAAGENTCONFIGPATH="data-agent-conf.xml”
2. export HTTP_MONITORING_DAS_DATAAGENTCONFIGPATH="data-agent-conf.xml”
75
4. Execute: $ java -jar target/metrics-*.jar
5. Invoke the following URLs via command line:
o curl -v http://localhost:8080/test/rand/500
o curl -v http://localhost:8080/test/total/10
o curl -v http://localhost:8080/test/echo/test
o curl -v http://localhost:8080/student/910760234V
o curl -v --data
"{'nic':'860766123V','firstName':'Jack','lastName':'Black','age':
29}" -H "Content-Type: application/json"
http://localhost:8080/student
o curl -v http://localhost:8080/student/860766123V
o curl -v http://localhost:8080/student
76
o What is happening:
o Now, after the invocation from cURLs, some
information were sent from WSO2 Microservices
Server to WSO2 Data Analytics Server.
o The Metrics are also present in the command line
where you are running the jar:
77
78
@GET
@Path("/{nic}")
@Produces("application/json")
@Timed
@HTTPMonitoring
public Student getStudent(@PathParam("nic") String nic) {
return students.get(nic);
}
@POST
@Consumes("application/json")
@Metered
@HTTPMonitoring
public void addStudent(Student student) {
students.put(student.getNic(), student);
}
org.wso2.carbon.msf4j.example.service.StudentService.java
80
<Agent>
<Name>Thrift</Name>
<DataEndpointClass>
org.wso2.carbon.databridge.agent.endpoint.thrift.ThriftDataEndpoint
</DataEndpointClass>
<TrustSore>client-truststore.jks</TrustSore>
<TrustSorePassword>wso2carbon</TrustSorePassword>
….
Thrift
This file is in charge to define how will msf4j communicate with DAS
https://localhost:9443/monitoring/
81
o http://kubernetes.io/v1.1/
o https://www.digitalocean.com/community/tutorials/an-introduction-to-
kubernetes
o https://insights.sei.cmu.edu/saturn/2015/11/defining-
microservices.html
o http://www.slideshare.net/afkham_azeez/wso2con-
2015usintroductiontomssv2?related=1
o http://www.slideshare.net/afkham_azeez/wso2conus-2015-
introduction-to-wso2-microservices-server-mss?related=2
84
o http://wso2.com/products/microservices-server/
o Lightweight and fast runtime
o 6MB pack size
o Starts within 400ms
o Based on the new WSO2 Carbon 5.0 kernel
o ~25MB memory consumption for the WSO2 MSS framework
o Simple development, deployment, and monitoring
o WSO2 Developer Studio-based tooling for generating microservices projects starting from a Swagger API
definition
o Built-in metrics and analytics APIs via WSO2 Data Analytics Server
o Tracing of requests using a unique message ID
o High scalability and reliability
o Transport based on Netty 4.0
o JWT-based security
o Custom interceptors
o Streaming input and streaming output support
o Comprehensive samples demonstrating how to develop microservices applications
85
o Tutorial done!
o Next steps:
o Keep watching how WSO2 MSS will evolve
o Don’t miss our upcoming Webinars covering this and
even more
86
o Please, if you need to understand more, or want
to talk to one of our specialists to help you and
your company’s projects, please contact us
here:
o http://wso2.com/contact/
87
88
@jedgarsilva
http://www.wso2.com
Edgar Silva
edgar@wso2.com
Contact us !

Contenu connexe

Tendances

Universal JS Web Applications with React - Luciano Mammino - Codemotion Rome ...
Universal JS Web Applications with React - Luciano Mammino - Codemotion Rome ...Universal JS Web Applications with React - Luciano Mammino - Codemotion Rome ...
Universal JS Web Applications with React - Luciano Mammino - Codemotion Rome ...Luciano Mammino
 
Mobicents Summit 2012 - George Vagenas - Testing SIP Applications with Arquil...
Mobicents Summit 2012 - George Vagenas - Testing SIP Applications with Arquil...Mobicents Summit 2012 - George Vagenas - Testing SIP Applications with Arquil...
Mobicents Summit 2012 - George Vagenas - Testing SIP Applications with Arquil...telestax
 
London Hug 20/6 - Clustering RabbitMQ using Consul
London Hug 20/6 - Clustering RabbitMQ using ConsulLondon Hug 20/6 - Clustering RabbitMQ using Consul
London Hug 20/6 - Clustering RabbitMQ using ConsulLondon HashiCorp User Group
 
Running JavaScript Efficiently in a Java World
Running JavaScript Efficiently in a Java WorldRunning JavaScript Efficiently in a Java World
Running JavaScript Efficiently in a Java Worldirbull
 
Meetup RomaJS - introduzione interattiva a Node.js - Luca Lanziani - Codemoti...
Meetup RomaJS - introduzione interattiva a Node.js - Luca Lanziani - Codemoti...Meetup RomaJS - introduzione interattiva a Node.js - Luca Lanziani - Codemoti...
Meetup RomaJS - introduzione interattiva a Node.js - Luca Lanziani - Codemoti...Codemotion
 
Devoxx UK 2013: Sandboxing with the Vagrant-Binding API
Devoxx UK 2013: Sandboxing with the Vagrant-Binding APIDevoxx UK 2013: Sandboxing with the Vagrant-Binding API
Devoxx UK 2013: Sandboxing with the Vagrant-Binding APIHendrik Ebbers
 
Integrating Tomcat And Apache On Windows
Integrating Tomcat And Apache On WindowsIntegrating Tomcat And Apache On Windows
Integrating Tomcat And Apache On WindowsMohanraj Nagasamy
 
Introduction to tempest
Introduction to tempest Introduction to tempest
Introduction to tempest openstackindia
 
Lucio Grenzi - Building serverless applications on the Apache OpenWhisk platf...
Lucio Grenzi - Building serverless applications on the Apache OpenWhisk platf...Lucio Grenzi - Building serverless applications on the Apache OpenWhisk platf...
Lucio Grenzi - Building serverless applications on the Apache OpenWhisk platf...Codemotion
 
Jenkins and Groovy
Jenkins and GroovyJenkins and Groovy
Jenkins and GroovyKiyotaka Oku
 
Embedding GlassFish v3 in Ehcache Server
Embedding GlassFish v3 in Ehcache ServerEmbedding GlassFish v3 in Ehcache Server
Embedding GlassFish v3 in Ehcache ServerEduardo Pelegri-Llopart
 
Multiple django applications on a single server with nginx
Multiple django applications on a single server with nginxMultiple django applications on a single server with nginx
Multiple django applications on a single server with nginxroskakori
 
Understanding Non Blocking I/O with Python
Understanding Non Blocking I/O with PythonUnderstanding Non Blocking I/O with Python
Understanding Non Blocking I/O with PythonVaidik Kapoor
 

Tendances (20)

Universal JS Web Applications with React - Luciano Mammino - Codemotion Rome ...
Universal JS Web Applications with React - Luciano Mammino - Codemotion Rome ...Universal JS Web Applications with React - Luciano Mammino - Codemotion Rome ...
Universal JS Web Applications with React - Luciano Mammino - Codemotion Rome ...
 
Nodejs Intro Part One
Nodejs Intro Part OneNodejs Intro Part One
Nodejs Intro Part One
 
Mobicents Summit 2012 - George Vagenas - Testing SIP Applications with Arquil...
Mobicents Summit 2012 - George Vagenas - Testing SIP Applications with Arquil...Mobicents Summit 2012 - George Vagenas - Testing SIP Applications with Arquil...
Mobicents Summit 2012 - George Vagenas - Testing SIP Applications with Arquil...
 
DevStack
DevStackDevStack
DevStack
 
London Hug 20/6 - Clustering RabbitMQ using Consul
London Hug 20/6 - Clustering RabbitMQ using ConsulLondon Hug 20/6 - Clustering RabbitMQ using Consul
London Hug 20/6 - Clustering RabbitMQ using Consul
 
GlassFish Embedded API
GlassFish Embedded APIGlassFish Embedded API
GlassFish Embedded API
 
Running JavaScript Efficiently in a Java World
Running JavaScript Efficiently in a Java WorldRunning JavaScript Efficiently in a Java World
Running JavaScript Efficiently in a Java World
 
Meetup RomaJS - introduzione interattiva a Node.js - Luca Lanziani - Codemoti...
Meetup RomaJS - introduzione interattiva a Node.js - Luca Lanziani - Codemoti...Meetup RomaJS - introduzione interattiva a Node.js - Luca Lanziani - Codemoti...
Meetup RomaJS - introduzione interattiva a Node.js - Luca Lanziani - Codemoti...
 
Devoxx UK 2013: Sandboxing with the Vagrant-Binding API
Devoxx UK 2013: Sandboxing with the Vagrant-Binding APIDevoxx UK 2013: Sandboxing with the Vagrant-Binding API
Devoxx UK 2013: Sandboxing with the Vagrant-Binding API
 
Integrating Tomcat And Apache On Windows
Integrating Tomcat And Apache On WindowsIntegrating Tomcat And Apache On Windows
Integrating Tomcat And Apache On Windows
 
Introduction to tempest
Introduction to tempest Introduction to tempest
Introduction to tempest
 
GlassFish v2.1
GlassFish v2.1GlassFish v2.1
GlassFish v2.1
 
Lucio Grenzi - Building serverless applications on the Apache OpenWhisk platf...
Lucio Grenzi - Building serverless applications on the Apache OpenWhisk platf...Lucio Grenzi - Building serverless applications on the Apache OpenWhisk platf...
Lucio Grenzi - Building serverless applications on the Apache OpenWhisk platf...
 
Nginx Essential
Nginx EssentialNginx Essential
Nginx Essential
 
Jenkins and Groovy
Jenkins and GroovyJenkins and Groovy
Jenkins and Groovy
 
Embedding GlassFish v3 in Ehcache Server
Embedding GlassFish v3 in Ehcache ServerEmbedding GlassFish v3 in Ehcache Server
Embedding GlassFish v3 in Ehcache Server
 
OMD and Check_mk
OMD and Check_mkOMD and Check_mk
OMD and Check_mk
 
SDN TEST Suite
SDN TEST SuiteSDN TEST Suite
SDN TEST Suite
 
Multiple django applications on a single server with nginx
Multiple django applications on a single server with nginxMultiple django applications on a single server with nginx
Multiple django applications on a single server with nginx
 
Understanding Non Blocking I/O with Python
Understanding Non Blocking I/O with PythonUnderstanding Non Blocking I/O with Python
Understanding Non Blocking I/O with Python
 

Similaire à Workshop MSF4J - Getting Started with Microservices and Java

Microservices Server - MSS Workshop
Microservices Server - MSS WorkshopMicroservices Server - MSS Workshop
Microservices Server - MSS WorkshopWSO2
 
Openshift cheat rhce_r3v1 rhce
Openshift cheat rhce_r3v1 rhceOpenshift cheat rhce_r3v1 rhce
Openshift cheat rhce_r3v1 rhceDarnette A
 
Dessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloudDessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloudMassimiliano Dessì
 
Come costruire una Platform As A Service con Docker, Kubernetes Go e Java
Come costruire una Platform As A Service con Docker, Kubernetes Go e JavaCome costruire una Platform As A Service con Docker, Kubernetes Go e Java
Come costruire una Platform As A Service con Docker, Kubernetes Go e JavaCodemotion
 
Bare Metal to OpenStack with Razor and Chef
Bare Metal to OpenStack with Razor and ChefBare Metal to OpenStack with Razor and Chef
Bare Metal to OpenStack with Razor and ChefMatt Ray
 
PVS-Studio in the Clouds: Travis CI
PVS-Studio in the Clouds: Travis CIPVS-Studio in the Clouds: Travis CI
PVS-Studio in the Clouds: Travis CIAndrey Karpov
 
Drupalcamp es 2013 drupal with lxc docker and vagrant
Drupalcamp es 2013  drupal with lxc docker and vagrant Drupalcamp es 2013  drupal with lxc docker and vagrant
Drupalcamp es 2013 drupal with lxc docker and vagrant Ricardo Amaro
 
Fabric8 - Being devOps doesn't suck anymore
Fabric8 - Being devOps doesn't suck anymoreFabric8 - Being devOps doesn't suck anymore
Fabric8 - Being devOps doesn't suck anymoreHenryk Konsek
 
Kubernetes for the PHP developer
Kubernetes for the PHP developerKubernetes for the PHP developer
Kubernetes for the PHP developerPaul Czarkowski
 
Docker Swarm secrets for creating great FIWARE platforms
Docker Swarm secrets for creating great FIWARE platformsDocker Swarm secrets for creating great FIWARE platforms
Docker Swarm secrets for creating great FIWARE platformsFederico Michele Facca
 
Docker for Java Developers
Docker for Java DevelopersDocker for Java Developers
Docker for Java DevelopersImesh Gunaratne
 
Automate drupal deployments with linux containers, docker and vagrant
Automate drupal deployments with linux containers, docker and vagrant Automate drupal deployments with linux containers, docker and vagrant
Automate drupal deployments with linux containers, docker and vagrant Ricardo Amaro
 
Network Automation Tools
Network Automation ToolsNetwork Automation Tools
Network Automation ToolsEdwin Beekman
 
Linux containers and docker
Linux containers and dockerLinux containers and docker
Linux containers and dockerFabio Fumarola
 
Kubernetes laravel and kubernetes
Kubernetes   laravel and kubernetesKubernetes   laravel and kubernetes
Kubernetes laravel and kubernetesWilliam Stewart
 
Usage Note of SWIG for PHP
Usage Note of SWIG for PHPUsage Note of SWIG for PHP
Usage Note of SWIG for PHPWilliam Lee
 
Docker Workshop - Orchestrating Docker Containers
Docker Workshop - Orchestrating Docker ContainersDocker Workshop - Orchestrating Docker Containers
Docker Workshop - Orchestrating Docker ContainersHugo Henley
 

Similaire à Workshop MSF4J - Getting Started with Microservices and Java (20)

Microservices Server - MSS Workshop
Microservices Server - MSS WorkshopMicroservices Server - MSS Workshop
Microservices Server - MSS Workshop
 
Openshift cheat rhce_r3v1 rhce
Openshift cheat rhce_r3v1 rhceOpenshift cheat rhce_r3v1 rhce
Openshift cheat rhce_r3v1 rhce
 
Dessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloudDessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloud
 
Come costruire una Platform As A Service con Docker, Kubernetes Go e Java
Come costruire una Platform As A Service con Docker, Kubernetes Go e JavaCome costruire una Platform As A Service con Docker, Kubernetes Go e Java
Come costruire una Platform As A Service con Docker, Kubernetes Go e Java
 
Bare Metal to OpenStack with Razor and Chef
Bare Metal to OpenStack with Razor and ChefBare Metal to OpenStack with Razor and Chef
Bare Metal to OpenStack with Razor and Chef
 
PVS-Studio in the Clouds: Travis CI
PVS-Studio in the Clouds: Travis CIPVS-Studio in the Clouds: Travis CI
PVS-Studio in the Clouds: Travis CI
 
Drupalcamp es 2013 drupal with lxc docker and vagrant
Drupalcamp es 2013  drupal with lxc docker and vagrant Drupalcamp es 2013  drupal with lxc docker and vagrant
Drupalcamp es 2013 drupal with lxc docker and vagrant
 
Fabric8 - Being devOps doesn't suck anymore
Fabric8 - Being devOps doesn't suck anymoreFabric8 - Being devOps doesn't suck anymore
Fabric8 - Being devOps doesn't suck anymore
 
Kubernetes for the PHP developer
Kubernetes for the PHP developerKubernetes for the PHP developer
Kubernetes for the PHP developer
 
Docker Swarm secrets for creating great FIWARE platforms
Docker Swarm secrets for creating great FIWARE platformsDocker Swarm secrets for creating great FIWARE platforms
Docker Swarm secrets for creating great FIWARE platforms
 
Docker for Java Developers
Docker for Java DevelopersDocker for Java Developers
Docker for Java Developers
 
Security Testing Using Infrastructure-As-Code
Security Testing Using Infrastructure-As-CodeSecurity Testing Using Infrastructure-As-Code
Security Testing Using Infrastructure-As-Code
 
Automate drupal deployments with linux containers, docker and vagrant
Automate drupal deployments with linux containers, docker and vagrant Automate drupal deployments with linux containers, docker and vagrant
Automate drupal deployments with linux containers, docker and vagrant
 
Network Automation Tools
Network Automation ToolsNetwork Automation Tools
Network Automation Tools
 
Linux containers and docker
Linux containers and dockerLinux containers and docker
Linux containers and docker
 
Excelian hyperledger walkthrough-feb17
Excelian hyperledger walkthrough-feb17Excelian hyperledger walkthrough-feb17
Excelian hyperledger walkthrough-feb17
 
Kubernetes laravel and kubernetes
Kubernetes   laravel and kubernetesKubernetes   laravel and kubernetes
Kubernetes laravel and kubernetes
 
Usage Note of SWIG for PHP
Usage Note of SWIG for PHPUsage Note of SWIG for PHP
Usage Note of SWIG for PHP
 
One-Man Ops
One-Man OpsOne-Man Ops
One-Man Ops
 
Docker Workshop - Orchestrating Docker Containers
Docker Workshop - Orchestrating Docker ContainersDocker Workshop - Orchestrating Docker Containers
Docker Workshop - Orchestrating Docker Containers
 

Plus de Edgar Silva

API Methodology by Skalena
API Methodology by SkalenaAPI Methodology by Skalena
API Methodology by SkalenaEdgar Silva
 
Flyweigth - Arquitetura de Referência para Open Banking Brasil Fase 1
Flyweigth - Arquitetura de Referência para Open Banking Brasil Fase 1Flyweigth - Arquitetura de Referência para Open Banking Brasil Fase 1
Flyweigth - Arquitetura de Referência para Open Banking Brasil Fase 1Edgar Silva
 
Skalena - Finance Business Unit
Skalena - Finance Business UnitSkalena - Finance Business Unit
Skalena - Finance Business UnitEdgar Silva
 
Plataforma de Consentimento (LGDP) Skalena
Plataforma de Consentimento (LGDP) SkalenaPlataforma de Consentimento (LGDP) Skalena
Plataforma de Consentimento (LGDP) SkalenaEdgar Silva
 
Casos de Sucesso WSO2 no Governo Brasileiro
Casos de Sucesso WSO2 no Governo BrasileiroCasos de Sucesso WSO2 no Governo Brasileiro
Casos de Sucesso WSO2 no Governo BrasileiroEdgar Silva
 
DevOps Tour SP 2019
DevOps Tour SP 2019DevOps Tour SP 2019
DevOps Tour SP 2019Edgar Silva
 
Skalena - Overview de Soluções
Skalena - Overview de Soluções Skalena - Overview de Soluções
Skalena - Overview de Soluções Edgar Silva
 
WSO2 Governance Registry 5.4.0 - Overview
WSO2 Governance Registry 5.4.0 - OverviewWSO2 Governance Registry 5.4.0 - Overview
WSO2 Governance Registry 5.4.0 - OverviewEdgar Silva
 
WSO2 Enterprise Integrator 6.1 - Integração na Era da Transformação
WSO2 Enterprise Integrator 6.1 - Integração na Era da TransformaçãoWSO2 Enterprise Integrator 6.1 - Integração na Era da Transformação
WSO2 Enterprise Integrator 6.1 - Integração na Era da TransformaçãoEdgar Silva
 
Transformação Digital de Forma Pragmatica WSO2
Transformação Digital de Forma Pragmatica WSO2Transformação Digital de Forma Pragmatica WSO2
Transformação Digital de Forma Pragmatica WSO2Edgar Silva
 
WSO2 Novo Modelo de Subscrições e Produtos 2017
WSO2 Novo Modelo de Subscrições e Produtos 2017WSO2 Novo Modelo de Subscrições e Produtos 2017
WSO2 Novo Modelo de Subscrições e Produtos 2017Edgar Silva
 
WSO2 API Manager 2.0 - Overview
WSO2 API Manager 2.0 - Overview WSO2 API Manager 2.0 - Overview
WSO2 API Manager 2.0 - Overview Edgar Silva
 
WSO2 API Manager : Going beyond the just API Management
WSO2 API Manager : Going beyond the just API ManagementWSO2 API Manager : Going beyond the just API Management
WSO2 API Manager : Going beyond the just API ManagementEdgar Silva
 
Conectando Turismo e Viagens - Plataforma WSO2
Conectando Turismo e Viagens - Plataforma WSO2Conectando Turismo e Viagens - Plataforma WSO2
Conectando Turismo e Viagens - Plataforma WSO2Edgar Silva
 
WSO2 Application Server como Alternativa ao Tomcat
WSO2 Application Server como Alternativa ao TomcatWSO2 Application Server como Alternativa ao Tomcat
WSO2 Application Server como Alternativa ao TomcatEdgar Silva
 
WSO2 - Visão Geral - Update 2015
WSO2 - Visão Geral - Update 2015WSO2 - Visão Geral - Update 2015
WSO2 - Visão Geral - Update 2015Edgar Silva
 
WSO2 para o Governo Brasileiro
WSO2 para o  Governo BrasileiroWSO2 para o  Governo Brasileiro
WSO2 para o Governo BrasileiroEdgar Silva
 
WSO2 - Portfólio de Produtos, Soluções e Suportes
WSO2 - Portfólio de Produtos, Soluções e SuportesWSO2 - Portfólio de Produtos, Soluções e Suportes
WSO2 - Portfólio de Produtos, Soluções e SuportesEdgar Silva
 
Introdução aos Conceitos do WSO2 ESB
Introdução aos Conceitos do WSO2 ESBIntrodução aos Conceitos do WSO2 ESB
Introdução aos Conceitos do WSO2 ESBEdgar Silva
 

Plus de Edgar Silva (20)

API Methodology by Skalena
API Methodology by SkalenaAPI Methodology by Skalena
API Methodology by Skalena
 
Flyweigth - Arquitetura de Referência para Open Banking Brasil Fase 1
Flyweigth - Arquitetura de Referência para Open Banking Brasil Fase 1Flyweigth - Arquitetura de Referência para Open Banking Brasil Fase 1
Flyweigth - Arquitetura de Referência para Open Banking Brasil Fase 1
 
Skalena - Finance Business Unit
Skalena - Finance Business UnitSkalena - Finance Business Unit
Skalena - Finance Business Unit
 
Plataforma de Consentimento (LGDP) Skalena
Plataforma de Consentimento (LGDP) SkalenaPlataforma de Consentimento (LGDP) Skalena
Plataforma de Consentimento (LGDP) Skalena
 
Casos de Sucesso WSO2 no Governo Brasileiro
Casos de Sucesso WSO2 no Governo BrasileiroCasos de Sucesso WSO2 no Governo Brasileiro
Casos de Sucesso WSO2 no Governo Brasileiro
 
DevOps Tour SP 2019
DevOps Tour SP 2019DevOps Tour SP 2019
DevOps Tour SP 2019
 
Skalena - Overview de Soluções
Skalena - Overview de Soluções Skalena - Overview de Soluções
Skalena - Overview de Soluções
 
WSO2 Governance Registry 5.4.0 - Overview
WSO2 Governance Registry 5.4.0 - OverviewWSO2 Governance Registry 5.4.0 - Overview
WSO2 Governance Registry 5.4.0 - Overview
 
WSO2 Enterprise Integrator 6.1 - Integração na Era da Transformação
WSO2 Enterprise Integrator 6.1 - Integração na Era da TransformaçãoWSO2 Enterprise Integrator 6.1 - Integração na Era da Transformação
WSO2 Enterprise Integrator 6.1 - Integração na Era da Transformação
 
Transformação Digital de Forma Pragmatica WSO2
Transformação Digital de Forma Pragmatica WSO2Transformação Digital de Forma Pragmatica WSO2
Transformação Digital de Forma Pragmatica WSO2
 
WSO2 Novo Modelo de Subscrições e Produtos 2017
WSO2 Novo Modelo de Subscrições e Produtos 2017WSO2 Novo Modelo de Subscrições e Produtos 2017
WSO2 Novo Modelo de Subscrições e Produtos 2017
 
WSO2 API Manager 2.0 - Overview
WSO2 API Manager 2.0 - Overview WSO2 API Manager 2.0 - Overview
WSO2 API Manager 2.0 - Overview
 
WSO2 Telco MCX
WSO2 Telco MCXWSO2 Telco MCX
WSO2 Telco MCX
 
WSO2 API Manager : Going beyond the just API Management
WSO2 API Manager : Going beyond the just API ManagementWSO2 API Manager : Going beyond the just API Management
WSO2 API Manager : Going beyond the just API Management
 
Conectando Turismo e Viagens - Plataforma WSO2
Conectando Turismo e Viagens - Plataforma WSO2Conectando Turismo e Viagens - Plataforma WSO2
Conectando Turismo e Viagens - Plataforma WSO2
 
WSO2 Application Server como Alternativa ao Tomcat
WSO2 Application Server como Alternativa ao TomcatWSO2 Application Server como Alternativa ao Tomcat
WSO2 Application Server como Alternativa ao Tomcat
 
WSO2 - Visão Geral - Update 2015
WSO2 - Visão Geral - Update 2015WSO2 - Visão Geral - Update 2015
WSO2 - Visão Geral - Update 2015
 
WSO2 para o Governo Brasileiro
WSO2 para o  Governo BrasileiroWSO2 para o  Governo Brasileiro
WSO2 para o Governo Brasileiro
 
WSO2 - Portfólio de Produtos, Soluções e Suportes
WSO2 - Portfólio de Produtos, Soluções e SuportesWSO2 - Portfólio de Produtos, Soluções e Suportes
WSO2 - Portfólio de Produtos, Soluções e Suportes
 
Introdução aos Conceitos do WSO2 ESB
Introdução aos Conceitos do WSO2 ESBIntrodução aos Conceitos do WSO2 ESB
Introdução aos Conceitos do WSO2 ESB
 

Dernier

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 

Dernier (20)

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 

Workshop MSF4J - Getting Started with Microservices and Java

  • 1. msf4j – Microservices Framework for Java Workshop Edgar Silva edgar @wso2.com
  • 2. o This workshop is intend to cover how to use the WSO2 Microservices Server for Java – msf4j, we will cover some basic overview about some concepts, but we strongly recommend you look for more detailed basics about Microservices. o Recommended reading: o http://nginx.com/blog/introduction-to-microservices/ o https://www.nginx.com/blog/building-microservices-using-an-api- gateway/ 2
  • 3. 3
  • 5. o Java 8 o Maven o See the MSF4J releases page: o https://github.com/wso2/msf4j o Let’s work direct from the source: o Git pull o https://github.com/wso2/msf4j o Or simply download from this url: (easier) https://github.com/wso2/msf4j/archive/master.zip 5
  • 6.
  • 7. 7
  • 8. 8
  • 9. o So, cd <msf4j_HOME>/samples o Make you sure you could import the project hello_world 9
  • 10. o Go to the dir: o <msf4j_HOME>/samples/hello_world o Type: mvn package 10
  • 11. o After Maven process o ( be pacient with downloading  ) o What is happening: o The pom.xml inside the sample, inherits the dependencies from the root’s pom.xml, that’s why you don’t need to worry with this process o In a few (seconds) you will have a hello_service....jar into your target folder. 11
  • 12. 12 • Msf4j is booting in my case in about less than 300ms • In the previous maven process, every dependency from other jars were included into your helloworld-1.0.0-SNAPSHOT.jar, including the reference to the Main Java Class. • Everything you need is ready 
  • 13. 13 package org.wso2.carbon.msf4j.example; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; /** * Hello service resource class. */ @Path("/hello") public class HelloService { @GET @Path("/{name}") public String hello(@PathParam("name") String name) { return "Hello " + name; } } } JAX-RS Simple class (REST Endpoint REST Java Method
  • 14. o The simplest Java Class startup o See the main method: 14 public class Application { public static void main(String[] args) { new MicroservicesRunner() .deploy(new HelloService()) .start(); }
  • 15. 15 edgar$ curl -v http://localhost:8080/hello/valentina
  • 16. o Take a look on this: o http://www.confusedbycode.com/curl/ 16
  • 17. o Thanks @jpviragine for that great tip: https://github.com/jkbrzt/httpie o Really great tool, works like cURL, but much better and more user friendly o Syntax: http <options> service or URL o But if you prefer to be “roots”, ok, continue if cURL 17
  • 18. 18 public class Application { public static void main(String[] args) { new MicroservicesRunner(7888, 8888) .deploy(new HelloService()) .start(); } Services exposed through different ports(*) (*) Default port is 8080 when no ports are specified
  • 19. 19
  • 20. 1. Enter in the <msf4j_home>/samples/stockquote-service 2. mvn package 3. java -jar target/stockquote-service-1.0.0- SNAPSHOT.jar 20
  • 21. o In the console type: (Windows Users o curl -v http://localhost:8080/stockquote/GOOG 21
  • 22. o Now we will send a POST message to our Service: o Please type (or copy and paste) the following command: o curl -v -X POST -H "Content-Type:application/json" -d '{"symbol":"BVMF","name": "Bovespa","last":149.62,"low":150.78,"high":149.18,"createdByHost":"localh ost"}' http://localhost:8080/stockquote o This command will save a new Symbol into our Stock Quote Service 22
  • 23. o You had used: o Java 8 + maven for building our samples and exercises o Executed Microservices with basic jar –jar approach o You saw how easy you can build REST Services using Microservices approach 23
  • 24. 24
  • 25. o Several approaches for a “decoupled SOA” o In this tutorial we will use the “Container-based approach” o Microservices are about: o Lighter o Business Need Oriented o Composable 25
  • 26. 26 Web Server ASP.NET ADO.NET Windows OS .NET CLR RuntimeFront-Store HTML
  • 28. 28 Product Service get /products post /products get /products/{id} get /products/offset/10/1 CustomerService get /customers post /customers get /customers/{id} get /customers/export AddressService get /address post /address/{zip} get /address/geo/{x}/{y} 3Examples
  • 29. 29 Product Service CustomerService AddressService AddressService ProductService Customer Service AddressService Customer Service SinglePage APP HTML FrontStoreService Delivery Service
  • 30. o Quick deployments o You are deploying a loosely-coupled, modular component only  o Not a huge EAR with dozens of Jars as you used to do in a monolithic enterprise App 30
  • 32. 32 Paulo Merson https://insights.sei.cmu.edu/saturn/2015/11/defining-microservices.html Great definition, written by another Brazilian  From an architecture perspective, the microservice style belongs primarily to the deployment view. It dictates that the deployment unit should contain only one service or just a few cohesive services. The deployment constraint is the distinguishing factor. As a result, microservices are easier to deploy, become more scalable, and can be developed more independently by different teams using different technologies. “
  • 33. o Benefits of using microservices: o Deployability o Availability o Scalability o Modifiability o Management 33 Paulo Merson https://insights.sei.cmu.edu/saturn/2015/11/microservices-beyond-the-hype-what-you-gain-and-what-you-lose.html ( Great post )
  • 34. o I would add: o Deployability o Availability (Auto-Scaling via Containers) o Analytics o Scalability o Modifiability o Management 34 Paulo Merson https://insights.sei.cmu.edu/saturn/2015/11/microservices-beyond-the-hype-what-you-gain-and-what-you-lose.html
  • 35. 35
  • 36. o Part 2: We ship in the distro an example showing how to run a whole deploy from several different container machines managed by Kubernetes. 36
  • 37. o In your command line, go to your: <msf4j_home>/samples/petstore o Enter in deployment folder and execute: run.sh o That’s all, time to get some juice, it will download everything you need: o Vagrant o CoreOS o Kubernetes o Docker 37
  • 38. o https://github.com/wso2/product- msf4j/tree/master/samples/petstore/deployment/kubernet es-vagrant-coreos-cluster o Disclaimer: This tutorial is focused on WSO2 Micro Services Server – msf4j, and some introduction to the basics on Kubernetes is strongly recommended before you move forward on this tutorial. 38
  • 39. 39 This step will get a few minutes, according to your internet and machine, So get relaxed while you can enjoy some “Matrix-like” in your console http://thenextweb.com/wp-content/blogs.dir/1/files/2013/11/relax-at-work.jpg
  • 40.  Double check if your JAVA_HOME is Java 8  Please , if you are using MacOS, make sure you that you have wget installed.  Recommend you use brew install wget  If you get errors communicating with Kubernetes nodes, please add this variable before execute run.sh:  export KUBERNETES_MASTER=http://172.17.8.101:8080  That will be the default Kubernetes UI Console and API Address 40
  • 41. 41 Our traditional Pet Store Sample has the following Microservices … fileserver frontend-admin frontend-user Pet (store) transactionsecurity
  • 42. o If you are using VirtualBox as the Hypervisor (recommended), you will see the following 3 VMs started 42
  • 43. o Please, execute the command: o kubectl get pods o The result must be like this: 43 All the pods, must be Like this, keep repeating This process until all get ready
  • 44. o Please, execute the command: o kubectl get pods o The result must be like this: 44 Troubleshooting: If your pet-xxx appears the READY info as 0/1 It might be not initialized Syncronized with Redis. To solve that, execute: ./clean.sh and later on ./petstore.sh
  • 45. o Kubernetes UI o Nodes o Services o Pods o General Info o Pet Store Admin (PHP App) o Pet Store Site (PHP App) 45
  • 46. http://172.17.8.101:8080/ui Here is the Kubernetes Admin that you can open in your browser 46
  • 47. Relationship between the VMs and Kubernetes (Nodes) 47 Here you can see the Ips Attached to the each Node
  • 51. 51 Viewing Replication Controllers In Kubernetes, the base unit of deployment is a pod (intro to pods), which is a group of containers that work together and therefore are logically grouped. The replication controller stores a pod template in order to create new pods if needed. https://coreos.com/kubernetes/docs/latest/replication-controller.html
  • 52. 52 Your Machine OS Hypervisor Kubernetes Cluster-Master K8S Node 01 K8S Node 02 Pods Pods Replication Controller Service
  • 53. 53 Your Machine OS Hypervisor Kubernetes Cluster-Master K8S Node 01 K8S Node 02 Pods Pods Replication Controller Service Browser
  • 54. 54 Your Machine OS Hypervisor Kubernetes Cluster-Master K8S Node 01 K8S Node 02 Pods Pods Replication Controller Service Browser NGINX
  • 55. 55 Getting Actual pods: $ kubectl get pods
  • 56. 56 Getting details about some pod, for instance $ kubectl describe pods store-fe-r43hm
  • 57. 57 Getting details about some pod, for instance $ kubectl describe pods store-fe-r43hm Please, note here which is the Pod internal IP: 10.244.36.23 And in which Node this pod Is actually running Important: notice that the pod’s id will change if you restart your environment  In my actual case, my pod is store-fe-<id>, id= r43m
  • 58. 58 Getting Actual Services: $ kubectl describe service store-fe
  • 59. 59 Persistence Repository / Services "Containerized” Microservices based in pure java –jar approach Client Apps (PHP) petstore-admin petstore
  • 60. 60 You will need to browse the service: admin-fe http:// Node Server IP: Node Port Ex: http://172.17.8.102:30984/
  • 62.
  • 63.
  • 65. 65 You will need to browse the service: store-fe http:// Node Server IP: Node Port Ex: http://172.17.8.102:31466/
  • 66.
  • 67. Here the Microservices Transaction Is invoked.
  • 68. o Executing the petstore sample o Understanding the basics from Kubernetes and its concepts, such as pods, services and Replication Controller. o Executing the Services and Apps
  • 69. o Proposed Lab: o Execute the previous samples from Part1 in Kubernetes + Docker 69
  • 70. 70
  • 71. o Please go to : http://wso2.com/products/data-analytics-server/ o Download the product o Install the product: 1. Unzip 2. That’s all 3. Let’s call your installation destination folder as DAS_HOME from now on o MySQL for this sample is also required 71
  • 72. o Step 1: Configure WSO2 DAS 1. Go to <msf4j_HOME>/analytics/das-setup and execute setup.sh : 1. /setup.sh -d <DAS_HOME> -u admin -p 2. Done, everything will be done by the script! 72
  • 73. o Step 2: Execute DAS Server 1. Enter in DAS_HOME 2. Make sure that Java 8 is in the path 3. Type sh bin/wso2server.sh 4. Wait until to see a message in the console like this: 5. Open this browser URL, it will let you see the WSO2 Data Analytics Server Console (default user admin and password admin) 73
  • 74. 74 WSO2 DAS is ready and configured!
  • 75. o Step 3: (based on https://github.com/wso2/product- msf4j/tree/master/samples/metrics) 1. Go to <msf4j_HOME>/samples/metrics 2. Execute mvn clean install 3. Please, export the following system variables: 1. export METRICS_REPORTING_DAS_DATAAGENTCONFIGPATH="data-agent-conf.xml” 2. export HTTP_MONITORING_DAS_DATAAGENTCONFIGPATH="data-agent-conf.xml” 75
  • 76. 4. Execute: $ java -jar target/metrics-*.jar 5. Invoke the following URLs via command line: o curl -v http://localhost:8080/test/rand/500 o curl -v http://localhost:8080/test/total/10 o curl -v http://localhost:8080/test/echo/test o curl -v http://localhost:8080/student/910760234V o curl -v --data "{'nic':'860766123V','firstName':'Jack','lastName':'Black','age': 29}" -H "Content-Type: application/json" http://localhost:8080/student o curl -v http://localhost:8080/student/860766123V o curl -v http://localhost:8080/student 76
  • 77. o What is happening: o Now, after the invocation from cURLs, some information were sent from WSO2 Microservices Server to WSO2 Data Analytics Server. o The Metrics are also present in the command line where you are running the jar: 77
  • 78. 78
  • 79. @GET @Path("/{nic}") @Produces("application/json") @Timed @HTTPMonitoring public Student getStudent(@PathParam("nic") String nic) { return students.get(nic); } @POST @Consumes("application/json") @Metered @HTTPMonitoring public void addStudent(Student student) { students.put(student.getNic(), student); } org.wso2.carbon.msf4j.example.service.StudentService.java
  • 82.
  • 83. o http://kubernetes.io/v1.1/ o https://www.digitalocean.com/community/tutorials/an-introduction-to- kubernetes o https://insights.sei.cmu.edu/saturn/2015/11/defining- microservices.html o http://www.slideshare.net/afkham_azeez/wso2con- 2015usintroductiontomssv2?related=1 o http://www.slideshare.net/afkham_azeez/wso2conus-2015- introduction-to-wso2-microservices-server-mss?related=2
  • 84. 84
  • 85. o http://wso2.com/products/microservices-server/ o Lightweight and fast runtime o 6MB pack size o Starts within 400ms o Based on the new WSO2 Carbon 5.0 kernel o ~25MB memory consumption for the WSO2 MSS framework o Simple development, deployment, and monitoring o WSO2 Developer Studio-based tooling for generating microservices projects starting from a Swagger API definition o Built-in metrics and analytics APIs via WSO2 Data Analytics Server o Tracing of requests using a unique message ID o High scalability and reliability o Transport based on Netty 4.0 o JWT-based security o Custom interceptors o Streaming input and streaming output support o Comprehensive samples demonstrating how to develop microservices applications 85
  • 86. o Tutorial done! o Next steps: o Keep watching how WSO2 MSS will evolve o Don’t miss our upcoming Webinars covering this and even more 86
  • 87. o Please, if you need to understand more, or want to talk to one of our specialists to help you and your company’s projects, please contact us here: o http://wso2.com/contact/ 87