Slide 1

Slide 1 text

4 Patterns to Jumpstart your Event-Driven Architecture Journey Hans-Peter Grahsl Developer 🥑 Advocate 1

Slide 2

Slide 2 text

Who am I ? 2 Developer 🥑 Advocate @ Red Hat based in Graz, Austria 󰎈 open-source enthusiast 5x Confluent Community Catalyst MongoDB Champion since 2020 speaker at dev & tech conferences @[email protected] Hans-Peter Grahsl “I’m passionate about event-driven architectures, distributed stream processing systems and data engineering.”

Slide 3

Slide 3 text

Agenda 3 What we’ll discuss today ▸ Claim Check Pattern ▸ Content Enricher Pattern ▸ Message Translator Pattern ▸ Outbox Pattern

Slide 4

Slide 4 text

EDA Terminology 4 … is a way of designing loosely coupled services that respond (in near real-time) based on the sending and receiving of events. 🤔 Event-Driven Architecture (EDA) ?

Slide 5

Slide 5 text

EDA Terminology 5 Multiple flavours https://martinfowler.com/articles/201701-event-driven.html 1. Event Notification 2. Event-Carried State Transfer 3. Event Sourcing 4. CQRS (selectively combined with the above)

Slide 6

Slide 6 text

EDA Terminology 6 This talk’s meaning of Event-Driven Architecture https://martinfowler.com/articles/201701-event-driven.html 1. Event Notification 2. Event-Carried State Transfer 3. Event Sourcing 4. CQRS (selectively combined with the above) this talk’s meaning

Slide 7

Slide 7 text

It’s all about events … 7 EVENTS EVENTS EVERYWHERE

Slide 8

Slide 8 text

8 One seeks bullets of silver … … but only finds trade-offs.

Slide 9

Slide 9 text

Agenda 9 Let’s explore the patterns… ▸ Claim Check Pattern ▸ Content Enricher Pattern ▸ Message Translator Pattern ▸ Outbox Pattern

Slide 10

Slide 10 text

Claim Check Pattern 10 ▸ inherently binary data graphics, documents, audio, video, … ▸ embedded data (e.g. Base64 encoded) in otherwise textual formats (json, xml, …) unnaturally large / unreasonably heavy event payloads Challenge

Slide 11

Slide 11 text

Claim Check Pattern 11 ▸ offload large (binary) payload into separate storage system ▸ replace actual payload with reference to claim check ▸ use claim check to fetch data when needed at consumer side externalize large event payloads … or parts thereof Claim Check Pattern

Slide 12

Slide 12 text

Claim Check Pattern 12

Slide 13

Slide 13 text

Claim Check Pattern 13

Slide 14

Slide 14 text

Claim Check Pattern 14

Slide 15

Slide 15 text

Claim Check Pattern 15

Slide 16

Slide 16 text

Claim Check Pattern 16

Slide 17

Slide 17 text

Claim Check Pattern 17

Slide 18

Slide 18 text

18 Claim Check Pattern

Slide 19

Slide 19 text

Agenda 19 Let’s explore the patterns… ▸ Claim Check Pattern ▸ Content Enricher Pattern ▸ Message Translator Pattern ▸ Outbox Pattern

Slide 20

Slide 20 text

Content Enricher Pattern 20 ▸ payloads are lacking additional details ▸ certain consumers need to know more ▸ example: very compact notification events unnaturally small / unreasonably light event payloads Challenge

Slide 21

Slide 21 text

Content Enricher Pattern 21 ▸ add missing data e.g. include contextual information ▸ do lookups / perform joins against reference data ▸ take reference data to augment original payload increase the utility of sparse event payloads Content Enricher Pattern

Slide 22

Slide 22 text

Content Enricher Pattern 22

Slide 23

Slide 23 text

Content Enricher Pattern 23

Slide 24

Slide 24 text

Content Enricher Pattern 24

Slide 25

Slide 25 text

Content Enricher Pattern 25

Slide 26

Slide 26 text

Content Enricher Pattern 26

Slide 27

Slide 27 text

27 Content Enricher Pattern

Slide 28

Slide 28 text

Agenda 28 Let’s explore the patterns… ▸ Claim Check Pattern ▸ Content Enricher Pattern ▸ Message Translator Pattern ▸ Outbox Pattern

Slide 29

Slide 29 text

