Enterprise Application Architectures by Dr. Indika Kumara

Post on 12-Feb-2017

36 views 1 download

Transcript of Enterprise Application Architectures by Dr. Indika Kumara

1

Enterprise Application Architectures

Dr. Indika Kumara

2

Outline• Enterprise Applications/Computing• Architecture Styles for Enterprise Applications

– Method-oriented– Message-oriented– Resource-oriented

• REST (representational state transfer)– Event-oriented

• SOA (service-oriented architecture)– Basic and extended SOA– Implementing SOA

• RESTful • WS-* (web services stack)

– ESB (enterprise service bus)• Business processes and service compositions

3

Characteristics of Enterprise Computing

4

Enterprise Example : E-Book Shop

ShippingCompany

Inventory Department

Billing Department

Credit Card Company

Book PublisherCustomer

Shop Manager

External

Internal

Business Processes1. Buying Books2. Filling Inventory3. …

5

Characteristics of Enterprise Computing

• Enterprise-wide data sharing => Lots of persistent data, concurrent access

• Long lived processes => asynchronous• Changing => loosely coupled• IT business alignment => large scale components,

business processes• Heterogeneous systems => integration, standards• Across organizational boundaries => distributed

computing, limited control, security, standardsFrom Swinburne lecture notes

6

IT and Business Alignment

Business

Information Technology

Drives Enables/Transforms

Simplify finding an book in the store by a customer

Book Inventory Management System

E-Book Shop

Expands business globally

Enterprise Architecture => IT and Business Alignment

7

Architecture Styles for Enterprise Applications/Computing

• What is a software architecture?• What is a software architecture style?• Four types of architecture styles for enterprise

applications– Method-oriented (Remote Procedure Call)– Message-oriented– Resource-oriented– Event-oriented

8

Method-oriented Style(Remote Procedure Call)

9

Remote Procedure Call• Like a function call, but

– Caller and callee are in different address spaces , usually connected through a network (not necessarily)

– Client and server model• Service Interface

– Method and parameters• Client-server Interactions

– Synchronous request-response– Request-acknowledge

• Examples: CORBA (Common Object Request Broker Architecture), Java RMI (Remote Method Invocation), and DCOM(Distributed Component Object Model )

10

Remote Procedure Call …

Client(caller)

Server(callee)

PacketHandler

PacketHandler

call

return

send

receive

send

receive

return

call

Netw

ork

Net

wor

k

ClientStub

bundleargs

bundleret vals

unbundleret vals

ServerStub

unbundleargs

Machine AMachine B

mbox1

mbox2

From berkeley notes

11

Message-oriented Style

12

Message-oriented Style

• (Distributed) entities interact by exchanging messages between them

• Service Interface– Domain specific operations and message types

• Client-Server Interaction– Various form of persistent /transient and

asynchronous / synchronous communication models

– Various message exchange patterns

13

Message Exchange PatternsOne-way

Request -Response

Solicit -Response

Notification

E.g. Order Submission

E.g. Get Available Books

E.g. Ask customer to send some information

E.g. Send Book Status

14

Message-Oriented Middleware(MOM)

• An intermediary that enables passing of data and information as self-contained messages between entitles/applications

Application A

Messaging API

Messaging Client

Application B

Messaging API

Messaging ClientMessaging System

15

Message-Queuing System

General Architecture of a Message-Queuing System

16

Message Broker

General Architecture of a Message Broker

17

Messaging Models

• Point-to-Point (1:1)

• Publish-and-Subscribe (1:n)

Point to Point Model

18

Customer

JMS Endpoint

OrderQueue

ACKOrderBook()

OrderMsg

Shop Owner

BookService

Publish-and-Subscribe Model

19

Customer 1

Enterprise SOATopic

UpdateStatus()

StatusMsg

BookService

Customer n

20

Resource-oriented Style

21

Resource-oriented Style

• Structure an application as an inter-linked web of resources and resource representations.

• REpresentational State Transfer (REST) is the de facto standard resource-oriented style.– Web (distributed hypermedia system)– REFTful Web services

