Download - 4finance microservice pilot in Poland
![Page 1: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/1.jpg)
Microservices
PILOT
![Page 2: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/2.jpg)
Agendaproblems being solvedhow to use it
![Page 3: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/3.jpg)
Problems of a microservice
![Page 4: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/4.jpg)
Problems of a microservicewho can I talk towhere are my collaboratorshow can I contact othershow can others contact mewhat’s my APIhow to be part of a bigger system: logshow do I expose my metricshow do I view my metrics
![Page 5: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/5.jpg)
Problems of a microservicewho can I talk towhere are my collaboratorshow can I contact othershow can others contact mewhat’s my APIhow to be part of a bigger system: logshow do I expose my metricshow do I view my metrics
![Page 6: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/6.jpg)
Who can I talk to?solved by:
4finance micro-infra-spring-base
Apache Zookeeper
![Page 7: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/7.jpg)
Who can I talk to?you just have to:
create a microservice metadata file (i.e. microservice.json)
{
"pl": {
"this": "com/ofg/loans/pl/backoffice-vivus-pl",
"dependencies": {
"bluecash-pl": "com/ofg/payments/pl/bluecash/bluecash-vivus-pl"
}
}
}
src/main/resources/microservice.json
![Page 8: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/8.jpg)
Who can I talk to?you just have to:
add 4finance micro-infra-spring-base dependency to your project
repositories {
jcenter()
}
dependencies {
compile 'com.ofg:micro-infra-spring-base:0.5.2'
}
![Page 9: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/9.jpg)
Who can I talk to?you just have to:
add service discovery module
@Configuration
@Import([ServiceDiscoveryConfiguration])
class MyConfiguration {
}
![Page 10: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/10.jpg)
Microservice metadata file
{
"pl": {
"this": "com/ofg/loans/pl/backoffice-vivus-pl",
"dependencies": {
"bluecash-pl": "com/ofg/payments/pl/bluecash/bluecash-vivus-pl"
}
}
}
src/main/resources/microservice.json
![Page 11: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/11.jpg)
Microservice metadata file
{
"pl": {
"this": "com/ofg/loans/pl/backoffice-vivus-pl",
"dependencies": {
"bluecash-pl": "com/ofg/payments/pl/bluecash/bluecash-vivus-pl"
}
}
}
Microservice context (realm)
![Page 12: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/12.jpg)
Microservice metadata file
{
"pl": {
"this": "com/ofg/loans/pl/backoffice-vivus-pl",
"dependencies": {
"bluecash-pl": "com/ofg/payments/pl/bluecash/bluecash-vivus-pl"
}
}
}
name of services I talk with
![Page 13: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/13.jpg)
Microservice metadata file
{
"pl": {
"this": "com/ofg/loans/pl/backoffice-vivus-pl",
"dependencies": {
"bluecash-pl": "com/ofg/payments/pl/bluecash/bluecash-vivus-pl"
}
}
}
paths to services I talk within context (realm)
![Page 14: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/14.jpg)
Problems of a microservicewho can I talk towhere are my collaboratorshow can I contact othershow can others contact mewhat’s my APIhow to be part of a bigger system: logshow do I expose my metricshow do I view my metrics
![Page 15: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/15.jpg)
Where are my collaborators?{
"pl": {
"this": "com/ofg/loans/pl/backoffice-vivus-pl",
"dependencies": {
"bluecash-pl": "com/ofg/payments/pl/bluecash/bluecash-vivus-pl"
}
}
}
COLLABORATOR’S PATH IN ZOOKEEPER
pl/com/ofg/payments/pl/bluecash/bluecash-vivus-pl
![Page 16: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/16.jpg)
Where are my collaborators?
PLpl/com/ofg/loans/payment-processor
pl/com/ofg/loans/risk-analyzer
LTlt/com/ofg/loans/payment-processor
lt/com/ofg/loans/risk-analyzer
![Page 17: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/17.jpg)
Problems of a microservicewho can I talk towhere are my collaboratorshow can I contact othershow can others contact mewhat’s my APIhow to be part of a bigger system: logshow do I expose my metricshow do I view my metrics
![Page 18: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/18.jpg)
How can I contact others?if you want to call your collaborator (e.g. ‘bluecash-pl’) just:
add micro-infra-spring-base dependency to your project
repositories {
jcenter()
}
dependencies {
compile 'com.ofg:micro-infra-spring-base:0.5.2'
}
![Page 19: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/19.jpg)
How can I contact others?if you want to call your collaborator (e.g. ‘bluecash-pl’) just:
add Service discovery and Abstraction over RestTemplate modules
@Configuration
@Import([ServiceDiscoveryConfiguration, ServiceRestClientConfiguration])
class MyConfiguration {
}
![Page 20: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/20.jpg)
How can I contact others?if you want to call your collaborator (e.g. ‘bluecash-pl’) just:
use 4Finance ServiceRestClient bean
![Page 21: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/21.jpg)
How can I contact others?serviceRestClient.forService('bluecash-pl')
.post()
.onUrl('/api/whatever/123')
.body('''{"some":"json"}''')
.withHeaders()
.contentTypeJson()
.andExecuteFor()
.anObject()
.ofType(String)
COLLABORATOR’S ALIAS FROM MICROSERVICE.
JSON
![Page 22: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/22.jpg)
How can I contact others?serviceRestClient.forService('bluecash-pl')
.post()
.onUrl('/api/whatever/123')
.body('''{"some":"json"}''')
.withHeaders()
.contentTypeJson()
.andExecuteFor()
.anObject()
.ofType(String)
HTTP METHOD
![Page 23: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/23.jpg)
How can I contact others?serviceRestClient.forService('bluecash-pl')
.post()
.onUrl('/api/whatever/123')
.body('''{"some":"json"}''')
.withHeaders()
.contentTypeJson()
.andExecuteFor()
.anObject()
.ofType(String)
URL ON COLLABORATOR TO CALL
![Page 24: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/24.jpg)
How can I contact others?serviceRestClient.forService('bluecash-pl')
.post()
.onUrl('/api/whatever/123')
.body('''{"some":"json"}''')
.withHeaders()
.contentTypeJson()
.andExecuteFor()
.anObject()
.ofType(String)
BODY TO SEND
![Page 25: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/25.jpg)
How can I contact others?serviceRestClient.forService('bluecash-pl')
.post()
.onUrl('/api/whatever/123')
.body('''{"some":"json"}''')
.withHeaders()
.contentTypeJson()
.andExecuteFor()
.anObject()
.ofType(String)
HEADERS TO SEND
![Page 26: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/26.jpg)
How can I contact others?serviceRestClient.forService('bluecash-pl')
.post()
.onUrl('/api/whatever/123')
.body('''{"some":"json"}''')
.withHeaders()
.contentTypeJson()
.andExecuteFor()
.anObject()
.ofType(String)
RETURN A RESPONSE OF A GIVEN TYPE
![Page 27: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/27.jpg)
How can I contact others?serviceRestClient.forService('bluecash-pl')
.post()
.onUrl('/api/whatever/123')
.body('''{"some":"json"}''')
.withHeaders()
.contentTypeJson()
.andExecuteFor()
.anObject()
.ofType(String)
![Page 28: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/28.jpg)
Problems of a microservicewho can I talk towhere are my collaboratorshow can I contact othershow can others contact mewhat’s my APIhow to be part of a bigger system: logshow do I expose my metricshow do I view my metrics
![Page 29: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/29.jpg)
How can others contact me?solved by:
4finance micro-infra-spring-base
Apache Zookeeper
Netflix Exhibitor - UI for Zookeeper
![Page 30: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/30.jpg)
How can others contact me?you just have to:
create a microservice metadata file (i.e. microservice.json)
{
"pl": {
"this": "com/ofg/loans/pl/backoffice-vivus-pl",
"dependencies": {
"bluecash-pl": "com/ofg/payments/pl/bluecash/bluecash-vivus-pl"
}
}
}
src/main/resources/microservice.json
![Page 31: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/31.jpg)
How can others contact me?you just have to:
add 4finance micro-infra-spring-base dependency to your project
repositories {
jcenter()
}
dependencies {
compile 'com.ofg:micro-infra-spring-base:0.5.2'
}
![Page 32: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/32.jpg)
How can others contact me?you just have to:
add service discovery module
@Configuration
@Import([ServiceDiscoveryConfiguration])
class MyConfiguration {
}
![Page 33: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/33.jpg)
How can others contact me?
{
"pl": {
"this": "com/ofg/loans/pl/backoffice-vivus-pl",
"dependencies": {
"bluecash-pl": "com/ofg/payments/pl/bluecash/bluecash-vivus-pl"
}
}
}
![Page 34: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/34.jpg)
How can others contact me?
{
"pl": {
"this": "com/ofg/loans/pl/backoffice-vivus-pl",
"dependencies": {
"bluecash-pl": "com/ofg/payments/pl/bluecash/bluecash-vivus-pl"
}
}
}
Microservice context (realm)
![Page 35: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/35.jpg)
How can others contact me?
{
"pl": {
"this": "com/ofg/loans/pl/backoffice-vivus-pl",
"dependencies": {
"bluecash-pl": "com/ofg/payments/pl/bluecash/bluecash-vivus-pl"
}
}
}
my path in context (realm)
![Page 36: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/36.jpg)
How can others contact me?{
"pl": {
"this": "com/ofg/loans/pl/backoffice-vivus-pl",
"dependencies": {
"bluecash-pl": "com/ofg/payments/pl/bluecash/bluecash-vivus-pl"
}
}
}
MY PATH
pl/com/ofg/loans/pl/backoffice-vivus-pl
![Page 37: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/37.jpg)
How can others contact me?when microservice boots up it registers itself in Zookeeper under specified path
you can register multiple instances under same path
Zookeeper supports load balancing (Round Robin, Random and Sticky)
![Page 38: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/38.jpg)
How can others contact me?
/pl/com/ofg/loans/pl/backoffice-vivus-pl
instance id (you can have multiple ones)
![Page 39: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/39.jpg)
How can others contact me?
Data as String:{ "name": "com/ofg/loans/pl/backoffice-vivus-pl", "id": "15628f76-753e-4a25-83de-de132293a58d", "address": "192.168.0.1", "port": 8080, "sslPort": null, "payload": null, "registrationTimeUTC": 1410343209917, "serviceType": "DYNAMIC", "uriSpec": { ... }}
Instance entry in Zookeeper:
![Page 40: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/40.jpg)
How can others contact me?
Data as String:{ "name": "com/ofg/loans/pl/backoffice-vivus-pl", "id": "15628f76-753e-4a25-83de-de132293a58d", "address": "192.168.0.1", "port": 8080, "sslPort": null, "payload": null, "registrationTimeUTC": 1410343209917, "serviceType": "DYNAMIC", "uriSpec": { ... }}
Instance entry in Zookeeper:THE PATH
WHERE MICROSERVICE
REGISTERS ITSELF IN GIVEN
REALM
![Page 41: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/41.jpg)
How can others contact me?
Data as String:{ "name": "com/ofg/loans/pl/backoffice-vivus-pl", "id": "15628f76-753e-4a25-83de-de132293a58d", "address": "192.168.0.1", "port": 8080, "sslPort": null, "payload": null, "registrationTimeUTC": 1410343209917, "serviceType": "DYNAMIC", "uriSpec": { ... }}
Instance entry in Zookeeper:
MICROSERVICE REGISTERS
ITSELF IN ZOOKEPER
WITH ADDRESS AND PORT
![Page 42: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/42.jpg)
Problems of a microservicewho can I talk towhere are my collaboratorshow can I contact othershow can others contact mewhat’s my APIhow to be part of a bigger system: logshow do I expose my metricshow do I view my metrics
![Page 43: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/43.jpg)
What’s my API?solved by:
4finance micro-infra-spring-swagger
Wordnik Swagger
4finance micro-infra-spring-swagger-ui
Wordnik Swagger-UI
![Page 44: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/44.jpg)
What’s my API?you just have to add dependencies to your project:
micro-infra-spring-swaggermicro-infra-spring-swagger-ui
repositories {
jcenter()
}
dependencies {
compile 'com.ofg:micro-infra-spring-swagger:0.5.2'
compile 'com.ofg:micro-infra-spring-swagger-ui:0.5.2'
}
![Page 45: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/45.jpg)
What’s my API?from micro-infra-spring-swagger:
add Swagger module to Spring’s context
@Configuration
@Import([SwaggerConfiguration])
class MyConfiguration {
}
![Page 46: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/46.jpg)
thanks to micro-infra-spring-swagger-ui:
swagger-ui will be present under /src/main/resources/static/swagger/
What’s my API?
![Page 47: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/47.jpg)
and now your microservice publishes its API by itself!
What’s my API?
![Page 48: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/48.jpg)
What’s my API?
![Page 49: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/49.jpg)
What’s my API?
RESTCONTROLLERS
![Page 50: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/50.jpg)
What’s my API?
METHOD TYPES
![Page 51: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/51.jpg)
What’s my API?
METHOD URLS METHOD NAMES
![Page 52: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/52.jpg)
What’s my API? - Try me out!
![Page 53: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/53.jpg)
What’s my API? - Try me out!
ENTER PARAMETERS
SEND A REQUEST
![Page 54: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/54.jpg)
Problems of a microservicewho can I talk towhere are my collaboratorshow can I contact othershow can others contact mewhat’s my APIhow to be part of a bigger system: logshow do I expose my metricshow do I view my metrics
![Page 55: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/55.jpg)
How to be part of a bigger system: logs?Question:
How many lines of logs were produced on production by PL Cola during 1 hour?
![Page 56: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/56.jpg)
How to be part of a bigger system: logs?Answer:
73 000 lines of logs
![Page 57: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/57.jpg)
How to be part of a bigger system: logs?
You are not going to grep that, are you?
![Page 58: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/58.jpg)
How to be part of a bigger system: logs?solved by:
logback log pattern
4finance micro-infra-spring-base
![Page 59: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/59.jpg)
How to be part of a bigger system: logs?solved by:
logback log pattern
4finance micro-infra-spring-base
SO THAT WE HAVE A STANDARDISED WAY OF
LOGGING
![Page 60: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/60.jpg)
How to be part of a bigger system: logs?solved by:
logback log pattern
4finance micro-infra-spring-base SO THAT CORRELATION ID IS ALWAYS SET FOR YOU
![Page 61: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/61.jpg)
How to be part of a bigger system: logs?correlation ID:
a header value in a requestin each microservice this header is the same for the same business actionyou can see a flow of messages between microservices in a chronological order
![Page 62: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/62.jpg)
How to be part of a bigger system: logs?
COLA
REQUEST
No correlationId
CorrelationId set to X
CorrelationId set to X
RESPONSE
FIRST SERVICE
REQUEST
CorrelationId set to X
CorrelationId set to X
RESPONSE
ANOTHER SERVICE
REQUEST
CorrelationId set to XCorrelationId
set to X
RESPONSECorrelationId set to X
YET ANOTHER SERVICE
REQUEST
CorrelationId set to XCorrelationId
set to X
RESPONSE
![Page 63: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/63.jpg)
How to be part of a bigger system: logs?you just have to:
add 4finance micro-infra-spring-base dependency to your project
repositories {
jcenter()
}
dependencies {
compile 'com.ofg:micro-infra-spring-base:0.5.2'
}
![Page 64: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/64.jpg)
How to be part of a bigger system: logs?you just have to:
add CorrelationId module to Spring’s context
@Configuration
@Import([CorrelationIdConfiguration])
class MyConfiguration {
}
![Page 65: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/65.jpg)
How to be part of a bigger system: logs?Application logs in a specified format:
"%d{yyyy-MM-dd HH:mm:ss.SSSZ, Europe/Warsaw} |
%-5level |
%X{correlationId} |
%thread |
%logger{1} |
%m%n"
![Page 66: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/66.jpg)
How to be part of a bigger system: logs?Log example:
2014-09-10 14:34:40.448+0200 |
INFO |
538898f2-543f-48a3-ad9e-3d2961b2b73d |
qtp326276239-140 |
c.o.c.v.w.a.AbstractBackofficeApplication |
Initializing new backoffice application
![Page 67: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/67.jpg)
How to be part of a bigger system: logs?Log example:
2014-09-10 14:34:40.448+0200 |
INFO |
538898f2-543f-48a3-ad9e-3d2961b2b73d |
qtp326276239-140 |
c.o.c.v.w.a.AbstractBackofficeApplication |
Initializing new backoffice application
TIMESTAMP IN ISO8601 FORMAT
![Page 68: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/68.jpg)
How to be part of a bigger system: logs?Log example:
2014-09-10 14:34:40.448+0200 |
INFO |
538898f2-543f-48a3-ad9e-3d2961b2b73d |
qtp326276239-140 |
c.o.c.v.w.a.AbstractBackofficeApplication |
Initializing new backoffice application
LOGGING LEVEL
![Page 69: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/69.jpg)
How to be part of a bigger system: logs?Log example:
2014-09-10 14:34:40.448+0200 |
INFO |
538898f2-543f-48a3-ad9e-3d2961b2b73d |
qtp326276239-140 |
c.o.c.v.w.a.AbstractBackofficeApplication |
Initializing new backoffice application
CORRELATION ID
![Page 70: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/70.jpg)
How to be part of a bigger system: logs?Log example:
2014-09-10 14:34:40.448+0200 |
INFO |
538898f2-543f-48a3-ad9e-3d2961b2b73d |
qtp326276239-140 |
c.o.c.v.w.a.AbstractBackofficeApplication |
Initializing new backoffice application
THREAD NAME
![Page 71: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/71.jpg)
How to be part of a bigger system: logs?Log example:
2014-09-10 14:34:40.448+0200 |
INFO |
538898f2-543f-48a3-ad9e-3d2961b2b73d |
qtp326276239-140 |
c.o.c.v.w.a.AbstractBackofficeApplication |
Initializing new backoffice application
CLASS FULLY QUALIFIED NAME (SHORTENED)
![Page 72: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/72.jpg)
How to be part of a bigger system: logs?Log example:
2014-09-10 14:34:40.448+0200 |
INFO |
538898f2-543f-48a3-ad9e-3d2961b2b73d |
qtp326276239-140 |
c.o.c.v.w.a.AbstractBackofficeApplication |
Initializing new backoffice applicationLOG MESSAGE
![Page 73: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/73.jpg)
How to be part of a bigger system: logs?
![Page 74: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/74.jpg)
How to be part of a bigger system: logs?
SAME CORRELATION ID
![Page 75: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/75.jpg)
How to be part of a bigger system: logs?
DIFFERENT MICROSERVICES
![Page 76: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/76.jpg)
How to be part of a bigger system: logs?you can see collected logs from all services in kibana
![Page 77: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/77.jpg)
How to be part of a bigger system: logs?
![Page 78: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/78.jpg)
How to be part of a bigger system: logs?with kibana you can:
query your logs
create dashboards with filtered data
collect logs from different services
![Page 79: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/79.jpg)
Problems of a microservicewho can I talk towhere are my collaboratorshow can I contact othershow can others contact mewhat’s my APIhow to be part of a bigger system: logshow do I expose my metricshow do I view my metrics
![Page 80: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/80.jpg)
How do I expose my metrics?solved by:
4finance micro-infra-spring-base
Dropwizard Metrics
![Page 81: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/81.jpg)
How do I expose my metrics?you just have to:
add 4finance micro-infra-spring-base dependency to your project
repositories {
jcenter()
}
dependencies {
compile 'com.ofg:micro-infra-spring-base:0.5.2'
}
![Page 82: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/82.jpg)
How do I expose my metrics?you just have to:
add metrics publishing module to Spring’s context
@Configuration
@Import([MetricsConfiguration])
class MyConfiguration {
}
![Page 83: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/83.jpg)
How do I expose my metrics?we have a template of metric path in Graphite:
apps.(env).(country).(service-name).(dot-separated-metric)
apps.test.pl.bluecash-adapter.transfer.requests.balance.count
“Bluecash adapter’s” count of “transfer” type requests
![Page 84: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/84.jpg)
How do I expose my metrics?you just have to provide (as a property):
# Environment to which you deploy application ('test', 'prod', etc.) - default value: ‘test’
metrics.path.environment=test
# Country for which you deploy your app - default value: ‘pl’
metrics.path.country=pl
# Your app name - default value: ‘service-name’
metrics.path.app=bluecash-adapter
![Page 85: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/85.jpg)
How do I expose my metrics?having properties set you just have to update your metrics:
// treat this code more of a pseudocode ;)Counter transferBalanceRequests = metricRegistry.counter(‘transfer.requests.balance’)
void doSomethingUponTransferBalanceRequest() {
// do sth with the request for transfer balance…
// and update the counter metrictransferBalanceRequests.inc()
}
![Page 86: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/86.jpg)
Problems of a microservicewho can I talk towhere are my collaboratorshow can I contact othershow can others contact mewhat’s my APIhow to be part of a bigger system: logshow do I expose my metricshow do I view my metrics
![Page 87: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/87.jpg)
How do I view my metrics?solved by:
Graphite
Grafana - UI for Graphite
JMX - jconsole, jvisualvm, etc.
![Page 88: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/88.jpg)
How do I view my metrics?you can view your metrics in Graphite
you can create dashboards in Grafana
your applictaion metrics are exposed via JMX
![Page 89: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/89.jpg)
How do I view my metrics?
![Page 90: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/90.jpg)
How do I view my metrics?
![Page 91: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/91.jpg)
Ok, so how do I start?
But, but, but… it sounds so complicated!
![Page 92: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/92.jpg)
repositories {
jcenter()
}
dependencies {
compile 'com.ofg:micro-infra-spring-swagger-ui:0.5.2'
}
Don’t want to add separate modules?@Configuration@Import([ServiceDiscoveryConfiguration])
class MyConfiguration {
}
@Configuration
@Import([SwaggerConfiguration])
class MyConfiguration {
}
repositories {
jcenter()
}
dependencies {
compile 'com.ofg:micro-infra-spring-swagger:0.5.2'
}
@Configuration
@Import([MetricsConfiguration])
class MyConfiguration {
}
repositories {
jcenter()
}
dependencies {
compile 'com.ofg:micro-inf
ra-spring-base:0.5.2'
}
@Configuration
@Import([ServiceDiscoveryConfiguration])
class MyConfiguration {
}
![Page 93: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/93.jpg)
Don’t want to add separate modules?
![Page 94: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/94.jpg)
Don’t want to add separate modules?
![Page 95: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/95.jpg)
Good! We’ll do that for you!!You just have to:
add ONE dependency - 4finance micro-infra-spring to your project
import ONE configuration - WebAppConfiguration
create ONE file - microservice.json
![Page 96: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/96.jpg)
One dependency - micro-infra-spring
repositories {
jcenter()
}
dependencies {
compile 'com.ofg:micro-infra-spring:0.5.2'
}
![Page 97: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/97.jpg)
One config - WebAppConfiguration@Configuration
@Import(WebAppConfiguration)
class MyConfiguration {
}
If you want you can import only needed pieces or override configuration defaults
![Page 98: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/98.jpg)
One file - microservice.json
{
"pl": {
"this": "com/ofg/your/microservice",
"dependencies": {
"collaborator": "com/ofg/microservice/collaborator"
}
}
}
![Page 99: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/99.jpg)
Ok, so how do I start?
Question:what should I do to start working on a new microservice?
![Page 100: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/100.jpg)
Ok, so how do I start?
Answer:
Clone a repo
![Page 101: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/101.jpg)
Ok, so how do I start?
Without UI:https://github.com/4finance/boot-microservice
With UI:https://github.com/4finance/boot-microservice-gui
![Page 102: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/102.jpg)
Ok, so how do I start?those repos:
contain completely set up microservice
are written in Groovy
are built with Gradle (set up for 4finance)
are JDK8 compliant
contain an example of a business scenario
![Page 103: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/103.jpg)
Ok, so how do I start?our libs:
have Javadocs
![Page 104: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/104.jpg)
Ok, so how do I start?our libs:
have ReadMe’s
![Page 105: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/105.jpg)
Where are we?what we have managed to achieve:
Microservice setup (correlationId setting, metrics support, rest template abstraction etc.)
CorrelationId setting for Spring Reactor
![Page 106: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/106.jpg)
Where are we?Libs on production in:
COLA-VIVUS
WEB-VIVUS
BLUECASH-ADAPTER
MYMOID-ADAPTER
WEB-ZAPLOCOLA-ZAPLOBROKERS
![Page 107: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/107.jpg)
Where are we?
Microservice setup (correlationId setting, metrics support, rest template abstraction etc.)
CorrelationId setting for Spring Reactor
CorrelationId setting for Camel
NOW
Fix bugs
Consumer driven contracts (4finance StubRunner)
Circuit breaking (Netflix Hystrix)
Store properties in Zookeeper (Netflix Archaius)
Retry policies for RestTemplate
Resolve issues with circular obligatory dependencies
NEXT
Investigate Riemann and Suro as event servers / data pipelines
New templates for other JVM languages
Sky is the limit
FUTURE
![Page 108: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/108.jpg)
Want to contribute?
![Page 109: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/109.jpg)
Want to contribute? ISSUES!
![Page 110: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/110.jpg)
3 steps to eternal fame1. Ask any of the existing 4Finance organization members
to add you to that organization
2. Pick an issue, fix it and create a pull request
3. Once merged profit from eternal fame
![Page 111: 4finance microservice pilot in Poland](https://reader034.vdocument.in/reader034/viewer/2022051109/547e90a0b47959c0508b4b94/html5/thumbnails/111.jpg)
Questions?