Message Translator Pattern 29 ▸ examples: ・ integrate legacy systems ・ work with proprietary data formats ▸ minimize or at least reduce the contract-related coupling incompatible or inconvenient event payloads Challenge

Slide 30

Slide 30 text

Message Translator Pattern 30 ▸ perform a wide range of payload modifications: ・ basic field type conversions ・ rename, redact, or mask fields ・ switch format / protocol ・ … ▸ can also be used to build an anti-corruption layer establish compatibility between disparate systems Message Translator Pattern

Slide 31

Slide 31 text

Message Translator Pattern 31

Slide 32

Slide 32 text

Message Translator Pattern 32

Slide 33

Slide 33 text

Message Translator Pattern 33

Slide 34

Slide 34 text

Message Translator Pattern 34

Slide 35

Slide 35 text

Message Translator Pattern 35

Slide 36

Slide 36 text

Message Translator Pattern 36

Slide 37

Slide 37 text

37 Message Translator Pattern

Slide 38

Slide 38 text

Agenda 38 Let’s explore the patterns… ▸ Claim Check Pattern ▸ Content Enricher Pattern ▸ Message Translator Pattern ▸ Outbox Pattern

Slide 39

Slide 39 text

Outbox Pattern 39 ▸ XA transactions ? potentially unreasonable choice or sometimes not available at all ▸ example: (micro)service updates its own database and sends event(s) to messaging/event streaming infra consistently update data in 2 different systems Challenge

Slide 40

Slide 40 text

Outbox Pattern 40 ▸ perform single database transaction spanning: ・ update(s) to affected DB tables (“domain data”) ・ update(s) to outbox DB table (“event data”) ▸ setup separate CDC pipeline for outbox table ・ transfer event data to messaging/event streaming infra ▸ consume CDC stream on-demand in near real-time avoid the dual-writes issue Outbox Pattern

Slide 41

Slide 41 text

Outbox Pattern 41

Slide 42

Slide 42 text

Outbox Pattern 42

Slide 43

Slide 43 text

Outbox Pattern 43

Slide 44

Slide 44 text

Outbox Pattern 44

Slide 45

Slide 45 text

Outbox Pattern 45

Slide 46

Slide 46 text

46 Outbox Pattern

Slide 47

Slide 47 text

▸ no silver bullets for event design / communication → only trade-offs ▸ patterns help to deal with implications and cope with trade-offs Wrap Up 47 Summary of discussed EDA patterns Claim Check Pattern Content Enricher Pattern Message Translator Pattern Outbox Pattern

Slide 48

Slide 48 text

Demo Repository 48 bit.ly/eda-patterns

Slide 49

Slide 49 text

Upcoming Talk 49 From edge to cloud, creating data pipelines using open-source with Strimzi on Kubernetes. Date: Wednesday, September 27 Time: 4:30 pm Location: Breakout Room 7 Speakers: Chris Cranford, Carles Arnal There will be a raffle with gifts at the end of the session!

Slide 50

Slide 50 text

linkedin.com/showcase/red-hat-developer youtube.com/RedHatDevelopers facebook.com/RedHatDeveloper twitter.com/rhdevelopers 50 Red Hat is the world’s leading provider of enterprise open source software solutions. Award-winning support, training, and consulting services make Red Hat a trusted adviser to the Fortune 500. Thank you ! Questions ?

Slide 51

Slide 51 text

51 https://unsplash.com/photos/DRzYMtae-vA https://pixabay.com/illustrations/night-sky-stars-moon-wolf-garou-4726445/ https://unsplash.com/photos/HTIduwcMMfQ https://unsplash.com/photos/w9rYOScXf6E https://unsplash.com/photos/iar-afB0QQw https://unsplash.com/photos/q65bNe9fW-w https://pixabay.com/photos/video-production-video-movie-film-4223885/ https://pixabay.com/photos/feather-bird-plumage-flying-4380861/ https://unsplash.com/photos/MceA9kSze0U https://pixabay.com/photos/travel-adapter-plug-charging-plug-3320763/ https://unsplash.com/photos/g97bviyFhvQ https://pixabay.com/illustrations/post-office-mailbox-old-yellow-2438804/ https://pixabay.com/photos/post-office-letter-box-mail-box-2455580/ https://pixabay.com/photos/ecommerce-shopping-credit-card-2607114/ in order of appearance Photo Credits