22

REST (REpresentational State Transfer) An architecture style for distributed hypermedia systems

Components : Origin server, proxy, user agent,… Connectors : Client-side API, server-side API, … Data element : Resource, resource identifier, resource

representation, representation meta-data, resource meta-data, control data

Topology: multi-client/multi-server with immediate proxies Constraints: A set of REST principles

ClientOrigin Server

http

Connectors

Resources

23

REST : Illustration

Web

Clie

nt

Web

Ser

ver

Book TableGET /book/2Accept : video/mp4

Why Nations Fail

Guns, Germs, and Steel…………..

GET /booksAccept : text/html

24

REST …

1) Resource abstraction A concept with an identity (a well-formed

URI)E.g., word document, database record,

object representing human being, image, service, and a collection of other resources

Resources are nouns

25

REST …2) Resource representations

A Book (Database Raw)

XMLJSON

Application/xmlApplication/json

Media type (MIME types or content type)

Links

REST …

26

3) Messaging– HTTP Request

– 4 Main Verbs (operations on resources)• POST (Create), GET (Retrieve), PUT (Update), and DELETE (Delete)• Safety - do not modify resource representation– GET

• Idempotency - the same result for repeated calls of the same operation– GET, PUT, and DELETE

REST …

27

– HTTP request example

REST …

28

– HTTP Response

– Types of Response codes• 1xx Informational (e.g., 100 Continue)• 2xx Success (e.g., 200 OK)• 3xx Redirection (e.g., 301 Moved Permanently)• 4xx Client Error (e.g., 404 Not Found)• 5xx Server Error (e.g.,500 Internal Server Error)

REST …

29

– HTTP response example

REST …

(4) Uniform Interface• Object-Orientation

• Resource-Orientation

30

ReadBook()OrderBook()RateBook()…

GetCustomerName()GetCustomerAddress()UpdateCustomerName()….

Book Object Customer Object

GetPutPostDelete

GetPutPostDelete

Each resource has a unique URL, e.g., http://......../books/1

Order Resource

GetPutPostDeleteRatingResource

GetPutPostDelete

CustomerResource

GetPutPostDeleteAddressResource

Book Resource

31

REST …5) Context-free Interactions– Server can understand and process each request

based only on the information in the request.• Server does not keep client session states (but may keep

any other states such as resource states)

LoadBalancerClient

Add a Book to Shopping Cart

Checkout Cart

Session Affinity

Session Statelessness

Web

Ser

vers

REST …

6) Use of Intermediaries – To achieve the capabilities such as caching,

filtering, security, content inspection and manipulation, load balancing, etc.

32

ClientA

LoadBalancer

Cache

ClientB

Control data (HTTP Headers) can dictate the behaviors of these intermediaries

Cache-Control: max-age=300

33

REST ….7) HATEOAS - Hypertext As The Engine Of Application State– Hypertext links to reference user state/application

state and resources (provided by the server)• Provide => what we can do next, and the URI of

the resource we need to manipulate to do it. • Drive the process flow/workflow

GET http://.../orders => links to order resources and allowed HTTP operations on them => click those links (update, get, delete, etc.) of orders => …

34

Event-oriented Style (Event-Driven Architecture)

Event-Driven Architecture

35

Event Source

Event Source

Event Channel

Event Sink

Event Sink

E1 E1

E1 E1E1

Produce

Services, Sensors, Email Client, IoT Device, etc.

Transfer, Process

Sense, ConsumeProcess, Respond

TCP, sensor network, content-based pub-sub, ESB, etc.

Business Processes, IoT Devices, Bank Server,…

What is an Event?

36

• An occurrence of a significant action/situation , or a significant change in state

• Simple Event

• Complex Event– Temporal, Causal, and Spatial

Incorrect PIN On-Loan

Incorrect PIN Incorrect PIN Incorrect PINPotential

False Identity

Ordered Paid ShippedCase

Completed

Fire Detected Trigger Fire Alarm

After 10 seconds

No Sprinkler Activated

Event Processing styles …

37

• Simple Event Processing

• Stream Event Processing

