SlideShare ist ein Scribd-Unternehmen logo
1 von 65
Downloaden Sie, um offline zu lesen
@GuimaraesSv @CesarHgt @tomitribe
Rafael Guimarães, César Hernández
Keeping Brazil’s Medical Industry
Safe with MicroProfile
@GuimaraesSv @CesarHgt @tomitribe
SPEAKERS
Rafael Guimarães
● Software Engineer
● GBR Systems.
● +27 experience in Medical and Judicial
areas in Brazil.
● University faculty professor.
● Focused on distributed software
architectures.
César Hernández
● Senior Software Engineer at Tomitribe
● Oracle Java Champion and
Groundbreaker Ambassador
● Duke’s Choice Award 2016, 2017
● Oracle Certified Professional
● +14 experience with Java EE
● Apache TomEE and Eclipse Committer,
Microprofile Contributor.
● Open Source advocate, writer, teacher
and public speaker
@GuimaraesSv @CesarHgt @tomitribe
Agenda
● Brazilian health care system Overview
● Base System
● Boosting Brazilian healthcare systems with Jakarta EE, Eclipse
MicroProfile and Apache TomEE
● Contribution to the COVID-19 Response
● Lessons Learned
@GuimaraesSv @CesarHgt @tomitribe
@GuimaraesSv @CesarHgt @tomitribe
5 major regions
26 states / 5570 cities
1 federal district
Brazilian health care system Overview
211M
People
521kDoctors
152kHealth Service
Providers
6th largest population
(behind China, India, United
States, Indonesia, Pakistan)
source:
http://cnes.datasus.gov.br
http://fiscalizacao.cfm.org.br/
https://population.un.org/wpp/Download/Standard/Population/
5th largest country
(behind Russia, Canada,
China, United States)
@GuimaraesSv @CesarHgt @tomitribe
Brazilian health care system Overview
15,8
Million people
North
16
Million people
Midwest
Million people
53
Northeast
80,3
27,3
Southeast
Million people
Million people
South
source:
http://cnes.datasus.gov.br
http://fiscalizacao.cfm.org.br/
https://population.un.org/wpp/Download/Standard/Population/
@GuimaraesSv @CesarHgt @tomitribe
source:
http://cnes.datasus.gov.br
http://fiscalizacao.cfm.org.br/
https://population.un.org/wpp/Download/Standard/Population/
Brazilian health care system Overview
North
Midwest
Northeast
South
1 doctor / 1.1k
1 provider / 4.1k
Southeast
1 doctor / 5.1k
1 provider / 30k
1 doctor / 5.6k
1 provider / 31k
1 doctor / 1.6k
1 provider / 6.5k 1 doctor / 1.3k
1 provider / 4.7k
WHO recommends:
1 doctor / 1k
@GuimaraesSv @CesarHgt @tomitribe
Brazilian health care system Overview
Public health
103billions/year
reaching
75%of the population
Supplementary health
90,5billions/year
reaching
25%of the population
@GuimaraesSv @CesarHgt @tomitribe
Medical Practice!
Brazilian health care system - Actors
Medicine
Council
Government Health Departments
Control
Regulation
Policies
Sanitary Surveillance
Licences
Records
Professional Discipline
Ethical Judgment
Licence to work
Keep Records
Inspections
Complains
Guiding
Integrations
Information Sharing
Medicine
Schools
&
Residency
Programs
Learning, Training, Specializing
Counselors
&
Inspectors
Health Service
Providers
Doctors
Patients
@GuimaraesSv @CesarHgt @tomitribe
Brazilian health care system - Challenges
● Large and Complex
○ Inequalities
○ Difficult governance
○ 30 different Medical Specialties, 20 types of Health Service Providers
○ High frequency of Policy and Rule changes
● Difficult medicine practice
○ Poor infrastructure - high risk
○ Proliferation of medical schools - bad quality professionals
● Incomplete institutional information exchange
○ Diversity of technologies, legacy systems and standards
@GuimaraesSv @CesarHgt @tomitribe
Brazilian health care system - Challenges
● How to make good quality inspection reports, with agility, especially
considering the high amount of laws, recommendations, policies and
standards? And to create good statistics of those reports ?
● How to access legacy system data of other government departments without
bureaucracy, to check licences, records and information integrity ? Is the data
safe, monitored, fast, reliable ?
● What could be done to facilitate interaction between the doctors and the
council?
@GuimaraesSv @CesarHgt @tomitribe
Brazilian health care system - Challenges
● Which service providers or doctors are working irregularly?
● What about medical advertising, are doctors respecting each other? Are their
advertisements deceiving patients to patients ? (Or even lying !?!)
● What if a patient goes to a clinic doing an endoscopic procedure, which
needs sedation, and he has a bad reaction to the anesthetic, and ends up
dying?
○ Did the life support equipment work properly ? Did the doctor do the
procedure correctly?
○ What is the real cause? Should the council revoke the doctor's work
license?
○
@GuimaraesSv @CesarHgt @tomitribe
@GuimaraesSv @CesarHgt @tomitribe
About GBR
● Founded in 2008
● Consulting, Software Engineering & Architecture, Training
● Applications:
○ support Inspectors and Counselors in their principal job -
Professional Discipline, Guiding, Inspections
○ online services that control the Doctors and Service Providers
in their “life cycle” within Councils
○ to do quality auditing and certification of medical schools
@GuimaraesSv @CesarHgt @tomitribe
Base system
Federal Council - National Inspections Platform
● support Inspectors and Counselors in their principal job -
Professional Discipline, Guiding, Inspections
● Modules:
○ Inspections Control and Scheduling
○ Inspection execution - checklists, images,
notifications, dynamic forms.
○ Reports, Statistics
@GuimaraesSv @CesarHgt @tomitribe
Base system
Regional Council - Online Services
● Support Doctors and Health Service Providers (as
Technical Director) in their “life cycle” within Council - from
start of Medicine Practice to retirement.
● More than 40 types of services:
○ First Registration, Transfers States, Secondary
Licence, Fee payment, Certificates, Profile
update, Renew Licence, etc.
○ Tools for back office employees
@GuimaraesSv @CesarHgt @tomitribe
Base system
Federal Council - Accreditation Platform SAEME
● Support Counselors and the Education Medical
Association to do quality auditing and certification
of medical schools
● Covers whole process of auditing and evaluation
● Recognized by World Federation for Medical
Education
@GuimaraesSv @CesarHgt @tomitribe
Base system
Server
● JAVA EE 6
● Jboss7
● Tomcat 6, 7
Client
● Adobe Flex
● Adobe Air
● Angular JS 1
Data Integration
● Kettle
ON-PREMISSE!
@GuimaraesSv @CesarHgt @tomitribe
About GBR coverage
Federal Medical
Council Nationwide
Regional
Medical Councils
National Inspection
Platform
CFM
Accreditation of
Medical Schools -
SAEME
South
Regional Santa Catarina
CRMSC
South
Regional Rio Grande do Sul
CREMERS
@GuimaraesSv @CesarHgt @tomitribe
Base system
@GuimaraesSv @CesarHgt @tomitribe
Backend Architecture Roadmap
● Improve overall system architecture
○ Java EE 6 → Jakarta EE8
○ Security
○ Fault Tolerance
○ Performance
○ Monitoring
● API Gateway
○ Secure OAuth 2.0 + HTTP signatures
○ Microservice Monitoring and routing
○ Standard Integrations - RMI, SOAP, → REST
● Cloud Native
○ Different cloud providers
● Provide APIs to other institutions
● javax -> jakarta namespace
@GuimaraesSv @CesarHgt @tomitribe
@GuimaraesSv @CesarHgt @tomitribe
(formerly known as Java EE)
@GuimaraesSv @CesarHgt @tomitribe
Eclipse foundation
https://www.eclipse.org/membership/documents/eclipse-foundation-overview.pdf
360+ 275+ 1550+
195M+ 15 30
@GuimaraesSv @CesarHgt @tomitribe
Eclipse foundation, EE4J, Java EE, and Jakarta EE
@GuimaraesSv @CesarHgt @tomitribe
@GuimaraesSv @CesarHgt @tomitribe
Eclipse MicroProfile
● An open-source community specification
● Focus on Enterprise Java microservices
● Generates: SPEC, API, and TCK.
● https://microprofile.io
● Implemented by different vendors.
@GuimaraesSv @CesarHgt @tomitribe
Eclipse MicroProfile
MicroProfile 3.3
JAX-RS 2.1JSON-P 1.1CDI 2.0
Config
Fault
Tolerance
JWT
Propagation
HealthMetrics
Open
Tracing
Open API Rest Client
JSON-B 1.0
@GuimaraesSv @CesarHgt @tomitribe
@GuimaraesSv @CesarHgt @tomitribe
● Apache Tomcat + Java EE = Apache TomEE
● Built from Apache components
● MicroProfile compliant
● Footprint: 30MB zip, 100~MB memory
● TomEE 9.0.0-M3 (javax -> jakarta)
● tomee.apache.org
@GuimaraesSv @CesarHgt @tomitribe
Apache TomEE
TomEE JAX-RS Microprofile
Java Server Pages
(JSP)
Java Server Faces
(JSF)
Java Transaction
API (JTA)
Bean Validation
Enterprise
JavaBeansJavaMail API
Java API for
RESTful Web
Services (JAX-RS)
Java Persistence
API (JPA)
Contexts and
Dependency
Injection (CDI)
Java Servlets
Java
Authentication and
Authorization
Service (JAAS)
Java Authorization
Contract for
Containers (JACC)
http://tomee.apache.org/comparison.html
@GuimaraesSv @CesarHgt @tomitribe
http://tribestream.io/
@GuimaraesSv @CesarHgt @tomitribe
Migration scenarios
• The javax.* namespace
egrep -lRZ 'javax' . | xargs -0 -l sed -i -e 's/javax/jakarta/g'
branch / Jakarta 8 & MicroProfile 3
Service #
master / Jakarta 9.x & MicroProfile 4?
@GuimaraesSv @CesarHgt @tomitribe
Migration scenarios
• Bytecode level
• No branches. No forks. No merge-conflict hell. Just two separate binaries
from the same source;
masterService #
Jakarta 9.x & MicroProfile 4?
Jakarta 8 & MicroProfile 3
@GuimaraesSv @CesarHgt @tomitribe
Jakarta EE 9 Server Up and Running
Get the Binary :)
1. Download apache-tomee-9.0.0-M3-microprofile.zip from
https://tomee.apache.org
2. unzip apache-tomee-9.0.0-M3-microprofile.zip
3. chmod +x apache-tomee-microprofile-9.0.0-M3/bin/catalina.sh
4. ./apache-tomee-microprofile-9.0.0-M3/bin/catalina.sh run
@GuimaraesSv @CesarHgt @tomitribe
Build and run
1. wget https://github.com/apache/tomee/archive/tomee-project-8.0.4.zip
2. unzip tomee-project-8.0.4.zip
3. cd tomee-tomee-project-8.0.4/examples/mp-custom-healthcheck
4. idea . #Or your favorite IDE
5. mvn verify
6. Inspec mp-custom-healthcheck-jakartaee9-8.0.4.war
7. target/mp-custom-healthcheck-jakartaee9-8.0.4.war
<TomEE9M3_HOME>/webapps
Jakarta and MicroProfile Project
@GuimaraesSv @CesarHgt @tomitribe
Jakarta EE 9 Up and Running
Test the application
curl -X POST http://localhost:8080/moviefun-rest-jakartaee9-8.0.4/rest/load
curl -s http://localhost:8080/moviefun-rest-jakartaee9-8.0.4/rest/movies/ | jq
open https://tomee.apache.org/tomee-9.0/examples/moviefun-rest.html
@GuimaraesSv @CesarHgt @tomitribe
@GuimaraesSv @CesarHgt @tomitribe
Telemedicine Support - Doctor's Prescriptions System
● 5 days development
○ REST API
● Some integrations
○ Doctor's space login, Federal Companies Database, Pharmacies Database, Google
Authenticator (two factor auth)
● Sensitive data protection
○ Attribute Converter
Medical Practice!
Digital Prescription Digital Prescription
Doctor Patient Pharmacy
Receive / Validate
Emit
@GuimaraesSv @CesarHgt @tomitribe
Telemedicine Support - Doctor's Prescriptions System
Digital Prescription
@GuimaraesSv @CesarHgt @tomitribe
Telemedicine Support - Doctor's Prescriptions System
@GuimaraesSv @CesarHgt @tomitribe
Telemedicine Support - Doctor's Prescriptions System
● Almost 580K prescriptions in south of Brazil installations-- since Mar/ 2020.
Santa Catarina State Rio Grande do Sul State
@GuimaraesSv @CesarHgt @tomitribe
Lessons learned so far in the journey
@GuimaraesSv @CesarHgt @tomitribe
MicroProfile Config
Before
● Sensitive information within project files
● Complex properties customizations
● Infrastructure environment management was painful
@GuimaraesSv @CesarHgt @tomitribe
Config
After
● Sensitive information decoupled from the application code
● Container friendly
● Easy hierarchy for environment variables vs maven -D
● Allow easy container horizontal scaling
@GuimaraesSv @CesarHgt @tomitribe
MP Configuration
@Inject
@ConfigProperty(name = "log.enabled", defaultValue = "true")
private Boolean logEnabled;
@Inject
private JsonWebToken token;
public void info(String message) {
if (logEnabled) {
if (token == null || !token.claim("email").isPresent()) {
logger.info(message);
} else {
logger.info(token.claim("email").get() + " - " + message);
}
}
}
@GuimaraesSv @CesarHgt @tomitribe
Before
● Manual process and lack of coverage
● Disperse monitoring
● Hard to trace
● “It’s slow”, “a glitch”, “restarts”
● Reactive most of the time
Health Check + Metrics
@GuimaraesSv @CesarHgt @tomitribe
After
● JSON base alerts are now centralized and provide unified notifications
● Custom rules base on standard status
● Proactiveness since the last 3 months
● Improves user satisfaction
Health Check + Metrics
@GuimaraesSv @CesarHgt @tomitribe
Microprofile HealthCheck
@Health
@ApplicationScoped
public class DatabaseHealthCheck implements HealthCheck {
@PersistenceContext(unitName = "crvirtual_unit")
protected EntityManager manager;
@Override
public HealthCheckResponse call() {
HealthCheckResponseBuilder responseBuilder = HealthCheckResponse.named("oracle");
try {
String result = (String) manager.createNativeQuery("select * from dual").getSingleResult();
if(result.equals("X")){
return responseBuilder.up().build();
} else {
return responseBuilder.down().build();
}
} catch (Exception e) {
return responseBuilder.withData("error", e.getMessage()).down().build();
}
}
}
@GuimaraesSv @CesarHgt @tomitribe
Microprofile HealthCheck
@GuimaraesSv @CesarHgt @tomitribe
JWT Authentication
Before:
● Basic HTTP Auth with session management
● Challenges for microservices
○ New stateless security requirement
○ Authentication and Authorization between microservices
○ Overhead and single point of failure
@GuimaraesSv @CesarHgt @tomitribe
JWT Authentication
After:
● OAuth 2.0 JWT
○ Stateless security
○ Authentication and Authorization between microservices
○ State was kept on the server and pointer on the client side
@GuimaraesSv @CesarHgt @tomitribe
Microprofile JWT
/** Microprofile JWT **/
@Inject
private JsonWebToken token;
/** Microprofile Config **/
@Inject
@ConfigProperty(name = "log.enabled", defaultValue = "true")
private Boolean logEnabled;
private Logger logger = Logger.getLogger(CrVirtualLogger.class.getName());
public void info(String message) {
if (logEnabled) {
if (token == null || !token.claim("email").isPresent()) {
logger.info(message);
} else {
logger.info(token.claim("email").get() + " - " + message);
}
}
}
@GuimaraesSv @CesarHgt @tomitribe
Authentication
● Protected Access into Medical Knowledge databases
@GuimaraesSv @CesarHgt @tomitribe
Authentication
● Protected Access into Federal Companies Database
@GuimaraesSv @CesarHgt @tomitribe
Rest Client
Before
● JAX-RS Client
● No type-safe
● Service needed to be understood
● Request needed to be built by hand every time
● Not the best reusability of the code
@GuimaraesSv @CesarHgt @tomitribe
Rest Client
After
● Type-safe approach
● Usage of interfaces to call the services
● Header propagation and handling made easy
● Smooth JWT propagation
@GuimaraesSv @CesarHgt @tomitribe
@Dependent
@RegisterRestClient
public interface SerproSearchClient {
@POST
@Consumes(MediaType.APPLICATION_JSON)
public Response getToken(String body);
@GET
public Response searchCompany(@HeaderParam("Authorization") String key,
@HeaderParam("Accept") String accept);
}
Microprofile RestClient
@GuimaraesSv @CesarHgt @tomitribe
Microprofile RestClientimport org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
import javax.enterprise.context.Dependent;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.util.List;
@RegisterRestClient
@Path("api/doctors")
public interface DoctorResourceClient {
@GET
@Path("{id}")
@Produces(MediaType.APPLICATION_JSON)
Doctor find(@PathParam("id") Long id);
@GET
List<Doctor> getDoctors();
@POST
@Consumes("application/json")
Doctor addDoctor(Doctor doctor);
@GuimaraesSv @CesarHgt @tomitribe
Microprofile RestClientimport org.superbiz.moviefun.mpclient.DoctorResourceClient;
@Inject
@RestClient
private DoctorResourceClient doctorResourceClient;
public void printAllDoctors(){
List<Doctor> doctors = doctorResourceClient.getDoctors();
for (Doctor doctor : doctor) {
LOGGER.info(doctor.toString());
}
}
public void addNewDoctor() {
Doctor newDoctor = new Doctor ("7","Doctor 007.");
doctorResourceClient.addDoctor(newDoctor);
}
@GuimaraesSv @CesarHgt @tomitribe
Before
● Legacy system was not well document
● Documentation not fully aligned with master code
○ Duplication of code
○ Design first approach not trustable
OpenAPI
@GuimaraesSv @CesarHgt @tomitribe
OpenAPI
After
● Standard visibility
● Find duplication of code
● Allowed API design approach
● swagger-ui
@GuimaraesSv @CesarHgt @tomitribe
OpenAPI
@Operation(description = "To search Doctors by their record number")
@APIResponses({
@APIResponse(responseCode = "200", description = "Success",
content = @Content(schema = @Schema(implementation = User.class))),
@APIResponse(responseCode = "400", description = "Bad Request") })
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("{recordNumber}")
public Response getDoctor(@PathParam("recordNumber") Long recordNumber) {
try {
logger.info("searching Doctors by record number");
return Response.ok(dao.getByRecordNumber(recordNumber)).build();
} catch (Exception e) {
throw new WebApplicationException(
Response.status(Response.Status.BAD_REQUEST).entity(new ErrorMessages(e.getMessage())).build());
}
}
@GuimaraesSv @CesarHgt @tomitribe
OpenAPI
@GuimaraesSv @CesarHgt @tomitribe
Thank you
Rafael Guimarães, César Hernández
Keeping Brazil’s Medical Industry
Safe with MicroProfile

Weitere ähnliche Inhalte

Ähnlich wie Keeping brazil's medical industry safe with Micro Profile and JakartaEE - Jakarta One 2020

ResearchDevelopment RA SA - Overview - Linkedin 19Aug15
ResearchDevelopment RA SA - Overview - Linkedin 19Aug15ResearchDevelopment RA SA - Overview - Linkedin 19Aug15
ResearchDevelopment RA SA - Overview - Linkedin 19Aug15
Pablo Liuboschitz
 
Microsoft: A Waking Giant In Healthcare Analytics and Big Data
Microsoft: A Waking Giant In Healthcare Analytics and Big DataMicrosoft: A Waking Giant In Healthcare Analytics and Big Data
Microsoft: A Waking Giant In Healthcare Analytics and Big Data
Health Catalyst
 
Surepath labs company profile
Surepath labs company profileSurepath labs company profile
Surepath labs company profile
Himanshu Sachdeva
 

Ähnlich wie Keeping brazil's medical industry safe with Micro Profile and JakartaEE - Jakarta One 2020 (20)

Keeping brazil's medical industry safe with Micro Profile and JakartaEE - Jak...
Keeping brazil's medical industry safe with Micro Profile and JakartaEE - Jak...Keeping brazil's medical industry safe with Micro Profile and JakartaEE - Jak...
Keeping brazil's medical industry safe with Micro Profile and JakartaEE - Jak...
 
Keeping brazil's medical industry safe with Micro Profile [TDC 2021]
Keeping brazil's medical industry safe with Micro Profile [TDC 2021]Keeping brazil's medical industry safe with Micro Profile [TDC 2021]
Keeping brazil's medical industry safe with Micro Profile [TDC 2021]
 
Seattle code camp 2016 - Role of Data Science in Healthcare
Seattle code camp 2016  - Role of Data Science in HealthcareSeattle code camp 2016  - Role of Data Science in Healthcare
Seattle code camp 2016 - Role of Data Science in Healthcare
 
Seattle Code Camp 2016- Role of Data Science in Healthcare
Seattle Code Camp 2016- Role of Data Science in HealthcareSeattle Code Camp 2016- Role of Data Science in Healthcare
Seattle Code Camp 2016- Role of Data Science in Healthcare
 
Seattle Code Camp 2016- Role of Data Science in HHealthcare
Seattle Code Camp 2016- Role of Data Science in HHealthcareSeattle Code Camp 2016- Role of Data Science in HHealthcare
Seattle Code Camp 2016- Role of Data Science in HHealthcare
 
Seattle Code Camp 2016- Role of Data Science in Healthcare
Seattle Code Camp 2016- Role of Data Science in HealthcareSeattle Code Camp 2016- Role of Data Science in Healthcare
Seattle Code Camp 2016- Role of Data Science in Healthcare
 
Remote Urine Analysis for Cancer Patients At Home Using Machine Learning
Remote Urine Analysis for Cancer Patients At Home Using Machine LearningRemote Urine Analysis for Cancer Patients At Home Using Machine Learning
Remote Urine Analysis for Cancer Patients At Home Using Machine Learning
 
ResearchDevelopment RA SA - Overview - Linkedin 19Aug15
ResearchDevelopment RA SA - Overview - Linkedin 19Aug15ResearchDevelopment RA SA - Overview - Linkedin 19Aug15
ResearchDevelopment RA SA - Overview - Linkedin 19Aug15
 
Liferay for Healthcare IT Solutions
Liferay for Healthcare IT Solutions  Liferay for Healthcare IT Solutions
Liferay for Healthcare IT Solutions
 
Business ideas pitch deck - multi project - Canada
Business ideas pitch deck - multi project - CanadaBusiness ideas pitch deck - multi project - Canada
Business ideas pitch deck - multi project - Canada
 
Main zota abstract
Main zota abstractMain zota abstract
Main zota abstract
 
PYA Looks Beyond Meaningful Use at AHIMA
 PYA Looks Beyond Meaningful Use at AHIMA PYA Looks Beyond Meaningful Use at AHIMA
PYA Looks Beyond Meaningful Use at AHIMA
 
Report out: IoT-based Healthcare Services
Report out: IoT-based Healthcare Services  Report out: IoT-based Healthcare Services
Report out: IoT-based Healthcare Services
 
Resume Louis J Schwartz
Resume Louis J SchwartzResume Louis J Schwartz
Resume Louis J Schwartz
 
Research and Development Solutions | Accenture
Research and Development Solutions | AccentureResearch and Development Solutions | Accenture
Research and Development Solutions | Accenture
 
Microsoft: A Waking Giant In Healthcare Analytics and Big Data
Microsoft: A Waking Giant In Healthcare Analytics and Big DataMicrosoft: A Waking Giant In Healthcare Analytics and Big Data
Microsoft: A Waking Giant In Healthcare Analytics and Big Data
 
Microsoft: A Waking Giant in Healthcare Analytics and Big Data
Microsoft: A Waking Giant in Healthcare Analytics and Big DataMicrosoft: A Waking Giant in Healthcare Analytics and Big Data
Microsoft: A Waking Giant in Healthcare Analytics and Big Data
 
Surepath labs company profile
Surepath labs company profileSurepath labs company profile
Surepath labs company profile
 
EU Medical Device Regulation: Preparing for Disruptive (yet Incomplete) Regu...
EU Medical Device Regulation:  Preparing for Disruptive (yet Incomplete) Regu...EU Medical Device Regulation:  Preparing for Disruptive (yet Incomplete) Regu...
EU Medical Device Regulation: Preparing for Disruptive (yet Incomplete) Regu...
 
228129 1000005. pablo-rivero---s-health-upna
228129 1000005. pablo-rivero---s-health-upna228129 1000005. pablo-rivero---s-health-upna
228129 1000005. pablo-rivero---s-health-upna
 

Mehr von César Hernández

Mehr von César Hernández (20)

7 Recomendaciones para migrar tus aplicaciones a Jakarta EE utilizando Apache...
7 Recomendaciones para migrar tus aplicaciones a Jakarta EE utilizando Apache...7 Recomendaciones para migrar tus aplicaciones a Jakarta EE utilizando Apache...
7 Recomendaciones para migrar tus aplicaciones a Jakarta EE utilizando Apache...
 
Paving the road with Jakarta EE and Apache TomEE - JCON 2021
Paving the road with Jakarta EE  and Apache TomEE - JCON 2021Paving the road with Jakarta EE  and Apache TomEE - JCON 2021
Paving the road with Jakarta EE and Apache TomEE - JCON 2021
 
7 recomendaciones para migrar tus aplicaciones a Jakarta EE utilizando Apache...
7 recomendaciones para migrar tus aplicaciones a Jakarta EE utilizando Apache...7 recomendaciones para migrar tus aplicaciones a Jakarta EE utilizando Apache...
7 recomendaciones para migrar tus aplicaciones a Jakarta EE utilizando Apache...
 
Aprende, contribuye, y surfea Cloud Native Java - GuateJUG 2021
Aprende, contribuye, y surfea Cloud Native Java - GuateJUG 2021Aprende, contribuye, y surfea Cloud Native Java - GuateJUG 2021
Aprende, contribuye, y surfea Cloud Native Java - GuateJUG 2021
 
Paving the way with Jakarta EE and Apache TomEE - JCConf
Paving the way with Jakarta EE  and Apache TomEE - JCConfPaving the way with Jakarta EE  and Apache TomEE - JCConf
Paving the way with Jakarta EE and Apache TomEE - JCConf
 
Pavimentando el camino con Jakarta EE 9 y Apache TomEE
Pavimentando el camino con Jakarta EE 9 y Apache TomEE Pavimentando el camino con Jakarta EE 9 y Apache TomEE
Pavimentando el camino con Jakarta EE 9 y Apache TomEE
 
It is easy contributing to open source - JCON 2020
It is easy contributing to open source - JCON 2020It is easy contributing to open source - JCON 2020
It is easy contributing to open source - JCON 2020
 
It is easy contributing to Open Source - ECLIPSE CON 2020
It is easy contributing to Open Source - ECLIPSE CON 2020It is easy contributing to Open Source - ECLIPSE CON 2020
It is easy contributing to Open Source - ECLIPSE CON 2020
 
Paving the way with Jakarta EE and apache TomEE at cloudconferenceday
Paving the way with Jakarta EE and apache TomEE at cloudconferencedayPaving the way with Jakarta EE and apache TomEE at cloudconferenceday
Paving the way with Jakarta EE and apache TomEE at cloudconferenceday
 
Pavimentando el Camino con Jakarta EE 9 y Apache TomEE 9.0.0
Pavimentando el Camino con Jakarta EE 9 y Apache TomEE 9.0.0Pavimentando el Camino con Jakarta EE 9 y Apache TomEE 9.0.0
Pavimentando el Camino con Jakarta EE 9 y Apache TomEE 9.0.0
 
Creando microservicios con java micro profile y tomee - CUNORI 2020
Creando microservicios con java micro profile y tomee - CUNORI 2020Creando microservicios con java micro profile y tomee - CUNORI 2020
Creando microservicios con java micro profile y tomee - CUNORI 2020
 
Paving the way with Jakarta EE and Apache TomEE - itkonekt 2020
Paving the way with Jakarta EE and Apache TomEE - itkonekt 2020Paving the way with Jakarta EE and Apache TomEE - itkonekt 2020
Paving the way with Jakarta EE and Apache TomEE - itkonekt 2020
 
Creando microservicios con Java MicroProfile y TomEE - OGBT
Creando microservicios con Java MicroProfile y TomEE  - OGBTCreando microservicios con Java MicroProfile y TomEE  - OGBT
Creando microservicios con Java MicroProfile y TomEE - OGBT
 
Creando microservicios con Java, Microprofile y TomEE - Baranquilla JUG
Creando microservicios con Java, Microprofile y TomEE - Baranquilla JUGCreando microservicios con Java, Microprofile y TomEE - Baranquilla JUG
Creando microservicios con Java, Microprofile y TomEE - Baranquilla JUG
 
Creando microservicios con Java y Microprofile - Nicaragua JUG
Creando microservicios con Java y Microprofile - Nicaragua JUGCreando microservicios con Java y Microprofile - Nicaragua JUG
Creando microservicios con Java y Microprofile - Nicaragua JUG
 
Es fácil contribuir al open source - Bolivia JUG 2020
Es fácil contribuir al open source - Bolivia JUG 2020Es fácil contribuir al open source - Bolivia JUG 2020
Es fácil contribuir al open source - Bolivia JUG 2020
 
Its easy! contributing to open source - Devnexus 2020
Its easy! contributing to open source - Devnexus 2020Its easy! contributing to open source - Devnexus 2020
Its easy! contributing to open source - Devnexus 2020
 
Conviértete en un contributor de open source con apache TomEE
Conviértete en un contributor de open source con apache TomEEConviértete en un contributor de open source con apache TomEE
Conviértete en un contributor de open source con apache TomEE
 
Deconstruyendo la seguridad en rest
Deconstruyendo la seguridad en restDeconstruyendo la seguridad en rest
Deconstruyendo la seguridad en rest
 
Open jalpa 2019 - CI y CD en la nube
Open jalpa 2019  - CI y CD en la nubeOpen jalpa 2019  - CI y CD en la nube
Open jalpa 2019 - CI y CD en la nube
 

Kürzlich hochgeladen

Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
UK Journal
 

Kürzlich hochgeladen (20)

Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024
 
Designing for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at ComcastDesigning for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at Comcast
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System Strategy
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
 

Keeping brazil's medical industry safe with Micro Profile and JakartaEE - Jakarta One 2020

