[wso2con eu 2017] creating composite services using ballerina

Post on 21-Jan-2018

159 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Senior Technical Lead, WSO2

Creating Composite Services Using Ballerina

Isuru Udana

• Atomic– Indivisible, fine-grained, no reuse of other services

• Composite– Divisible, coarse-grained, reusing other services

Services

• Most real-world business use cases cannot be satisfied with atomic services

• Reuse of existing services

Why Composite Services?

Healthcare Service ChainingReal-World Scenarios

Composite Services in MSA

5

Microservices Layered ArchitectureConsumer 1

API Service 1 API Service 2 API Service 3 API Service 4

ConsumersConsumer 2 Consumer 3

Service 6 Service 7 Service 8 Service 9

Service 1 Service 2 Service 3 Service 4 Service 5 Proprietary & Legacy

Systems

Web API / SaaS

API Services/Edge Services

Composite Service/Integration Services

Core Services/Atomic Services

Microservices Layered ArchitectureCore/Atomic Microservices

• Fine-grained self-contained services

Microservices Layered ArchitectureComposite Microservices

• ESB in SOA => Composite Microservices in MSA

Building Composite Microservices

Frameworks Based on General Purpose Languages

• Not designed with suitable abstractions for network interactions

• Developers spend more time on building service interactions

Building Composite Microservices

Conventional ESBs

• ESB architecture not fully compatible with MSA principles

The Solution is Ballerina!

11

Ballerina

• Parallel programming language for networked applications

• Designed for network interactions with JSON/XML/SQL and HTTP/JMS/File/WebSockets

• Serverless and container friendly

Building Composite Services with BallerinaKey Functionality

• Transformation• Routing• Parallel processing

Transformation

Transformation

Transformation Logic

Structs

Transformation

Transform Operation

TransformationSource Target

Mapping

Operators

Routing

RoutingContent Based

Get Payload

RoutingLogic

RoutingHeader Based

RoutingLogic

Get Header

Parallel Processing

Parallel ProcessingWorkers

Parallel ProcessingWorkers

Building Composite Services with BallerinaServices

• Simple Atomic Service• Composite Services

– Simple composite service– Service chaining– Service orchestration

Simple Atomic Service Service Annotations

Protocol

Resource

Resource Annotations

Simple Atomic Service

Protocol

Resource

Resource Annotations

Simple Composite Service

Simple Composite Service

Logic

Downstream Services

Simple Composite ServiceDownstream

Services

Logic

Service Chaining

Service Chaining

Invoke Service1

Invoke Service2

Service Chaining

Invoke Service1

Invoke Service2

Construct Payload

Construct Payload

Service Chaining

Construct Payload

Invoke Service 1

Service ChainingConstructPayload

Invoke Service 2

Service Orchestration ScenarioOnline Vehicle Revenue License Service

Can be invoked at the

same time

Service Structure Service Path

Certificate ValidationResource

LicenseResource

Resource Path

License Resource

ValidateCerts

Do Payment

Call LicenseIssuer

Respond

Certificate Validation Function

Workers

Fork

Join

Certificate Validation Function

Workers

MultipleReturnValues

Certificate Validation Function

Workers

Certificate Validation Function

Validation Logic Multiple

ReturnValues

Function Invocation

FunctionInvocation

FunctionInvocation

Function InvocationMultipleReturn Values

FunctionInvocation

License Resource

ValidateCerts

Do Payment

Call LicenseIssuer

Respond

Build Payment Request

Invoke Payment Service

License Resource

ValidateCerts

Do Payment

Call LicenseIssuer

Respond

Invoke License Issuer Service

License Resource

ValidateCerts

Do Payment

Call LicenseIssuer

Respond

Respond to Client

Conclusion

● Introduction to composite services● Composite services in Microservices architecture● Building Composite Services with Ballerina

wso2.com

52

top related