SlideShare a Scribd company logo
1 of 39
2021-07-21
MuleSoft for Java Devs - Meetup
Group
Building APIs with Mule and SpringBoot
2
● Introductions
● Mule & Java
● API Lifecycle
○ Building MuleSoft API
○ Building SpringBoot API
● Wrap-up
● Trivia - Win a MuleSoft Course
Agenda
Sponsor:
Integration Architect at Infomentum
● More than 13 years working with
development. Start with Java in 2008!
● Since 2014 working with MuleSoft
● MuleSoft Ambassador & Meetup Leader
Guilherme Pereira
•Enterprise Architect / Mulesoft Technical Instructor
•EMEA (Milan, Italy)
•Background:
–25+ yrs exp. Software Engineer, Developer, Trainer, Translator
–MuleSoft, Java, .NET, Python, Node.Js, Oracle Cloud, Google Cloud,
AWS, CNCF Kubernetes Specialist, UML/SysML Certified Expert, PMI
PMP, TOGAF 9.1
•Certified MuleSoft Developer (MCD), Certified MuleSoft Integration Architect (MCIA), Cert
Mule Platform Architect (MCPA)
Thimoty Barbieri, PhD
https://www.linkedin.com/in/thimoty/
Better together
Mule & Java
6
● Mule started as an open-source project later in 2003
○ A powerful & lightweight ESB runtime
○ Implemented several features to send, publish, route, transform messages
○ Had a great adoption with thousands of downloads and improvements during the years
○ The Mule core stills as an open-source project until nowadays
Mule is based on Java
7
From open-source to the Anypoint Platform
● Mule Runtime:
○ Java under the hoods
○ Lightweight ESB
○ Scalable
○ EDA
○ Automatic thread controls
○ Streaming
○ Batch
○ Persistent queues
○ Cache
Mule
8
From open-source to the Anypoint Platform
● Connectors & modules
○ 200+ connectors
○ Salesforce, SAP, Workday and
more...
○ Plug & Play
○ Databases, Queues, File and
more...
○ Connect everything
○ Extend with the SDK
Mule
Anypoint Connectors
9
From open-source to the Anypoint Platform
● Design & Portals
○ Design your APIs first
○ Mock and console
○ Publish your assets
○ Create API Portals
○ Discover APIs and fragments
Anypoint Design Center
Anypoint Exchange
Studio
API
Designer
Connector
DevKit
Mule
Anypoint Connectors
10
From open-source to the Anypoint Platform
● Management & Monitoring
○ Manage your APIs & Integrations
○ Monitoring
○ Alerts
○ Secure APIs
○ Out-of-the box policies
○ Custom policies
Anypoint Design Center Anypoint Management Center
Anypoint Exchange
Studio
API
Designer
Connector
DevKit
Runtime
Manager
API
Manager
Analytics
Mule
Anypoint Connectors
11
From open-source to the Anypoint Platform
Anypoint Design Center Anypoint Management Center
Anypoint Exchange
Studio
API
Designer
Connector
DevKit
Runtime
Manager
API
Manager
Analytics
Runtime Services
Mule
Anypoint Connectors
● Run & Scale
○ Run on Cloud, On-Prem or Hybrid
○ Easy to deploy
○ Scale
○ Run with Kubernetes
○ Object Store and Queues
○ Cloud MQ Message Broker
Building APIs
API Lifecycle
Use case
13
● Create an API to integrate with Salesforce
● Query Contacts and return as JSON format
“Doing It All” with MuleSoft
(clone full working demo from:
https://github.com/gui1207/sfdc-contacts-sys-api)
15
API Lifecycle
Step 1: Design the API Contract
16
Step 2: Implement & Test locally
17
Step 3: Deploy
18
Step 4: Operate
19
“Doing It All” with Spring Boot
(clone full working demo from:
https://github.com/thimotyb/salesforce-springboot-demo)
Step 1: Connecting to SalesForce
21
- We will use the Enterprise SOAP API with the approach described at
- https://developer.salesforce.com/docs/atlas.en-
us.api.meta/api/sforce_api_quickstart_steps.htm
- There are other you can use, e.g. Bulk API 2.0 https://developer.salesforce.com/docs/atlas.en-
us.api_asynch.meta/api_asynch/api_asynch_introduction_bulk_api.htm
- Or Streaming API https://developer.salesforce.com/docs/atlas.en-
us.api_streaming.meta/api_streaming/intro_stream.htm
- Download Enterprise WSDL for correct Salesforce Version from DevPortal
- Use WSC tool to generate Java skeletons and Data Models of the entire
Enterprise API
- java –classpath pathToJAR/wsc-22.jar com.sforce.ws.tools.wsdlc
pathToWsdl/WsdlFilename​ pathToOutputJar/OutputJarFilename
- The WSDL is huge, lots of problems trying to auto-generate in-line with the maven jax2
tooling
- An enterprise.jar system dependency specific for your Salesforce version is
created, to be included in the project
22
23
- Service as a
Singleton can be
Autowired in
implementation
- Configuration is
separated in
application.proper
ties and injected
at service boot
Step 1: Connection @Service
24
- The OAS YAML definition was provided and integrated in the project
manually
- Endpoint Controller Interface and Data Model are auto generated with
openapi-generator-maven-plugin
- Several other maven dependencies are necessary to make it properly work
Step 2: Integrating the API Design
25
- The interface is
generated in
maven’s target dir
and cannot be
modified
- Implementation
should be done as
separate @Service
implementing this
interface
- Spring’s IOC will
take care of the rest
Step 2: Auto-generated Interface
26
- Each Endpoint is implemented as a Service
- Implement the Auto-Generated Interface
- Inject the Connector
- Perform (Hard-code?) the query
- Fetch the resulting Record
- Handle Errors
- Prepare the Response
- DTO Mapping
- From the Enteprise.jar library -> Data Model from the OAS Spec
- Manually?!
Step 3: Implementing the Endpoints
27
Step 3: Implementation
Implement auto-
generated interface
Override interface
default methods
28
Streaming/Paging?
Use Bulk API 2.0 or
Streaming API
(CornetD)
1:1 Data Mapping
across DTO’s?
Hard-Coded
Query?
29
- We use the following maven plugins
- surefire for unit testing / spring mocks
- springboot for packaging as single jar
- docker plugin for containerization with Dockerfile
- Package, install, create container with
- mvn clean install docker:build (-DskipTests=true to skip tests?)
- Also useful
- maven release (auto-manage package versions / Release / Snapshot)
- use push goal to push container to Docker Registry
Step 4: DevOps
30
- We will use a Minikube free instance at
https://katacoda.com/javajon/courses/kubernetes-fundamentals/minikube
- Create a deployment, expose as a LoadBalanced service, check the status:
- kubectl create deployment salesforce-service --image=thimoty/salesforce-service
- kubectl expose deployment salesforce-service --port=80 --target-port=8080 --
type=LoadBalancer
- kubectl get po,svc -o wide
- The service is now reachable and deployment can be scaled up/down
- Need a Service Mesh (e.g. Istio) for Proxy Handling
Step 5: Deploy
31
- k8s Dashboard
- Need to setup Prometheus/Graphana
- Need to setup ELK Stack
- Config Backup: Velero
- Security? Certificates?
- … LOTS of additional stuff on top of plain vanilla k8s!!!
Step 6: Observability/Monitoring/Operations
Final considerations
Wrap up
Task Comparison Table
33
Task SpringBoot MuleSoft
Salesforce Connector: Prepare WSDL,
Stub/Skeleton
Download Enterprise API WSDL, use wsc
to create dependency
Just use the Salesforce Connector
API Design Use OAS Maven endpoint generator plugin API Kit from Design Center
Service Implementation
Need to implement the interface, prepare
the query, iterate the records, create ad-
hoc error handling. No OOTB
Paging/Streaming
Just leverage Mule’s Streaming Saleforce
connector, use Query, Trasform and Mule
3-tier error handling
DTO Mapping
Need to explicitly write “glue code” for each
combination, choose the correct API
typology (Enterprise, Partner, Batch,
Streaming…)
Use DataWeave!!!
DevOps / Containerization
Use Maven plugins and Dockerization with
Dockerfile
Just upload the Mule app to CloudHub!!!
What is missing?
34
Task SpringBoot MuleSoft
Security Add Spring Security, roll your own Load
Balancers, install a Vault...
Anypoint Platform provides integrated services such
as: Vault, Secret Management, Safely Hidden
Properties
API Gateway Proxy - External API Manager Anypoint Platform provides integrated API Manager
capabilities and out of the box policies
Performance / Throughput Current implementation is pretty much
sequential
MuleSoft uses OTTB Spring Flux and Streaming
under the hood and
Logging Properly use log4j and Logstash (TBD) Anypoint Platform Logging
Monitoring If running in a container, use the orchestrator’s
monitoring facilities
Anypoint Platform Monitoring
Docker Image Maintenance Need to keep checking security of base images
of containers. Implement Registry Scanner.
Anypoint Runtime Fabric
35
● Final thoughts:
○ Pain points:
■ Difficult to implement just using plain code
■ Need user libs to create skeleton
■ Implement auth methods
○ Implementing with Mule
■ Out of box Connectors
■ CloudHub / Monitoring / API Manager
■ Drag and drop
Wrap up
36
● Register to the Free MuleSoft Course:
○ https://mule.is/LearnMule
● Share:
○ Tweet using the hashtag #MuleSoftMeetups
○ Invite your network to join: https://meetups.mulesoft.com/mulesoft-for-java-developers/
● Feedback:
○ Fill out the survey feedback and suggest topics for upcoming events
○ Contact MuleSoft at meetups@mulesoft.com for ways to improve the program
What’s next?
Your chance to win an Instructor-led MuleSoft course
Trivia
38
● You can win only 1 voucher per month, across all Meetups. If you already won 1 voucher in
the month from another event, you will not receive a new one.
● The first 3 ranked in the game win a voucher
● Use your name in the game - avoid nicknames
● To request the voucher you should send a email to gui1207@gmail.com or use the "contact
the organizer form" on the meetup group page
● If using Kahoot, go to kahoot.com with your browser on desktop or smartphone
○ Select “Play”
○ Type the Game PIN you are given during the session
○ The contest with kahoot could be capped, so only the first 100 users that log in get to participate
Rules
Thank you

More Related Content

What's hot

Service Mesh on Kubernetes with Istio
Service Mesh on Kubernetes with IstioService Mesh on Kubernetes with Istio
Service Mesh on Kubernetes with Istio
Michelle Holley
 

What's hot (20)

MuleSoft Surat Meetup#41 - Universal API Management, Anypoint Flex Gateway an...
MuleSoft Surat Meetup#41 - Universal API Management, Anypoint Flex Gateway an...MuleSoft Surat Meetup#41 - Universal API Management, Anypoint Flex Gateway an...
MuleSoft Surat Meetup#41 - Universal API Management, Anypoint Flex Gateway an...
 
Introduction to MuleSoft
Introduction to MuleSoftIntroduction to MuleSoft
Introduction to MuleSoft
 
Terraform Best Practices - DevOps Unicorns 2019
Terraform Best Practices - DevOps Unicorns 2019Terraform Best Practices - DevOps Unicorns 2019
Terraform Best Practices - DevOps Unicorns 2019
 
MuleSoft Online Meetup a Guide to RTF application deployment - October 2020
MuleSoft Online Meetup   a Guide to RTF application deployment  - October 2020MuleSoft Online Meetup   a Guide to RTF application deployment  - October 2020
MuleSoft Online Meetup a Guide to RTF application deployment - October 2020
 
Terraform -- Infrastructure as Code
Terraform -- Infrastructure as CodeTerraform -- Infrastructure as Code
Terraform -- Infrastructure as Code
 
Containers Anywhere with OpenShift by Red Hat
Containers Anywhere with OpenShift by Red HatContainers Anywhere with OpenShift by Red Hat
Containers Anywhere with OpenShift by Red Hat
 
OpenShift Enterprise
OpenShift EnterpriseOpenShift Enterprise
OpenShift Enterprise
 
Managing APIs with MuleSoft
Managing APIs with MuleSoftManaging APIs with MuleSoft
Managing APIs with MuleSoft
 
MuleSoft Sizing Guidelines - VirtualMuleys
MuleSoft Sizing Guidelines - VirtualMuleysMuleSoft Sizing Guidelines - VirtualMuleys
MuleSoft Sizing Guidelines - VirtualMuleys
 
API Governance and GitOps in Hybrid Integration Platform (MuleSoft)
API Governance and GitOps in Hybrid Integration Platform (MuleSoft)API Governance and GitOps in Hybrid Integration Platform (MuleSoft)
API Governance and GitOps in Hybrid Integration Platform (MuleSoft)
 
What Is Platform as a Product - Clues from Team Topologies @ AXA, Sep 2021
What Is Platform as a Product - Clues from Team Topologies @ AXA, Sep 2021What Is Platform as a Product - Clues from Team Topologies @ AXA, Sep 2021
What Is Platform as a Product - Clues from Team Topologies @ AXA, Sep 2021
 
Application Architecture: The Next Wave | MuleSoft
Application Architecture: The Next Wave | MuleSoftApplication Architecture: The Next Wave | MuleSoft
Application Architecture: The Next Wave | MuleSoft
 
{Re}designing a Developer Portal
{Re}designing a Developer Portal{Re}designing a Developer Portal
{Re}designing a Developer Portal
 
Mule 4 migration + Common Integration Challenges : MuleSoft Virtual Muleys Me...
Mule 4 migration + Common Integration Challenges : MuleSoft Virtual Muleys Me...Mule 4 migration + Common Integration Challenges : MuleSoft Virtual Muleys Me...
Mule 4 migration + Common Integration Challenges : MuleSoft Virtual Muleys Me...
 
Demystifying the use of circuit breakers with MuleSoft
Demystifying the use of circuit breakers with MuleSoftDemystifying the use of circuit breakers with MuleSoft
Demystifying the use of circuit breakers with MuleSoft
 
Introduction to MuleSoft
Introduction to MuleSoftIntroduction to MuleSoft
Introduction to MuleSoft
 
Washington DC MuleSoft Meetup: CI/CD Pipeline with MuleSoft and Azure DevOps
Washington DC MuleSoft Meetup: CI/CD Pipeline with MuleSoft and Azure DevOpsWashington DC MuleSoft Meetup: CI/CD Pipeline with MuleSoft and Azure DevOps
Washington DC MuleSoft Meetup: CI/CD Pipeline with MuleSoft and Azure DevOps
 
Devops - Microservice and Kubernetes
Devops - Microservice and KubernetesDevops - Microservice and Kubernetes
Devops - Microservice and Kubernetes
 
MuleSoft Online meetup - An expert's guide to Runtime fabric - August 2020
MuleSoft Online meetup -  An expert's guide to Runtime fabric - August 2020MuleSoft Online meetup -  An expert's guide to Runtime fabric - August 2020
MuleSoft Online meetup - An expert's guide to Runtime fabric - August 2020
 
Service Mesh on Kubernetes with Istio
Service Mesh on Kubernetes with IstioService Mesh on Kubernetes with Istio
Service Mesh on Kubernetes with Istio
 

Similar to Building APIs with Mule and Spring Boot

Similar to Building APIs with Mule and Spring Boot (20)

Brisbane MuleSoft Meetup 2023-03-22 - Anypoint Code Builder and Splunk Loggin...
Brisbane MuleSoft Meetup 2023-03-22 - Anypoint Code Builder and Splunk Loggin...Brisbane MuleSoft Meetup 2023-03-22 - Anypoint Code Builder and Splunk Loggin...
Brisbane MuleSoft Meetup 2023-03-22 - Anypoint Code Builder and Splunk Loggin...
 
Anypoint Tools and MuleSoft Automation (DRAFT).pptx
Anypoint Tools and MuleSoft Automation (DRAFT).pptxAnypoint Tools and MuleSoft Automation (DRAFT).pptx
Anypoint Tools and MuleSoft Automation (DRAFT).pptx
 
MuleSoft Meetup #9 - Anypoint Tools and MuleSoft Automation (FINAL).pptx
MuleSoft Meetup #9 - Anypoint Tools and MuleSoft Automation (FINAL).pptxMuleSoft Meetup #9 - Anypoint Tools and MuleSoft Automation (FINAL).pptx
MuleSoft Meetup #9 - Anypoint Tools and MuleSoft Automation (FINAL).pptx
 
Mulesoft KL Meetup 2
Mulesoft KL Meetup 2Mulesoft KL Meetup 2
Mulesoft KL Meetup 2
 
London-MuleSoft-Meetup-April-19-2023
London-MuleSoft-Meetup-April-19-2023London-MuleSoft-Meetup-April-19-2023
London-MuleSoft-Meetup-April-19-2023
 
London MuleSoft Meetup
London MuleSoft Meetup London MuleSoft Meetup
London MuleSoft Meetup
 
Warsaw MuleSoft Meetup #13.pptx
Warsaw MuleSoft Meetup #13.pptxWarsaw MuleSoft Meetup #13.pptx
Warsaw MuleSoft Meetup #13.pptx
 
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...
 
Sustainability Challenge, Postman, Rest sheet and Anypoint provider : MuleSof...
Sustainability Challenge, Postman, Rest sheet and Anypoint provider : MuleSof...Sustainability Challenge, Postman, Rest sheet and Anypoint provider : MuleSof...
Sustainability Challenge, Postman, Rest sheet and Anypoint provider : MuleSof...
 
Ahmadabad mule soft_meetup_6march2021_azure_CICD
Ahmadabad mule soft_meetup_6march2021_azure_CICDAhmadabad mule soft_meetup_6march2021_azure_CICD
Ahmadabad mule soft_meetup_6march2021_azure_CICD
 
Manchester MuleSoft Meetup #7
Manchester MuleSoft Meetup #7 Manchester MuleSoft Meetup #7
Manchester MuleSoft Meetup #7
 
Mulesoft Connections to different companies, and different services
Mulesoft Connections to different companies, and different servicesMulesoft Connections to different companies, and different services
Mulesoft Connections to different companies, and different services
 
MuleSoft Surat Virtual Meetup#16 - Anypoint Deployment Option, API and Operat...
MuleSoft Surat Virtual Meetup#16 - Anypoint Deployment Option, API and Operat...MuleSoft Surat Virtual Meetup#16 - Anypoint Deployment Option, API and Operat...
MuleSoft Surat Virtual Meetup#16 - Anypoint Deployment Option, API and Operat...
 
CI CD Daridabad MuleSoft meetup
CI CD Daridabad MuleSoft meetupCI CD Daridabad MuleSoft meetup
CI CD Daridabad MuleSoft meetup
 
Pitfalls of machine learning in production
Pitfalls of machine learning in productionPitfalls of machine learning in production
Pitfalls of machine learning in production
 
Azure DevOps Pipeline setup for Mule APIs #36
Azure DevOps Pipeline setup for Mule APIs #36Azure DevOps Pipeline setup for Mule APIs #36
Azure DevOps Pipeline setup for Mule APIs #36
 
MuleSoft Surat Meetup#45 - Anypoint Flex Gateway as a Kubernetes Ingress Cont...
MuleSoft Surat Meetup#45 - Anypoint Flex Gateway as a Kubernetes Ingress Cont...MuleSoft Surat Meetup#45 - Anypoint Flex Gateway as a Kubernetes Ingress Cont...
MuleSoft Surat Meetup#45 - Anypoint Flex Gateway as a Kubernetes Ingress Cont...
 
Warsaw MuleSoft Meetup #6 - CI/CD
Warsaw MuleSoft Meetup  #6 - CI/CDWarsaw MuleSoft Meetup  #6 - CI/CD
Warsaw MuleSoft Meetup #6 - CI/CD
 
Mule soft step up session
Mule soft step up sessionMule soft step up session
Mule soft step up session
 
Learn mulesoft from scratch
Learn mulesoft from scratchLearn mulesoft from scratch
Learn mulesoft from scratch
 

More from Guilherme Pereira Silva

More from Guilherme Pereira Silva (13)

Extending the Mule Runtime - Building a Circuit Breaker Component.pptx
Extending the Mule Runtime - Building a Circuit Breaker Component.pptxExtending the Mule Runtime - Building a Circuit Breaker Component.pptx
Extending the Mule Runtime - Building a Circuit Breaker Component.pptx
 
#2 Building your first connector extending the Mule Java SDK
#2 Building your first connector extending the Mule Java SDK#2 Building your first connector extending the Mule Java SDK
#2 Building your first connector extending the Mule Java SDK
 
MuleSoft Composer - Online Portuguese Meetup Group
MuleSoft Composer - Online Portuguese Meetup GroupMuleSoft Composer - Online Portuguese Meetup Group
MuleSoft Composer - Online Portuguese Meetup Group
 
MuleSoft MuleSoft Meetup - Shared Flows
MuleSoft MuleSoft Meetup -  Shared FlowsMuleSoft MuleSoft Meetup -  Shared Flows
MuleSoft MuleSoft Meetup - Shared Flows
 
São Paulo MuleSoft Meetup - Messaging patterns
São Paulo MuleSoft Meetup - Messaging patternsSão Paulo MuleSoft Meetup - Messaging patterns
São Paulo MuleSoft Meetup - Messaging patterns
 
São Paulo MuleSoft Meetup - Unwired API Led & Custom Polices
São Paulo MuleSoft Meetup - Unwired API Led & Custom PolicesSão Paulo MuleSoft Meetup - Unwired API Led & Custom Polices
São Paulo MuleSoft Meetup - Unwired API Led & Custom Polices
 
São Paulo MuleSoft Meetups - DevOps
São Paulo MuleSoft Meetups - DevOpsSão Paulo MuleSoft Meetups - DevOps
São Paulo MuleSoft Meetups - DevOps
 
Mulesoft Meetup Latam Summit Brazil
Mulesoft Meetup Latam Summit BrazilMulesoft Meetup Latam Summit Brazil
Mulesoft Meetup Latam Summit Brazil
 
São Paulo MuleSoft Meetup - Deployments Models
São Paulo MuleSoft Meetup - Deployments ModelsSão Paulo MuleSoft Meetup - Deployments Models
São Paulo MuleSoft Meetup - Deployments Models
 
São Paulo MuleSoft Meetup #5 - Runtime Fabric
São Paulo MuleSoft Meetup #5 - Runtime FabricSão Paulo MuleSoft Meetup #5 - Runtime Fabric
São Paulo MuleSoft Meetup #5 - Runtime Fabric
 
MuleSoft Meetup São Paulo #4 - November
MuleSoft Meetup São Paulo #4 - NovemberMuleSoft Meetup São Paulo #4 - November
MuleSoft Meetup São Paulo #4 - November
 
MuleSoft São Paulo Meetup #3 - 18 Jun
MuleSoft São Paulo Meetup #3 - 18 JunMuleSoft São Paulo Meetup #3 - 18 Jun
MuleSoft São Paulo Meetup #3 - 18 Jun
 
São Paulo MuleSoft Meetup - 31 Jan
São Paulo MuleSoft Meetup - 31 JanSão Paulo MuleSoft Meetup - 31 Jan
São Paulo MuleSoft Meetup - 31 Jan
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 

Building APIs with Mule and Spring Boot

  • 1. 2021-07-21 MuleSoft for Java Devs - Meetup Group Building APIs with Mule and SpringBoot
  • 2. 2 ● Introductions ● Mule & Java ● API Lifecycle ○ Building MuleSoft API ○ Building SpringBoot API ● Wrap-up ● Trivia - Win a MuleSoft Course Agenda Sponsor:
  • 3. Integration Architect at Infomentum ● More than 13 years working with development. Start with Java in 2008! ● Since 2014 working with MuleSoft ● MuleSoft Ambassador & Meetup Leader Guilherme Pereira
  • 4. •Enterprise Architect / Mulesoft Technical Instructor •EMEA (Milan, Italy) •Background: –25+ yrs exp. Software Engineer, Developer, Trainer, Translator –MuleSoft, Java, .NET, Python, Node.Js, Oracle Cloud, Google Cloud, AWS, CNCF Kubernetes Specialist, UML/SysML Certified Expert, PMI PMP, TOGAF 9.1 •Certified MuleSoft Developer (MCD), Certified MuleSoft Integration Architect (MCIA), Cert Mule Platform Architect (MCPA) Thimoty Barbieri, PhD https://www.linkedin.com/in/thimoty/
  • 6. 6 ● Mule started as an open-source project later in 2003 ○ A powerful & lightweight ESB runtime ○ Implemented several features to send, publish, route, transform messages ○ Had a great adoption with thousands of downloads and improvements during the years ○ The Mule core stills as an open-source project until nowadays Mule is based on Java
  • 7. 7 From open-source to the Anypoint Platform ● Mule Runtime: ○ Java under the hoods ○ Lightweight ESB ○ Scalable ○ EDA ○ Automatic thread controls ○ Streaming ○ Batch ○ Persistent queues ○ Cache Mule
  • 8. 8 From open-source to the Anypoint Platform ● Connectors & modules ○ 200+ connectors ○ Salesforce, SAP, Workday and more... ○ Plug & Play ○ Databases, Queues, File and more... ○ Connect everything ○ Extend with the SDK Mule Anypoint Connectors
  • 9. 9 From open-source to the Anypoint Platform ● Design & Portals ○ Design your APIs first ○ Mock and console ○ Publish your assets ○ Create API Portals ○ Discover APIs and fragments Anypoint Design Center Anypoint Exchange Studio API Designer Connector DevKit Mule Anypoint Connectors
  • 10. 10 From open-source to the Anypoint Platform ● Management & Monitoring ○ Manage your APIs & Integrations ○ Monitoring ○ Alerts ○ Secure APIs ○ Out-of-the box policies ○ Custom policies Anypoint Design Center Anypoint Management Center Anypoint Exchange Studio API Designer Connector DevKit Runtime Manager API Manager Analytics Mule Anypoint Connectors
  • 11. 11 From open-source to the Anypoint Platform Anypoint Design Center Anypoint Management Center Anypoint Exchange Studio API Designer Connector DevKit Runtime Manager API Manager Analytics Runtime Services Mule Anypoint Connectors ● Run & Scale ○ Run on Cloud, On-Prem or Hybrid ○ Easy to deploy ○ Scale ○ Run with Kubernetes ○ Object Store and Queues ○ Cloud MQ Message Broker
  • 13. Use case 13 ● Create an API to integrate with Salesforce ● Query Contacts and return as JSON format
  • 14. “Doing It All” with MuleSoft (clone full working demo from: https://github.com/gui1207/sfdc-contacts-sys-api)
  • 16. Step 1: Design the API Contract 16
  • 17. Step 2: Implement & Test locally 17
  • 20. “Doing It All” with Spring Boot (clone full working demo from: https://github.com/thimotyb/salesforce-springboot-demo)
  • 21. Step 1: Connecting to SalesForce 21 - We will use the Enterprise SOAP API with the approach described at - https://developer.salesforce.com/docs/atlas.en- us.api.meta/api/sforce_api_quickstart_steps.htm - There are other you can use, e.g. Bulk API 2.0 https://developer.salesforce.com/docs/atlas.en- us.api_asynch.meta/api_asynch/api_asynch_introduction_bulk_api.htm - Or Streaming API https://developer.salesforce.com/docs/atlas.en- us.api_streaming.meta/api_streaming/intro_stream.htm - Download Enterprise WSDL for correct Salesforce Version from DevPortal - Use WSC tool to generate Java skeletons and Data Models of the entire Enterprise API - java –classpath pathToJAR/wsc-22.jar com.sforce.ws.tools.wsdlc pathToWsdl/WsdlFilename​ pathToOutputJar/OutputJarFilename - The WSDL is huge, lots of problems trying to auto-generate in-line with the maven jax2 tooling - An enterprise.jar system dependency specific for your Salesforce version is created, to be included in the project
  • 22. 22
  • 23. 23 - Service as a Singleton can be Autowired in implementation - Configuration is separated in application.proper ties and injected at service boot Step 1: Connection @Service
  • 24. 24 - The OAS YAML definition was provided and integrated in the project manually - Endpoint Controller Interface and Data Model are auto generated with openapi-generator-maven-plugin - Several other maven dependencies are necessary to make it properly work Step 2: Integrating the API Design
  • 25. 25 - The interface is generated in maven’s target dir and cannot be modified - Implementation should be done as separate @Service implementing this interface - Spring’s IOC will take care of the rest Step 2: Auto-generated Interface
  • 26. 26 - Each Endpoint is implemented as a Service - Implement the Auto-Generated Interface - Inject the Connector - Perform (Hard-code?) the query - Fetch the resulting Record - Handle Errors - Prepare the Response - DTO Mapping - From the Enteprise.jar library -> Data Model from the OAS Spec - Manually?! Step 3: Implementing the Endpoints
  • 27. 27 Step 3: Implementation Implement auto- generated interface Override interface default methods
  • 28. 28 Streaming/Paging? Use Bulk API 2.0 or Streaming API (CornetD) 1:1 Data Mapping across DTO’s? Hard-Coded Query?
  • 29. 29 - We use the following maven plugins - surefire for unit testing / spring mocks - springboot for packaging as single jar - docker plugin for containerization with Dockerfile - Package, install, create container with - mvn clean install docker:build (-DskipTests=true to skip tests?) - Also useful - maven release (auto-manage package versions / Release / Snapshot) - use push goal to push container to Docker Registry Step 4: DevOps
  • 30. 30 - We will use a Minikube free instance at https://katacoda.com/javajon/courses/kubernetes-fundamentals/minikube - Create a deployment, expose as a LoadBalanced service, check the status: - kubectl create deployment salesforce-service --image=thimoty/salesforce-service - kubectl expose deployment salesforce-service --port=80 --target-port=8080 -- type=LoadBalancer - kubectl get po,svc -o wide - The service is now reachable and deployment can be scaled up/down - Need a Service Mesh (e.g. Istio) for Proxy Handling Step 5: Deploy
  • 31. 31 - k8s Dashboard - Need to setup Prometheus/Graphana - Need to setup ELK Stack - Config Backup: Velero - Security? Certificates? - … LOTS of additional stuff on top of plain vanilla k8s!!! Step 6: Observability/Monitoring/Operations
  • 33. Task Comparison Table 33 Task SpringBoot MuleSoft Salesforce Connector: Prepare WSDL, Stub/Skeleton Download Enterprise API WSDL, use wsc to create dependency Just use the Salesforce Connector API Design Use OAS Maven endpoint generator plugin API Kit from Design Center Service Implementation Need to implement the interface, prepare the query, iterate the records, create ad- hoc error handling. No OOTB Paging/Streaming Just leverage Mule’s Streaming Saleforce connector, use Query, Trasform and Mule 3-tier error handling DTO Mapping Need to explicitly write “glue code” for each combination, choose the correct API typology (Enterprise, Partner, Batch, Streaming…) Use DataWeave!!! DevOps / Containerization Use Maven plugins and Dockerization with Dockerfile Just upload the Mule app to CloudHub!!!
  • 34. What is missing? 34 Task SpringBoot MuleSoft Security Add Spring Security, roll your own Load Balancers, install a Vault... Anypoint Platform provides integrated services such as: Vault, Secret Management, Safely Hidden Properties API Gateway Proxy - External API Manager Anypoint Platform provides integrated API Manager capabilities and out of the box policies Performance / Throughput Current implementation is pretty much sequential MuleSoft uses OTTB Spring Flux and Streaming under the hood and Logging Properly use log4j and Logstash (TBD) Anypoint Platform Logging Monitoring If running in a container, use the orchestrator’s monitoring facilities Anypoint Platform Monitoring Docker Image Maintenance Need to keep checking security of base images of containers. Implement Registry Scanner. Anypoint Runtime Fabric
  • 35. 35 ● Final thoughts: ○ Pain points: ■ Difficult to implement just using plain code ■ Need user libs to create skeleton ■ Implement auth methods ○ Implementing with Mule ■ Out of box Connectors ■ CloudHub / Monitoring / API Manager ■ Drag and drop Wrap up
  • 36. 36 ● Register to the Free MuleSoft Course: ○ https://mule.is/LearnMule ● Share: ○ Tweet using the hashtag #MuleSoftMeetups ○ Invite your network to join: https://meetups.mulesoft.com/mulesoft-for-java-developers/ ● Feedback: ○ Fill out the survey feedback and suggest topics for upcoming events ○ Contact MuleSoft at meetups@mulesoft.com for ways to improve the program What’s next?
  • 37. Your chance to win an Instructor-led MuleSoft course Trivia
  • 38. 38 ● You can win only 1 voucher per month, across all Meetups. If you already won 1 voucher in the month from another event, you will not receive a new one. ● The first 3 ranked in the game win a voucher ● Use your name in the game - avoid nicknames ● To request the voucher you should send a email to gui1207@gmail.com or use the "contact the organizer form" on the meetup group page ● If using Kahoot, go to kahoot.com with your browser on desktop or smartphone ○ Select “Play” ○ Type the Game PIN you are given during the session ○ The contest with kahoot could be capped, so only the first 100 users that log in get to participate Rules