Top Banner
Event Store and Web Applications Greg Young @gregyoung
65
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Event Store and Web Applications Greg Young @gregyoung.

Event Store and Web Applications

Greg Young @gregyoung

Page 2: Event Store and Web Applications Greg Young @gregyoung.
Page 3: Event Store and Web Applications Greg Young @gregyoung.

Purchase Order

Line Items (n)

Shipping Information

Page 4: Event Store and Web Applications Greg Young @gregyoung.

Cart Created

3 Items Added

Shipping Information

Added

Page 5: Event Store and Web Applications Greg Young @gregyoung.

Purchase OrderAddItemCommand

ChangeAddressCommand

AddItemCommandAddItemCommand

Page 6: Event Store and Web Applications Greg Young @gregyoung.
Page 7: Event Store and Web Applications Greg Young @gregyoung.

Cart Created

3 Items Added

1Item Removed

Shipping Information

Added

Page 8: Event Store and Web Applications Greg Young @gregyoung.
Page 9: Event Store and Web Applications Greg Young @gregyoung.

6

5

4

3

2

1

7

Page 10: Event Store and Web Applications Greg Young @gregyoung.

5

snap

4

3

2

1

6

Page 11: Event Store and Web Applications Greg Young @gregyoung.
Page 12: Event Store and Web Applications Greg Young @gregyoung.

A single model cannot be appropriate for reporting, searching, and transactional

behaviors…

Page 13: Event Store and Web Applications Greg Young @gregyoung.

Focus on strategic design first.

Page 14: Event Store and Web Applications Greg Young @gregyoung.

There is no “best” storage.

Page 15: Event Store and Web Applications Greg Young @gregyoung.

Focus on strategic design first.

Page 16: Event Store and Web Applications Greg Young @gregyoung.

A single data model is almost never appropriate.3+ is common!

Page 17: Event Store and Web Applications Greg Young @gregyoung.

Focus on strategic design first.

Page 18: Event Store and Web Applications Greg Young @gregyoung.

Focus on strategic design first.

Id ParentId Data

1 0 Parent

2 1 Child1

3 1 Child2

Page 19: Event Store and Web Applications Greg Young @gregyoung.

Focus on strategic design first.

Id ParentId0 ParentId1 ParentId2 ParentId3 ParentId4 Data

1 0 0 0 0 0 Parent

2 1 0 0 0 0 Child1

3 1 2 0 0 0 Child2

Page 20: Event Store and Web Applications Greg Young @gregyoung.

Wrong models cause massive accidental complexity

Page 21: Event Store and Web Applications Greg Young @gregyoung.

Client

Domain

Bus

OLAP

GraphDb

StreamProcessing

publish

3nf

Hibernate

Page 22: Event Store and Web Applications Greg Young @gregyoung.

Client

Domain

Bus

OLAP

GraphDb

StreamProcessing

publish

3nf

Hibernate

Page 23: Event Store and Web Applications Greg Young @gregyoung.

Client

Domain

Bus

OLAP

GraphDb

StreamProcessing

publish

3nf

Hibernate

New Model?

Page 24: Event Store and Web Applications Greg Young @gregyoung.

Client

Domain

OLAP

GraphDb

StreamProcessing

Events

Page 25: Event Store and Web Applications Greg Young @gregyoung.

Client

Domain

OLAP

GraphDb

StreamProcessing

Events

New Model

Page 26: Event Store and Web Applications Greg Young @gregyoung.

Client

Client

Client

Events

ClientAny Producer

Page 27: Event Store and Web Applications Greg Young @gregyoung.

All streams are Atom Feeds

Page 28: Event Store and Web Applications Greg Young @gregyoung.

Atom feeds seem inefficient, are they?

Page 29: Event Store and Web Applications Greg Young @gregyoung.

Get Head of Stream

Page 30: Event Store and Web Applications Greg Young @gregyoung.

Get Head of Stream

Reply with first/last links

Page 31: Event Store and Web Applications Greg Young @gregyoung.

<?xml version="1.0" encoding="UTF-8"?> <feed xmlns="http://www.w3.org/2005/Atom"> <title>Event stream 'newstream'</title> <id>http://127.0.0.1:2113/streams/newstream</id> <updated>2013-06-29T14:45:06.550308Z</updated> <author> <name>EventStore</name> </author> <link href="http://127.0.0.1:2113/streams/newstream" rel="self" /> <link href="http://127.0.0.1:2113/streams/newstream/head/backward/20" rel="first" /> <link href="http://127.0.0.1:2113/streams/newstream/0/forward/20" rel="last" /> <link href="http://127.0.0.1:2113/streams/newstream/1/forward/20" rel="previous" /> <link href="http://127.0.0.1:2113/streams/newstream/metadata" rel="metadata" />

Page 32: Event Store and Web Applications Greg Young @gregyoung.

Get Head of Stream

Reply with first/last links

Get Document with Links

Page 33: Event Store and Web Applications Greg Young @gregyoung.

Get Head of Stream

Reply with first/last links

Get Document with Links

Reply Document with Links to Events

Page 34: Event Store and Web Applications Greg Young @gregyoung.

