http: the other esb

53
HTTP: the other ESB Ryan Riley Catapult Systems, Inc. Houston TechFest 2009

Upload: ryan-riley

Post on 20-Aug-2015

3.585 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: HTTP: the Other ESB

HTTP: the other ESB

Ryan RileyCatapult Systems, Inc.Houston TechFest 2009

Page 2: HTTP: the Other ESB

Agenda

• Setting the Stage• Alternatives• HTTP: the application protocol• Common Concerns• Questions• Resources

Page 3: HTTP: the Other ESB

Setting the Stage

Page 4: HTTP: the Other ESB

First things first

• Demand – Specialized Tools– Different tools needed among front and back

office, as well as field workers– Once people get used to a tool, they don’t

want to change … except to get the features they want

• Supply – One-size-fits-all– Create reusable frameworks or components

and force them to fit the need– Save time and money (80/20 rule)

Page 6: HTTP: the Other ESB

The Integration Problem

• Start with Application Silos• Then need to Share and Aggregate

Data• Note:– Different systems with different needs– Different interpretations of data semantics–MUST communicate– Systems rarely die, but we keep adding

more

Page 7: HTTP: the Other ESB

The Contenders

• File sharing• Databases

– Direct sharing or ETL / Data Stores– How do you negotiate schema changes?

• Message-Oriented Middleware (MOM)– Fire and forget– Vendors rule the world: Message Broker, ESB, etc.

• Service-Oriented Architecture (SOA)– Back to silos– Which platform: Java, .NET, ESB framework, etc.

Page 8: HTTP: the Other ESB

Complexity becomes us

• Starts simple• Ends …

Spaghetti? Yum! from Dano Some rights reserved

Page 9: HTTP: the Other ESB

ESB to the rescue!

Page 10: HTTP: the Other ESB

… or perhaps not

“Enterprise Spaghetti Bus” – Jim Webber

Page 11: HTTP: the Other ESB

Meanwhile …

• New patterns and practices– Agile and Lean– TDD, BDD, DDD, CI, CQS/DDDD, etc.– Frameworks and tools to the rescue!

• The web as an application platform–WS-* emerges as an SOA solution– Rails & co make web programming

easier

Page 12: HTTP: the Other ESB

Alternatives

Page 13: HTTP: the Other ESB

WS-*

• Messaging: SOAP• Discoverability: WSDL• Security: WS-Security• Reliability: WS-MessageReliability• And a host of others:– WS-BusinessActivity– BPEL– Etc.

Page 14: HTTP: the Other ESB

WS-* (cont.)

• Scalability– Reliance on HTTP POST– Complex to achieve

• Transactions– Complicated protocols– Based on classic RPC paradigms

• Brought to you by HTTP POST

Page 15: HTTP: the Other ESB

Other alternatives

• ESB frameworks: NServiceBus, MassTransit, Rhino.ServiceBus, etc.

• Back to file/database sharing?

• Most of these are fire and forget models.

Page 16: HTTP: the Other ESB

HTTP: the application protocol

(and you thought the second T was for transport?)

Page 17: HTTP: the Other ESB

HTTP is comprehensive

• HTTP verbs– GET– PUT– POST– DELETE– HEAD– OPTIONS– And more through extensibility!

Page 18: HTTP: the Other ESB

Messaging

• Request

• Response

• It’s about communication!

GET /index.html HTTP/1.1

Accept: application/xhtml+xmlAccept-Language: en

HTTP/1.1 200 OK

Content-type: application/xhtml+xmlContent-length: 16

Hello TechFest!

Page 19: HTTP: the Other ESB

Status Codes

• 100 – 101 Informational• 200 – 206 Success• 300 – 307 Redirection• 400 – 417 Client Error• 500 – 505 Server Error

Page 20: HTTP: the Other ESB

GET

• Idempotent = massively scalable via caching

• Control caching through HTTP headers:– Client => Last-Modified + If-Modified-

Sinceor If-None-Match + ETag

– Server => Cache-Control and Expires

Page 21: HTTP: the Other ESB

PUT

• Useful for updating and creating• Idempotent = safe to repeat

Page 22: HTTP: the Other ESB

POST

• Create a new resource• Not necessarily safe

Page 23: HTTP: the Other ESB

DELETE

• Disable a resource (though not necessarily destroy)

• Safe to repeat, but the response is generally different when the resource doesn’t exist.

Page 24: HTTP: the Other ESB

HEAD

• Retrieves only the headers• Conditional GET

Page 25: HTTP: the Other ESB

OPTIONS

