soa guest lecture at diku by dr. rasmus petersen (dec 17 2015)

Post on 22-Jan-2018

365 Views

Category:

Data & Analytics

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

SERVICE ORIENTED ARCHITECTURE

WHAT IS IT AND WHAT IS IT GOOD FOR?

N E T C O M PA N Y L E C T U R E S E R I E S

2 0 1 5

R AS M U S R O S E N Q V I S T P E T E R S E N

(Dr.) Rasmus Rosenqvist Petersen

Consultant

Netcompany since August 2015(Ph.d. fra Syddansk Universitet, og senest 3 år i Cambridge, England)

Sector: Unions software

Technologies: Java/JEE and Microsoft .NET

• Approx. 700+ consultants

– M.Sc. or Ph.D. typically from DTU, DIKU, ITU, ÅU, AAU, SDU

– Excel academically

• Offices in Copenhagen (HQ), Aarhus, Aalborg, Odense and Warszawa

• We deliver business-critical IT solutions

– Systems integration and SOA

– Portals

– Business applications

– Application and Facility Management

• Our customers include

– Financials Nordea, Saxo Bank, Letpension, PFA pension, FORCA, AP Pension

– Government KOMBIT, SKAT, Økonomistyrelsen, Undervisningsministeriet

– Industry Carlsberg, Dong Energy, Pandora

– Commerce Novozymes, Danmarks Apotekerforening

– Media JP/Politikens Hus, Aller

– Membership organizations IDA, HK, Dansk Erhverv

– Telco Telenor, TDC, Telmore

ABOUT NETCOMPANY

WHAT I WILL TALK ABOUT

SOA:

• SOA Concepts

• Describing a Service

• Designing Services

Mixing in

• A few cases with questions :-)

READY?

S E R V I C E O R I E N T E D A R C H I T E C T U R E

1

S O A C O N C E P T S

C o n t r a c t - b a s e d

L o o s e c o u p l i n g

A b s t r a c t i o n Reusabi l i ty

AUTONOMY

D i scoverabi l i ty

S TAT E L E S S N E S S

T H E H Y P E C Y C L E

W H A T H A P P E N E D A F T E R 2 0 0 9 ?

FIRST

SOA isn’t a technology.

SECOND

SOA isn’t new.

SOA rests on centuries old principles.

…yes, centuries!

B U S I N E S S S E R V I C E S

R E C E P T I O N

F I N A N C E

A C C O U N T I N G A R C H I V E

S A L E S

A D M I N I S T R A T I O N

Business case: University of Copenhagen

• What are the products?

• What are the business services?

• (think in terms of service areas and units)

R E C E P T I O N

F I N A N C E

A C C O U N T I N G A R C H I V E

S A L E S

A D M I N I S T R A T I O N

B U S I N E S S S E R V I C E S

ADMINISTRATION

SALES

ACCOUNTING

ARCHIVE

FINANCE

RECEPTION

D E P E N D E N C I E S

SALES ACCOUNTINGOpen Account

D E P E N D E N C I E S

ADMINISTRATION

SALES

ACCOUNTING

ARCHIVE

FINANCE

RECEPTION

S E R V I C E D E S I G N P R I N C I P L E S

S E R V I C E D E S I G N P R I N C I P L E S

S O U N D B U S I N E S S P R I N C I P L E S

S O A

ADMINISTRATION

SALES

ACCOUNTING

ARCHIVE

FINANCE

RECEPTION

MODEL

Case:EFI

Whatis EFI?

Case: EFI

• 1.000.000.000 DKK investment lost

• Accenture: ”The worlds most complex system for tax debt

recovery” – if it had worked.

• No requirements specification (400 out of typically 5000)

• EFI tightly coupled to other system, DMI

• Two suppliers, delivering the two systems, as separate

projects

• Better to deal with two monopolies than one? No!

• SOA was used to tie the two systems together

• Why was that problematic?

http://www.version2.dk/artikel/derfor-gik-det-galt-efi-systemet-412139

THIRD

SOA isn’t a dogma

THIRD

SOA isn’t a dogma

S O A M A N I F E S T O

www.soa-manifesto.org

P R I O R I T I E S

Business value over technical strategy

Strategic goals over project-specific benefits

Intrinsic interoperability over custom integration

Shared services over specific-purpose implementations

Flexibility over optimization

Evolutionary refinement over pursuit of initial perfection

G U I D I N G P R I N C I P L E S

Respect the social and power structure of the organization. Recognize that SOA ultimately demands change on many

levels. The scope of SOA adoption can vary. Keep efforts manageable and within meaningful boundaries. Products and