<entry> <title>0@newstream</title> <id>http://127.0.0.1:2113/streams/newstream/0</id> <updated>2013-06-29T14:45:06.550308Z</updated> <author> <name>EventStore</name> </author> <summary>event-type</summary> <link href="http://127.0.0.1:2113/streams/newstream/0" rel="edit" /> <link href="http://127.0.0.1:2113/streams/newstream/0" rel="alternate" /></entry><entry> <title>1@newstream</title> <id>http://127.0.0.1:2113/streams/newstream/1</id> <updated>2013-06-29T14:45:06.550308Z</updated> <author> <name>EventStore</name> </author> <summary>event-type</summary> <link href="http://127.0.0.1:2113/streams/newstream/1" rel="edit" /> <link href="http://127.0.0.1:2113/streams/newstream/1" rel="alternate" /></entry>

Page 35: Event Store and Web Applications Greg Young @gregyoung.

Get Head of Stream

Reply with first/last links

Get Document with Links

Reply Document with Links to Events

Get /streams/foo/events/1

Page 36: Event Store and Web Applications Greg Young @gregyoung.

Get Head of Stream

Reply with first/last links

Get Document with Links

Reply Document with Links to Events

Get /streams/foo/events/1

Reply Document with Links to Events

Page 37: Event Store and Web Applications Greg Young @gregyoung.

Get Head of Stream

Reply with first/last links

Get Document with Links

Reply Document with Links to Events

Get /streams/foo/events/1

Get /streams/foo/events/2

Reply Document with Links to Events

Page 38: Event Store and Web Applications Greg Young @gregyoung.

Get Head of Stream

Reply with first/last links

Get Document with Links

Reply Document with Links to Events

Get /streams/foo/events/1

Get /streams/foo/events/2

Reply Document with Links to Events

Reply Document with Links to Events

Page 39: Event Store and Web Applications Greg Young @gregyoung.

Much is forgotten here.

Page 40: Event Store and Web Applications Greg Young @gregyoung.

Http KeepAlives

Page 41: Event Store and Web Applications Greg Young @gregyoung.

Http Pipelining

Page 42: Event Store and Web Applications Greg Young @gregyoung.

Intermediaries!

Page 43: Event Store and Web Applications Greg Young @gregyoung.

Content Type Negotiation!

Page 44: Event Store and Web Applications Greg Young @gregyoung.

Get Head of Stream

Page 45: Event Store and Web Applications Greg Young @gregyoung.

Get Head of Stream

Reply with first/last links

Page 46: Event Store and Web Applications Greg Young @gregyoung.

Get Head of Stream

Reply with first/last links

Get Document with Links

Reply Document with Links to Events

Page 47: Event Store and Web Applications Greg Young @gregyoung.

Get Head of Stream

Reply with first/last links

Get Document with Links

Reply Document with Links to Events

Get /streams/foo/events/1

Get /streams/foo/events/2

Accept: app/json

Accept: app/xml

Page 48: Event Store and Web Applications Greg Young @gregyoung.

Get Head of Stream

Reply with first/last links

Get Document with Links

Reply Document with Links to Events

Get /streams/foo/events/1

Get /streams/foo/events/2

Reply Document with Links to Events

Reply Document with Links to Events

Accept: app/json

Accept: app/xml

ContentType: app/json

ContentType: app/xml

Page 49: Event Store and Web Applications Greg Young @gregyoung.

ES-LongPoll: 30

Page 50: Event Store and Web Applications Greg Young @gregyoung.

Client

Client

Client

Events

ClientAny Producer

Page 51: Event Store and Web Applications Greg Young @gregyoung.

Client

Client

Client

Eventsua

ClientAny Producer

Nginx nyc

Nginx vno

Page 52: Event Store and Web Applications Greg Young @gregyoung.

{ rewritePattern : “/mystuff/{stream}/{event}}

Page 53: Event Store and Web Applications Greg Young @gregyoung.

Acceptsecurity_summary

Accept:security_detail

Accept:security_raw

Events

Security Master

Security Handler

Page 54: Event Store and Web Applications Greg Young @gregyoung.

Acceptsecurity_summary

Accept:security_detail

Accept:security_raw

Events

Security Master

Security Handler

Accept:security_detail2?

Page 55: Event Store and Web Applications Greg Young @gregyoung.

Browser

Events

Browser

Validate

IndexDb IndexDb

AtomPub

Page 56: Event Store and Web Applications Greg Young @gregyoung.

Browser

Events

Browser

Validate

IndexDb IndexDb

AtomPub

Page 57: Event Store and Web Applications Greg Young @gregyoung.

Browser

Events

Browser

Validate

IndexDb IndexDb

AtomPub

Page 58: Event Store and Web Applications Greg Young @gregyoung.

Browser

Events

Browser

Validate

IndexDb IndexDb

AtomPub

Page 59: Event Store and Web Applications Greg Young @gregyoung.

Browser

Events

Validate

IndexDb

AtomPub

Page 60: Event Store and Web Applications Greg Young @gregyoung.

Browser

Events

Validate

IndexDb

AtomPub

Page 61: Event Store and Web Applications Greg Young @gregyoung.

A single model cannot be appropriate for reporting, searching, and transactional

behaviors…

Page 62: Event Store and Web Applications Greg Young @gregyoung.

Atom feeds are efficient on a massive scale

Page 63: Event Store and Web Applications Greg Young @gregyoung.

There is no “best” storage.

Page 64: Event Store and Web Applications Greg Young @gregyoung.

Event Store is BSD-3 OSS

Page 65: Event Store and Web Applications Greg Young @gregyoung.

Questions?