rule "Towing" when $e1 : Event("eTowReqd") then … ExecuteService(“Tow”,msg);end

Event-Condition-Action (ECA) Rules

Rule EnginesJBoss DroolsJess

E1

E1

E1

E1 E1

E1

E1E1

E1

E1

E1

Que

ry

Esper

Select symbol, avg(price) as averagePrice from StockTickEvent.win:length (100)Group by symbol

Event Processing styles …

38

• Complex Event Processingrule "Delayed Shipping"when $e1 : BookOrdered( ) not ( BookShipped ( this after [0,7d] $e1 ) )then // inform the customer service // make 5% discountend

rule "Add a new fast service in case response time increases above threshold"when Number ( doubleValue > 100s ) from accumulate ( PerformanceMeasurements ( $rTime : responseTime ) over window:time ( 10m ), average ( $rTime ) )then // add a new service with higher response timeend

better

39

Event-Driven Publish/SubscribeProducer/Announcer

Consumer/Listener Consumer/Listener

Medium/Event Manger

Subscribe

Publish

Notify

40

Service-oriented Architecture

41

SOA (Service-Oriented Architecture)• Services– A discrete unit of functionality that can be accessed remotely

and acted upon and updated independently (wikipedia).– Services generally have published and discoverable

interfaces.– A service can encapsulate different types of entities.

• E.g., business capabilities, database, application, IoT device, …

• SOA– An architectural style that decomposes a software

application into a set of interacting, loosely coupled services and end-users.

42

Basic SOA: Concepts

Service Provider

Service Registry

Find

BindPublish

Service Client

Service Description

Service

Service Description

• Alternative heterogeneous services• Dynamic finding and binding (loosely coupled)• Message-oriented communication

43

Basic SOA: ExampleBook Publisher1

WSDL_1

WSDL_2

WSDL_3

Book Publisher3

Publish

WSO2 Service Registry

WSDL_1

WSDL_2

WSDL_3

E-book Shop

Book Publisher2

Find

Bind

44

What is a Service? …• Service Interface & Implementation

Implementation

Interface

What does it do?

How to use?

Where can I find it?

How to publish it ?Where to host it?

How to represent it ?

How to build it ?

Client Perspective Provider PerspectiveFrom Swinburne Lecture Notes

45

What is a Service?• Functional properties– Overall behavior – operations and their control

relationships– E.g., SearchBook, PlaceOrder, CheckOrderStatus,

ShipBook operations of a book publisher service• Non-functional properties– Quality attributes– E.g., An book order must be fulfilled within one week

(response time).

46

What is a Service? …• Type of services– Simple services• Request-response nature and fine-grained• E.g., weather reporting, credit card payment , currency

converter– Complex services • Compose and coordinate multiple services, and coarse-

grained• E.g., a service encapsulating buying book process

– Business services, utility services, computational services, data services, …

47

Extended SOA : Concepts

CapabilityInterfaceBehavior

DiscoverySelectionBinding

Publication

CoordinationConformanceTransactions

MetricsState management

Load balancingChange management

Description & Basic Operations

Composition

Management and Monitoring

Service provider

Service client

Service Operator

Service aggregator

SemanticsQoS

Extended SOA: Example

48

Shipment Service

Inventory Service

BillingService

Credit Card Service

WSO2 BPS WSO2 ESBWSO2 Service Registry

Monitoring, Management, and Policy

Composition

49

SOA Architecture Style: Summary• Components

– Service providers– Service consumers– Service registry– ESB (Enterprise Service Bus)– Orchestration server– Management plane– …

• Connectors– SOAP connector– REST connector– JMS (Java Messaging Service) connector– …

50

How to Implement SOA?

• Web services is the main approach to implement SOA-based applications.

1) REST –based (representational state transfer) RESTFul Services(Resource-oriented style)

2) WS-* –based SOAP Services (Message-oriented style, Method-oriented style, Event-oriented style )

51

WS-* : Web Services Stack / SOAP Services

• A set of open standards and the associated middleware-based solutions • Service description