  • 1. @GuimaraesSv @CesarHgt @tomitribe Rafael Guimarães, César Hernández Keeping Brazil’s Medical Industry Safe with MicroProfile
  • 2. @GuimaraesSv @CesarHgt @tomitribe SPEAKERS Rafael Guimarães ● Software Engineer ● GBR Systems. ● +27 experience in Medical and Judicial areas in Brazil. ● University faculty professor. ● Focused on distributed software architectures. César Hernández ● Senior Software Engineer at Tomitribe ● Oracle Java Champion and Groundbreaker Ambassador ● Duke’s Choice Award 2016, 2017 ● Oracle Certified Professional ● +14 experience with Java EE ● Apache TomEE and Eclipse Committer, Microprofile Contributor. ● Open Source advocate, writer, teacher and public speaker
  • 3. @GuimaraesSv @CesarHgt @tomitribe Agenda ● Brazilian health care system Overview ● Base System ● Boosting Brazilian healthcare systems with Jakarta EE, Eclipse MicroProfile and Apache TomEE ● Contribution to the COVID-19 Response ● Lessons Learned
  • 5. @GuimaraesSv @CesarHgt @tomitribe 5 major regions 26 states / 5570 cities 1 federal district Brazilian health care system Overview 211M People 521kDoctors 152kHealth Service Providers 6th largest population (behind China, India, United States, Indonesia, Pakistan) source: http://cnes.datasus.gov.br http://fiscalizacao.cfm.org.br/ https://population.un.org/wpp/Download/Standard/Population/ 5th largest country (behind Russia, Canada, China, United States)
  • 6. @GuimaraesSv @CesarHgt @tomitribe Brazilian health care system Overview 15,8 Million people North 16 Million people Midwest Million people 53 Northeast 80,3 27,3 Southeast Million people Million people South source: http://cnes.datasus.gov.br http://fiscalizacao.cfm.org.br/ https://population.un.org/wpp/Download/Standard/Population/
  • 7. @GuimaraesSv @CesarHgt @tomitribe source: http://cnes.datasus.gov.br http://fiscalizacao.cfm.org.br/ https://population.un.org/wpp/Download/Standard/Population/ Brazilian health care system Overview North Midwest Northeast South 1 doctor / 1.1k 1 provider / 4.1k Southeast 1 doctor / 5.1k 1 provider / 30k 1 doctor / 5.6k 1 provider / 31k 1 doctor / 1.6k 1 provider / 6.5k 1 doctor / 1.3k 1 provider / 4.7k WHO recommends: 1 doctor / 1k
  • 8. @GuimaraesSv @CesarHgt @tomitribe Brazilian health care system Overview Public health 103billions/year reaching 75%of the population Supplementary health 90,5billions/year reaching 25%of the population
  • 9. @GuimaraesSv @CesarHgt @tomitribe Medical Practice! Brazilian health care system - Actors Medicine Council Government Health Departments Control Regulation Policies Sanitary Surveillance Licences Records Professional Discipline Ethical Judgment Licence to work Keep Records Inspections Complains Guiding Integrations Information Sharing Medicine Schools & Residency Programs Learning, Training, Specializing Counselors & Inspectors Health Service Providers Doctors Patients
  • 10. @GuimaraesSv @CesarHgt @tomitribe Brazilian health care system - Challenges ● Large and Complex ○ Inequalities ○ Difficult governance ○ 30 different Medical Specialties, 20 types of Health Service Providers ○ High frequency of Policy and Rule changes ● Difficult medicine practice ○ Poor infrastructure - high risk ○ Proliferation of medical schools - bad quality professionals ● Incomplete institutional information exchange ○ Diversity of technologies, legacy systems and standards
  • 11. @GuimaraesSv @CesarHgt @tomitribe Brazilian health care system - Challenges ● How to make good quality inspection reports, with agility, especially considering the high amount of laws, recommendations, policies and standards? And to create good statistics of those reports ? ● How to access legacy system data of other government departments without bureaucracy, to check licences, records and information integrity ? Is the data safe, monitored, fast, reliable ? ● What could be done to facilitate interaction between the doctors and the council?
  • 12. @GuimaraesSv @CesarHgt @tomitribe Brazilian health care system - Challenges ● Which service providers or doctors are working irregularly? ● What about medical advertising, are doctors respecting each other? Are their advertisements deceiving patients to patients ? (Or even lying !?!) ● What if a patient goes to a clinic doing an endoscopic procedure, which needs sedation, and he has a bad reaction to the anesthetic, and ends up dying? ○ Did the life support equipment work properly ? Did the doctor do the procedure correctly? ○ What is the real cause? Should the council revoke the doctor's work license? ○
  • 14. @GuimaraesSv @CesarHgt @tomitribe About GBR ● Founded in 2008 ● Consulting, Software Engineering & Architecture, Training ● Applications: ○ support Inspectors and Counselors in their principal job - Professional Discipline, Guiding, Inspections ○ online services that control the Doctors and Service Providers in their “life cycle” within Councils ○ to do quality auditing and certification of medical schools
  • 15. @GuimaraesSv @CesarHgt @tomitribe Base system Federal Council - National Inspections Platform ● support Inspectors and Counselors in their principal job - Professional Discipline, Guiding, Inspections ● Modules: ○ Inspections Control and Scheduling ○ Inspection execution - checklists, images, notifications, dynamic forms. ○ Reports, Statistics
  • 16. @GuimaraesSv @CesarHgt @tomitribe Base system Regional Council - Online Services ● Support Doctors and Health Service Providers (as Technical Director) in their “life cycle” within Council - from start of Medicine Practice to retirement. ● More than 40 types of services: ○ First Registration, Transfers States, Secondary Licence, Fee payment, Certificates, Profile update, Renew Licence, etc. ○ Tools for back office employees
  • 17. @GuimaraesSv @CesarHgt @tomitribe Base system Federal Council - Accreditation Platform SAEME ● Support Counselors and the Education Medical Association to do quality auditing and certification of medical schools ● Covers whole process of auditing and evaluation ● Recognized by World Federation for Medical Education
  • 18. @GuimaraesSv @CesarHgt @tomitribe Base system Server ● JAVA EE 6 ● Jboss7 ● Tomcat 6, 7 Client ● Adobe Flex ● Adobe Air ● Angular JS 1 Data Integration ● Kettle ON-PREMISSE!
  • 19. @GuimaraesSv @CesarHgt @tomitribe About GBR coverage Federal Medical Council Nationwide Regional Medical Councils National Inspection Platform CFM Accreditation of Medical Schools - SAEME South Regional Santa Catarina CRMSC South Regional Rio Grande do Sul CREMERS
  • 21. @GuimaraesSv @CesarHgt @tomitribe Backend Architecture Roadmap ● Improve overall system architecture ○ Java EE 6 → Jakarta EE8 ○ Security ○ Fault Tolerance ○ Performance ○ Monitoring ● API Gateway ○ Secure OAuth 2.0 + HTTP signatures ○ Microservice Monitoring and routing ○ Standard Integrations - RMI, SOAP, → REST ● Cloud Native ○ Different cloud providers ● Provide APIs to other institutions ● javax -> jakarta namespace
  • 24. @GuimaraesSv @CesarHgt @tomitribe Eclipse foundation https://www.eclipse.org/membership/documents/eclipse-foundation-overview.pdf 360+ 275+ 1550+ 195M+ 15 30
  • 25. @GuimaraesSv @CesarHgt @tomitribe Eclipse foundation, EE4J, Java EE, and Jakarta EE
  • 27. @GuimaraesSv @CesarHgt @tomitribe Eclipse MicroProfile ● An open-source community specification ● Focus on Enterprise Java microservices ● Generates: SPEC, API, and TCK. ● https://microprofile.io ● Implemented by different vendors.
  • 28. @GuimaraesSv @CesarHgt @tomitribe Eclipse MicroProfile MicroProfile 3.3 JAX-RS 2.1JSON-P 1.1CDI 2.0 Config Fault Tolerance JWT Propagation HealthMetrics Open Tracing Open API Rest Client JSON-B 1.0
  • 30. @GuimaraesSv @CesarHgt @tomitribe ● Apache Tomcat + Java EE = Apache TomEE ● Built from Apache components ● MicroProfile compliant ● Footprint: 30MB zip, 100~MB memory ● TomEE 9.0.0-M3 (javax -> jakarta) ● tomee.apache.org
  • 31. @GuimaraesSv @CesarHgt @tomitribe Apache TomEE TomEE JAX-RS Microprofile Java Server Pages (JSP) Java Server Faces (JSF) Java Transaction API (JTA) Bean Validation Enterprise JavaBeansJavaMail API Java API for RESTful Web Services (JAX-RS) Java Persistence API (JPA) Contexts and Dependency Injection (CDI) Java Servlets Java Authentication and Authorization Service (JAAS) Java Authorization Contract for Containers (JACC) http://tomee.apache.org/comparison.html
  • 33. @GuimaraesSv @CesarHgt @tomitribe Migration scenarios • The javax.* namespace egrep -lRZ 'javax' . | xargs -0 -l sed -i -e 's/javax/jakarta/g' branch / Jakarta 8 & MicroProfile 3 Service # master / Jakarta 9.x & MicroProfile 4?
  • 34. @GuimaraesSv @CesarHgt @tomitribe Migration scenarios • Bytecode level • No branches. No forks. No merge-conflict hell. Just two separate binaries from the same source; masterService # Jakarta 9.x & MicroProfile 4? Jakarta 8 & MicroProfile 3
  • 35. @GuimaraesSv @CesarHgt @tomitribe Jakarta EE 9 Server Up and Running Get the Binary :) 1. Download apache-tomee-9.0.0-M3-microprofile.zip from https://tomee.apache.org 2. unzip apache-tomee-9.0.0-M3-microprofile.zip 3. chmod +x apache-tomee-microprofile-9.0.0-M3/bin/catalina.sh 4. ./apache-tomee-microprofile-9.0.0-M3/bin/catalina.sh run
  • 36. @GuimaraesSv @CesarHgt @tomitribe Build and run 1. wget https://github.com/apache/tomee/archive/tomee-project-8.0.4.zip 2. unzip tomee-project-8.0.4.zip 3. cd tomee-tomee-project-8.0.4/examples/mp-custom-healthcheck 4. idea . #Or your favorite IDE 5. mvn verify 6. Inspec mp-custom-healthcheck-jakartaee9-8.0.4.war 7. target/mp-custom-healthcheck-jakartaee9-8.0.4.war <TomEE9M3_HOME>/webapps Jakarta and MicroProfile Project
  • 37. @GuimaraesSv @CesarHgt @tomitribe Jakarta EE 9 Up and Running Test the application curl -X POST http://localhost:8080/moviefun-rest-jakartaee9-8.0.4/rest/load curl -s http://localhost:8080/moviefun-rest-jakartaee9-8.0.4/rest/movies/ | jq open https://tomee.apache.org/tomee-9.0/examples/moviefun-rest.html
  • 39. @GuimaraesSv @CesarHgt @tomitribe Telemedicine Support - Doctor's Prescriptions System ● 5 days development ○ REST API ● Some integrations ○ Doctor's space login, Federal Companies Database, Pharmacies Database, Google Authenticator (two factor auth) ● Sensitive data protection ○ Attribute Converter Medical Practice! Digital Prescription Digital Prescription Doctor Patient Pharmacy Receive / Validate Emit
  • 40. @GuimaraesSv @CesarHgt @tomitribe Telemedicine Support - Doctor's Prescriptions System Digital Prescription
  • 41. @GuimaraesSv @CesarHgt @tomitribe Telemedicine Support - Doctor's Prescriptions System
  • 42. @GuimaraesSv @CesarHgt @tomitribe Telemedicine Support - Doctor's Prescriptions System ● Almost 580K prescriptions in south of Brazil installations-- since Mar/ 2020. Santa Catarina State Rio Grande do Sul State
  • 43. @GuimaraesSv @CesarHgt @tomitribe Lessons learned so far in the journey
  • 44. @GuimaraesSv @CesarHgt @tomitribe MicroProfile Config Before ● Sensitive information within project files ● Complex properties customizations ● Infrastructure environment management was painful
  • 45. @GuimaraesSv @CesarHgt @tomitribe Config After ● Sensitive information decoupled from the application code ● Container friendly ● Easy hierarchy for environment variables vs maven -D ● Allow easy container horizontal scaling
  • 46. @GuimaraesSv @CesarHgt @tomitribe MP Configuration @Inject @ConfigProperty(name = "log.enabled", defaultValue = "true") private Boolean logEnabled; @Inject private JsonWebToken token; public void info(String message) { if (logEnabled) { if (token == null || !token.claim("email").isPresent()) { logger.info(message); } else { logger.info(token.claim("email").get() + " - " + message); } } }
  • 47. @GuimaraesSv @CesarHgt @tomitribe Before ● Manual process and lack of coverage ● Disperse monitoring ● Hard to trace ● “It’s slow”, “a glitch”, “restarts” ● Reactive most of the time Health Check + Metrics
  • 48. @GuimaraesSv @CesarHgt @tomitribe After ● JSON base alerts are now centralized and provide unified notifications ● Custom rules base on standard status ● Proactiveness since the last 3 months ● Improves user satisfaction Health Check + Metrics
  • 49. @GuimaraesSv @CesarHgt @tomitribe Microprofile HealthCheck @Health @ApplicationScoped public class DatabaseHealthCheck implements HealthCheck { @PersistenceContext(unitName = "crvirtual_unit") protected EntityManager manager; @Override public HealthCheckResponse call() { HealthCheckResponseBuilder responseBuilder = HealthCheckResponse.named("oracle"); try { String result = (String) manager.createNativeQuery("select * from dual").getSingleResult(); if(result.equals("X")){ return responseBuilder.up().build(); } else { return responseBuilder.down().build(); } } catch (Exception e) { return responseBuilder.withData("error", e.getMessage()).down().build(); } } }
  • 51. @GuimaraesSv @CesarHgt @tomitribe JWT Authentication Before: ● Basic HTTP Auth with session management ● Challenges for microservices ○ New stateless security requirement ○ Authentication and Authorization between microservices ○ Overhead and single point of failure
  • 52. @GuimaraesSv @CesarHgt @tomitribe JWT Authentication After: ● OAuth 2.0 JWT ○ Stateless security ○ Authentication and Authorization between microservices ○ State was kept on the server and pointer on the client side
  • 53. @GuimaraesSv @CesarHgt @tomitribe Microprofile JWT /** Microprofile JWT **/ @Inject private JsonWebToken token; /** Microprofile Config **/ @Inject @ConfigProperty(name = "log.enabled", defaultValue = "true") private Boolean logEnabled; private Logger logger = Logger.getLogger(CrVirtualLogger.class.getName()); public void info(String message) { if (logEnabled) { if (token == null || !token.claim("email").isPresent()) { logger.info(message); } else { logger.info(token.claim("email").get() + " - " + message); } } }
  • 54. @GuimaraesSv @CesarHgt @tomitribe Authentication ● Protected Access into Medical Knowledge databases
  • 55. @GuimaraesSv @CesarHgt @tomitribe Authentication ● Protected Access into Federal Companies Database
  • 56. @GuimaraesSv @CesarHgt @tomitribe Rest Client Before ● JAX-RS Client ● No type-safe ● Service needed to be understood ● Request needed to be built by hand every time ● Not the best reusability of the code
  • 57. @GuimaraesSv @CesarHgt @tomitribe Rest Client After ● Type-safe approach ● Usage of interfaces to call the services ● Header propagation and handling made easy ● Smooth JWT propagation
  • 58. @GuimaraesSv @CesarHgt @tomitribe @Dependent @RegisterRestClient public interface SerproSearchClient { @POST @Consumes(MediaType.APPLICATION_JSON) public Response getToken(String body); @GET public Response searchCompany(@HeaderParam("Authorization") String key, @HeaderParam("Accept") String accept); } Microprofile RestClient
  • 59. @GuimaraesSv @CesarHgt @tomitribe Microprofile RestClientimport org.eclipse.microprofile.rest.client.inject.RegisterRestClient; import javax.enterprise.context.Dependent; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import java.util.List; @RegisterRestClient @Path("api/doctors") public interface DoctorResourceClient { @GET @Path("{id}") @Produces(MediaType.APPLICATION_JSON) Doctor find(@PathParam("id") Long id); @GET List<Doctor> getDoctors(); @POST @Consumes("application/json") Doctor addDoctor(Doctor doctor);
  • 60. @GuimaraesSv @CesarHgt @tomitribe Microprofile RestClientimport org.superbiz.moviefun.mpclient.DoctorResourceClient; @Inject @RestClient private DoctorResourceClient doctorResourceClient; public void printAllDoctors(){ List<Doctor> doctors = doctorResourceClient.getDoctors(); for (Doctor doctor : doctor) { LOGGER.info(doctor.toString()); } } public void addNewDoctor() { Doctor newDoctor = new Doctor ("7","Doctor 007."); doctorResourceClient.addDoctor(newDoctor); }
  • 61. @GuimaraesSv @CesarHgt @tomitribe Before ● Legacy system was not well document ● Documentation not fully aligned with master code ○ Duplication of code ○ Design first approach not trustable OpenAPI
  • 62. @GuimaraesSv @CesarHgt @tomitribe OpenAPI After ● Standard visibility ● Find duplication of code ● Allowed API design approach ● swagger-ui
  • 63. @GuimaraesSv @CesarHgt @tomitribe OpenAPI @Operation(description = "To search Doctors by their record number") @APIResponses({ @APIResponse(responseCode = "200", description = "Success", content = @Content(schema = @Schema(implementation = User.class))), @APIResponse(responseCode = "400", description = "Bad Request") }) @GET @Produces(MediaType.APPLICATION_JSON) @Path("{recordNumber}") public Response getDoctor(@PathParam("recordNumber") Long recordNumber) { try { logger.info("searching Doctors by record number"); return Response.ok(dao.getByRecordNumber(recordNumber)).build(); } catch (Exception e) { throw new WebApplicationException( Response.status(Response.Status.BAD_REQUEST).entity(new ErrorMessages(e.getMessage())).build()); } }
  • 65. @GuimaraesSv @CesarHgt @tomitribe Thank you Rafael Guimarães, César Hernández Keeping Brazil’s Medical Industry Safe with MicroProfile