Slide 1

Slide 1 text

A RESTful Approach to Real-time, Event Driven Messaging Paul O’Fallon @paulofallon Enterprise Architect, Cox Automotive

Slide 2

Slide 2 text

2

Slide 3

Slide 3 text

3

Slide 4

Slide 4 text

4 Our Starting Point

Slide 5

Slide 5 text

5 Drawbacks • Adding JMS consumers required SOA configuration changes • JMS isn't the best for non-JVM language support • JMS isn't the best for integrating with 3rd parties over the Internet • No message history • No symmetry between SOAP services and JMS messages

Slide 6

Slide 6 text

6 A new "Manheim API" Consistent, cohesive set of endpoints RESTful, hypermedia-inspired API Self-service sign-up, API key management Support for internal projects, customers and partners OAuth2 support for delegated interactions

Slide 7

Slide 7 text

7 Each resource has an “href” GET https://api.manheim.com/units/id/429a5d00-353c... {
 "href": "https://api.manheim.com/units/id/429a5d00-353c...",
 "vin": "1G1AP14P577112297",
 "description": {
 "modelYear": 2014,
 "make": "Ford",
 "model": "Mustang",
 "trim": "GT Convertible 2-Door",
 // ...
 }

Slide 8

Slide 8 text

8 Related Resources are also “hrefs” GET https://api.manheim.com/consignments/id/863cd3c0... {
 "href": "https://api.manheim.com/consignments/id/863cd3c0...",
 "status": "ACTIVE", "unit": {
 "href": "https://api.manheim.com/units/id/429a5d00-353c..."
 },
 "operatingLocation": {
 "href": "https://api.manheim.com/locations/id/AAA"
 },
 
 // ...
 }

Slide 9

Slide 9 text

9

Slide 10

Slide 10 text

10 Eventer

Slide 11

Slide 11 text

11 Events “Just an href”

Slide 12

Slide 12 text

12 API Example: /events POST https://api.manheim.com/events {
 "resource": "https://api.manheim.com/consignments/id/863cd3c0...", "eventType": "CONSIGNMENTS.CHECKEDIN",
 "body": {
 "href": "https://api.manheim.com/consignments/id/863cd3c0...",
 "status": "ATAUCTION",
 "unit": {
 "href": "https://api.manheim.com/units/id/429a5d00-353c..."
 },
 "operatingLocation": {
 "href": "https://api.manheim.com/locations/id/AAA"
 }
 }
 }

Slide 13

Slide 13 text

13 Eventer

Slide 14

Slide 14 text

14 Eventer

Slide 15

Slide 15 text

15 Subscribers & Subscriptions

Slide 16

Slide 16 text

16 API Example: /subscribers POST https://api.manheim.com/subscribers { "callback": "http://www.somecustomer.com/cb", "headers": { "Authorization": "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" }, "email": "[email protected]" } Location: https://api.manheim.com/subscribers/id/005739ae-625b...

Slide 17

Slide 17 text

17 Subscribers & Subscriptions

Slide 18

Slide 18 text

18 Subscription Matching Criteria • One or more Resource URLs (inc. related resources) • Event type (inc. wildcards: CONSIGNMENTS.*) • VIN … or any combination of the above (treated as a logical 'and')

Slide 19

Slide 19 text

19 Resource Expansion { "resource": "https://api.manheim.com/consignments/id/863cd3c...",
 "eventType": "CONSIGNMENTS.CHECKEDIN", "body": {
 "href": "...",
 "status": "ATAUCTION",
 "unit": {
 "href": "..."
 },
 "operatingLocation": {
 "href": "..." }
 } } "expansions": [
 "root", "unit",
 "operatingLocation"
 ]

Slide 20

Slide 20 text

20 API Example: /subscriptions POST https://api.manheim.com/subscriptions { "subscriber": {
 "href": "https://api.manheim.com/subscribers/id/005739ae..."
 }, "criteria": [
 { "type": { "pattern": "CONSIGNMENTS.CHECKEDIN" } }, { "resource": { "href": "https://api.manheim.com/locations/id/AAA" } } ], "expansions": ["root",
"unit"] }

Slide 21

Slide 21 text

21 A Published Event { "href": "https://api.manheim.com/events/id/624c277c...", "eventType": "CONSIGNMENTS.CHECKEDIN", "body": { "href": "https://api.manheim.com/consignments/id/863cd3c0...", "status": "ATAUCTION", "operatingLocation": { "href": https://api.manheim.com/locations/id/AAA } }, "createdOn": "2015-11-16T20:48:26.138Z", "subscription": { "href": "https://api.manheim.com/subscriptions/id/cd09a47c..." }, "subscriber": { "href": "https://api.manheim.com/subscribers/id/005739ae..." } }

Slide 22

Slide 22 text

22 Can Pull Events Too By subscription
 https://api.manheim.com/events/subscription/696f2d67-b483… By subscriber
 https://api.manheim.com/events/subscriber/005739ae-625b... Individual event https://api.manheim.com/events/id/1c160532-13ac...

Slide 23

Slide 23 text

23 High Level Architecture

Slide 24

Slide 24 text

24 Future Plans Today: Recovery via Retrieval 1. When retries are exhausted, event is not passed to the callback 2. Client must pull (GET /events) for missing events to fill in gaps Future: Recovery via Replay 1. Client can pause callbacks, or… 2. Client can request a "replay" of missed events 3. Recovered events will be delivered in order (before new events)

Slide 25

Slide 25 text

25 To Learn More…

Slide 26

Slide 26 text

Thank you! @paulofallon