– WSDL – Web Service Definition Language• Publication and Discovery

– UDDI – Universal Description, Discovery, and Integration. • Message

– SOAP – Simple Object Access Protocol– XML – EXtensible Markup Language

• Transport– HTTP – Hypertext Transfer Protocol – JMS – Java Message Service – SMTP – Simple Mail Transfer Protocol

52

WS-* : Web Services Stack …

• Quality of Service– Security – WS-Security– Reliability – WS-ReliableMessaging– …

• Service Policy– WS-Policy

• Business Processes and Service Compositions – BPEL - Business Process Execution Language– WS-CDL - Web Services Choreography Description Language– Custom ESB (enterprise service bus) Languages

53

WS-* : Web Services Stack …

From Swinburne lecture notes

54

ESB (Enterprise Service Bus)

Enterprise Application Integration (EAI)

55

• Point-to-Point

• Hub-and-Spoke

HUB

Applications/Services

• Complex • Tight coupling• Difficult to

understand, maintain/change

• Central control• Loose coupling

Routing, transformation, etc

How to scale? => Federated Hub

ESB – Enterprise Service Bus

56

Distributed

ESB services/ESB endpoints (Virtual services)

Mes

sage

Bus

ESB …

57

• Can implement complex EAI patterns – Splitter, Aggregator, ...– http://www.enterpriseintegrationpatterns.com/

• An Infrastructure for realizing SOA– Service virtualization– Service interaction mediation– Service discovery, monitoring, and management – Service QoS (Quality of Services)• Secure Messaging• Reliable Messaging• …

58

Business Processes and Service Compositions

Business Processes

59

• Ordered set of tasks/activities to achieve (a) specific (business) objective

UserBook

Inventory

GoogleBook

Amazon

RequestNewBoook

Start

CheckBookAvailability

Available?

RejectOrder AssessBookQuality

Quality?

Yes No

PlaceOrder

Bad

GoodEnd

Notify

Service Composition

SOA => Flexible, Dynamic Processes

Types of Processes

60

UserBook

Inventory

GoogleBook

Amazon

Coordination of

Tasks from

Composer View

Orchestration • BPEL• BPMN

Centralized Approach

Types of Processes …

61

User

Book Inventory

GoogleBook

Amazon

Choreography WS-CDL

• Global View of Externally Visible Interactions

• Decentralized approach

BuyBook

CheckQualitySearchBook

BuyB

ook

FindPublishers

Types of Processes …• Artefact-centric

• Restful (HATEOAS - Hypertext As The Engine Of Application State)

62

Created QualityChecked Ordered Completed

Order Artefact

/books /books/1/books/2

/books/2/order/payment/.../accounts/435/debit

Bank Service

Book Inventory Service

/books/2/order/books/2/rating

63

Topics Covered (Briefly)• Enterprise Applications/Computing• Architecture Styles for Enterprise Applications

– Method-oriented– Message-oriented– Resource-oriented

• REST (representational state transfer)– Event-oriented

• SOA (service-oriented architecture)– Basic and extended SOA– Implementing SOA

• RESTful • WS-* (web services stack)

– ESB (enterprise service bus)• Business processes and service compositions

64

65

References• COS80011 (Web Application Architectures), Swinburne University of

Technology • http://www.ibm.com/developerworks/library/ws-appint/• Papazoglou, Michael. Web services: principles and technology. Pearson

Education, 2008.• https://www.ibm.com/developerworks/library/ws-whichwsdl/• Michael P. Papazoglou, Paolo Traverso, Schahram Dustdar, and Frank

Leymann. 2007. Service-Oriented Computing: State of the Art and Research Challenges. Computer 40, 11 (November 2007), 38-45.

• Len Bass, Paul Clements, and Rick Kazman. 2013. Software Architecture in Practice (3 ed.). Pearson Education, Inc., USA.

• Roy Thomas Fielding. Architectural styles and the design of network-based software architectures. Diss. University of California, Irvine, 2000.

• Nicolai Josuttis. 2007. Soa in Practice: The Art of Distributed System Design. O'Reilly Media, Inc..