• Retrieves the HTTP verbs a resource URI will accept.

• The protocol tells the client how it may proceed.

Page 26: HTTP: the Other ESB

Hypermedia Types

• XHTML (application/xhtml+xml)• RSS (application/rss-2.0)• Atom/AtomPub

(application/atom+xml)• Custom (application/vnd.my-format)

Page 27: HTTP: the Other ESB

XHTML?

Page 28: HTTP: the Other ESB

XHTML for Messaging

Page 29: HTTP: the Other ESB

Why not XLink?

• Open XML link extension• Not well understood nor clearly

defined• In the end, you would still need

custom processing, so use application/vnd.custom+xml instead of application/xml

Page 30: HTTP: the Other ESB

Atom / AtomPub

• Well-understood hypermedia format– Collection <atom:feed> and single <atom:entry>

formats– Can use <atom:link> within custom media types

for well understood link semantics

• Works well as a queue (if you must)• Simple and extensible• Debate over message formats in

REST

Page 31: HTTP: the Other ESB

Add Semantics

• Microformats• RDF / RDFa

(FOAF)• Prefer

microformats(rel tag)

Page 32: HTTP: the Other ESB

The Role of Hypermedia

• REpresentational State Transfer (REST)• Accept header

(contentnegotiation)

• State transitions / Workflows (HATEOAS)– Single entry point– Next steps provided through links– Can swap out providers (links)

GET /index.html HTTP/1.1

Accept: application/xhtml+xml, application/jsonAccept-Language: en

Page 33: HTTP: the Other ESB

HATEOAS

http://www.infoq.com/articles/subbu-allamaraju-rest

Page 34: HTTP: the Other ESB

HATEOAS, cont.

With HATEOAS

No HATEOAS

http://www.infoq.com/articles/subbu-allamaraju-rest

Page 35: HTTP: the Other ESB

Reliability

• Idempotency• Response Error Codes• HTTP is synchronous by nature• Other ESB platforms are generally

asynchronous– Fire and forget– Need additional fault tolerance

mechanisms

Page 36: HTTP: the Other ESB

Security

• HTTP Basic and Digest authentication• HTTPs, the tried and true (but not

cahceable)• OpenID, OpenAuth, SAML

Page 37: HTTP: the Other ESB

Scalability

• Stateless, so massively scalable• Client and Proxy caches

Page 38: HTTP: the Other ESB

Transactions

• Hypermedia (HATEOAS)• Different paradigm with richer

semantics• Workflows and state transitions

Page 39: HTTP: the Other ESB

How to GET a Cup of Coffee

• http://www.infoq.com/articles/webber-rest-workflow

Page 40: HTTP: the Other ESB

Common Concerns

Page 41: HTTP: the Other ESB

Security Concerns

• Isn’t the web inherently insecure?• HTTPs is used everyday to transact

millions• Other protocols emerging– OpenId + OpenAuth– SAML

Page 42: HTTP: the Other ESB

Complexity

• Few frameworks exist for pure HTTP use– RESTClient and Sinatra (Ruby)– Limonade (PHP)– OpenRasta (.NET)

• Fairly simple to create from scratch• Mash-ups (just see how easy this is)– On the web– Call services from within Excel

Page 43: HTTP: the Other ESB

OpenRasta (C#)

Page 44: HTTP: the Other ESB

Limonade (PHP)

Page 45: HTTP: the Other ESB

Sinatra (Ruby)

Page 46: HTTP: the Other ESB

Tight-coupling

• This is a fear from having used WSDL• HATEOAS reduces coupling even more!– Don’t use URI templates (except internally)– URIs can be swapped at any time– Requires a layer in between your domain

and the external API– Upgrade client and server independently

(Accepts header)

Page 47: HTTP: the Other ESB

Summary

Page 48: HTTP: the Other ESB

There is no spoon (or bus)

• Paradigm shift• Dumb network vs. Smart network• Meaningful semantics over classic,

distributed spaghetti architecture• Take advantage of the

existing, richinfrastructure

Page 49: HTTP: the Other ESB

• Distributed computing for years now has seemed like an endless repackaging of the same old ideas, patterns, and technology. Through REST, I finally feel like distributing computing is evolving and moving forward again. While REST won't solve world hunger, it will certainly give us a new perspective to practice software engineering.~ Bill Burke, JBoss

Page 50: HTTP: the Other ESB

Questions?

Page 51: HTTP: the Other ESB

References

• Dr. Roy Fielding’s Dissertation• HTTP/1.1 (rfc2616)• The Atom Syndication Format• The Atom Publishing Protocol