standards alone will neither give you SOA nor apply the service orientation paradigm for you. SOA can be realized

through a variety of technologies and standards. Establish a uniform set of enterprise standards and policies …

D E F I N I T I O N

2

D E S C R I B I N G A S E R V I C E

...a client who satisfies all the constraints listed is entitled to the benefits. This is the No Hidden Clause rule.The No Hidden Clauses principle does not prevent us from including references, implicit or explicit, to rules not physical part of the contract.

Computer, Vol. 25, No. 10. (1992), pp. 40-51.

A contract is a common agreement with benefits for all participants.

The Beatles’ first contract

A more recent contract

What is a contract?

A real world example

Domain model from customer

Service description from customer

XML type definition

Java service implementation stub

Complete vs loose contract

A complete contractParts of the contract differ in degree of detail/specificity. From more to less detail:

• Security model, infrastructure• Input / output complex types• Simpler xml types

• Normal behavior• Restrictions between optional elements• Expected business exceptions• Extreme behavior (e.g. no elements

found)

• Runtime exceptions (e.g. time out, full disk)

• Transactional integrity• Concurrency (even on www)

… is not always a possibilityTherefore, take great care in documenting the decisions made during implementation:

• Record changes, and the motivation for these

• Beware of other usages of type

• Detailed behavior in service description.• Restrictions between optional elements• Reuse exception types across services• Agree on common pattern for services

• Wrap in reusable exception types• Part of system architecture not service• Concurrency (even on www)

“Contract first” vs “Code first”

• Higher detail level

• Code independent

• Greater Interoperability

• Built in governance

• Less detailed

• Developer oriented

• Easy to get started

• Easy to break contract

WSDL

Code

Code

Code

Case: contract

• Complete elements? • Looser elements?

University Government

Student graduating

Money

3

D E S I G N I N G S E R V I C E S

Domain models and services

• Model your data tables directly from communication formats

• Don’t share physical types between internal and external services. Transformations in one system is easier than changing two systems.

• Loose coupling of systems

• Provide a global logic domain model as part of the contract, but leave external physical communication types flexible.

• Be aware that reuse of types between services is strong coupling

• Remember that services are used together. Output will be used as input by others.

Do’s Don'ts

Simple and more complex services

Keeping results in memory is a problem with large result sets. Consider streaming services.

Two separate systems for vehicles and license plates and a proxy service for an external system with information about people.

Simple services for Create, Read, Update and Delete, but what about more complex services?

FindVehiclesWithPlateMatching(pattern) {FindPlates(pattern)For each plate

result +=ReadVehicle(VIN)return result;

}

RegisterVechicleToPersonAndAssignPlate(VIN, person) {

UpdateVehicle // ad owner

GetNextAvailablePlate

UpdatePlate // add VIN}

NotifyPoliceAboutExpiredPlates(startDate, endDate) {

GetAllExpiredPlates(startDate, endDate);

Foreach Plate

FindVehicle(VIN)

FindPersion(PersonID)

result += (Vehicle, Plate, Person)}

Issues with concurrency and transactional integrity

“Batch job as service” with join over web service per element and non-domain information (address).

CRUD, Find or Process service?

• Filtering on fields and values

• Avoid joining over services

• Behavior for not found and large result sets.

Not all services are born alike!

Searching for entities via services

• On create, return assigned id

• Optional/required might differ in create and read.

• Update by sending changes or overwrite whole entity.

• Versioning on update can provide optimistic locking

• Keep old versions on update and delete operations

Create, Read, Update and Delete

• Sequences and available data (order of creation)

• Avoid joining over services

• Consider asynchronous patterns e.g. message queues

• Candidates for BPM

Processes in services

Bulk updates

• Avoid joining over services

• Let update services take a list of elements to update

MESSAGE EXCHANGE PATTERNS

Consumer

Provider

S Y N C H R O N O U S A S Y N C H R O N O U S

Consumer

Provider

Consumer

Provider

Request/Response Request/Response One-way

Question: Synchronous vs. asynchronous

• Positives? Negatives?

• Which is better for a service orientedarchitecture?

Consumer

Provider

S Y N C H R O N O U S A S Y N C H R O N O U S

Consumer

Provider

Consumer

Provider

Synchronous = Poor scalability

Member Portal

CRM Service Pension Service Finance Service

Enterprise Service Bus

1

2 3 4

Wait time of 1 is the sum of 2, 3 and 4 plus ESB time.

AN EFFECIENT SOA

IS

ASYNCHRONOUS

S O A

I S H E R E T O

STAY!

T H A T ’ S A L L !

Q U E S T I O N S

?

top related