Slide 1

Slide 1 text

Building event-driven systems with structure A day in a coffee shop Aykut Bulgu Services Content Architect 1

Slide 2

Slide 2 text

Me as Code 2 #oc apply -f aykutbulgu.yaml apiVersion: redhat/v3.2 kind: Services Content Architect metadata: name: Aykut Bulgu namespace: Red Hat Global Learning Services annotations: twitter: @systemcraftsman email: - [email protected] - [email protected] organizer: Software Craftsmanship Turkey founder: System Craftsman labels: married: yes children: 1 interests: - tech (mostly kafka) - aikido - gamification - stoicism spec: replicas: 1 containers: - image: aykut:latest

Slide 3

Slide 3 text

Agenda 3 ● HTTP-request based architecture and its drawbacks. ● Event-driven Architecture with Red Hat AMQ streams and how it solves problems by reducing the coupling between services. ● Schema types like JSON, protobuf, Avro. ● Contract-based, event-driven architecture with Red Hat Service Registry and its capabilities.

Slide 4

Slide 4 text

4 The “Kaffe” Shop

Slide 5

Slide 5 text

The Coffee Shop 5

Slide 6

Slide 6 text

The Coffee Shop 6

Slide 7

Slide 7 text

8 Truth behind the baristas Kaffe shop rule: Prepare in 1.5 seconds or not Barista capacity: 0-5 seconds preparation time

Slide 8

Slide 8 text

How the coffee shop works 9

Slide 9

Slide 9 text

10 Request-Driven Architecture

Slide 10

Slide 10 text

Request-Driven Architecture 11

Slide 11

Slide 11 text

Request-Driven Architecture 12 Latency Availability Performance No fault tolerance Tightly coupled

Slide 12

Slide 12 text

Request-Driven Architecture 13

Slide 13

Slide 13 text

Who you are gonna call? Who you are gonna call? 14

Slide 14

Slide 14 text

Mysterious man comes 15

Slide 15

Slide 15 text

Mr. Kafka 16

Slide 16

Slide 16 text

Mr. Kafka has a solution 17

Slide 17

Slide 17 text

18 Event-Driven Architecture and Messaging

Slide 18

Slide 18 text

Event-Driven Architecture and Messaging 19

Slide 19

Slide 19 text

Event-Driven Architecture and Messaging 20

Slide 20

Slide 20 text

Event-Driven Architecture and Messaging 21

Slide 21

Slide 21 text

22 Apache Kafka with AMQ Streams

Slide 22

Slide 22 text

Apache Kafka Apache Kafka with AMQ Streams 23 Kafka Topic Producer Consumer 1 2 3 1 2 3 Time-based message retention model by default Messages are retained according to topic config (time or capacity) Also “compacted topic” – like a “last-value topic” “Dumb broker, smart client” Client maintains position in message stream Message stream can be replayed Throughput up to 1 million mes./sec.

Slide 23

Slide 23 text

Apache Kafka with AMQ Streams 24 AMQ Streams on RHEL AMQ Streams on OpenShift OpenShift Streams Apache Kafka with AMQ Streams

Slide 24

Slide 24 text

Apache Kafka with AMQ Streams 25 Cluster Operator Kafka CR Kafka Zookeeper Deploys & manages cluster Topic Operator User Operator Topic CR User CR Manages topics & users

Slide 25

Slide 25 text

Everybody is happy with the changes 29

Slide 26

Slide 26 text

30 Marshmallow Problem

Slide 27

Slide 27 text

Marshmallow Problem 31

Slide 28

Slide 28 text

Marshmallow Problem 32

Slide 29

Slide 29 text

Marshmallow Problem 33

Slide 30

Slide 30 text

Marshmallow Problem 34

Slide 31

Slide 31 text

Marshmallow Problem 35

Slide 32

Slide 32 text

Marshmallow Problem 36

Slide 33

Slide 33 text

Marshmallow Problem 37

Slide 34

Slide 34 text

Marshmallow Problem 38

Slide 35

Slide 35 text

Marshmallow Problem 39

Slide 36

Slide 36 text

The Contract 42

Slide 37

Slide 37 text

The Contract 43

Slide 38

Slide 38 text

44 Schemas as the Contract

Slide 39

Slide 39 text

Schemas as the Contract 45 ● JSON Schema ● Google Protocol Buffer ● Apache Avro

Slide 40

Slide 40 text

Schemas as the Contract 46

Slide 41

Slide 41 text

Schemas as the Contract 47

Slide 42

Slide 42 text

48 Red Hat Service Registry

Slide 43

Slide 43 text

Red Hat Service Registry 49 ● Based on the upstream Apicurio project. ● Handles following data formats: ○ Apache Avro ○ JSON Schema ○ Protobuf (protocol buffers) ● Storage options ○ Kafka ○ PostgreSQL

Slide 44

Slide 44 text

Red Hat Service Registry 50 Schema management with service registry Producer Consumer Deserializer Serializer Service Registry | | | | | | | | | | | | | | | | | | | | | Apache Kafka Get or Register Schema by Id Retrieve Schema by Id Topic B (JSON) Topic C (Protobuf) Topic A (Avro) Send Serialized Data Retrieve Serialized Data

Slide 45

Slide 45 text

Schema contract on the wall 51

Slide 46

Slide 46 text

Schema contract on the wall 52

Slide 47

Slide 47 text

CONFIDENTIAL Designator Resources 55 https://github.com/RedHatTraining/AD482-ToT-CoffeeShop

Slide 48

Slide 48 text

CONFIDENTIAL Designator Developing Event-Driven Applications with Apache Kafka and Red Hat AMQ Streams (AD482) Designing and developing event-driven applications using Kafka and Red Hat AMQ Streams. New course 56 LEARN MORE This course will be available next month, but the hands-on labs are available now in the Red Hat Learning Subscription. You can access the Early Access content by logging into your account and clicking the “Early Access” button in the top menu bar. If you’re not a subscriber, learn more about the Red Hat Learning Subscription.

Slide 49

Slide 49 text

linkedin.com/company/red-hat youtube.com/user/RedHatVideos facebook.com/redhatinc twitter.com/RedHat 57 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