Upgrade to Pro — share decks privately, control downloads, hide ads and more …

A day in a coffee shop: Building event-driven systems with structure

A day in a coffee shop: Building event-driven systems with structure

Red Hat Webinars, Jul 29th 2021

https://www.redhat.com/en/events/webinar/a-day-in-a-coffee-shop-building-event-driven-systems-with-structure

Follow me on twitter (@systemcraftsman) or subscribe to https://www.systemcraftsman.com/join/ to get any updates from me.

Aykut Bulgu

July 29, 2021
Tweet

More Decks by Aykut Bulgu

Other Decks in Programming

Transcript

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

    View Slide

  2. 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

    View Slide

  3. 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.

    View Slide

  4. 4
    The “Kaffe” Shop

    View Slide

  5. The Coffee Shop
    5

    View Slide

  6. The Coffee Shop
    6

    View Slide

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

    View Slide

  8. How the coffee shop works
    9

    View Slide

  9. 10
    Request-Driven
    Architecture

    View Slide

  10. Request-Driven Architecture
    11

    View Slide

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

    View Slide

  12. Request-Driven Architecture
    13

    View Slide

  13. Who you are gonna call?
    Who you are gonna call?
    14

    View Slide

  14. Mysterious man comes
    15

    View Slide

  15. Mr. Kafka
    16

    View Slide

  16. Mr. Kafka has a solution
    17

    View Slide

  17. 18
    Event-Driven Architecture
    and Messaging

    View Slide

  18. Event-Driven Architecture and Messaging
    19

    View Slide

  19. Event-Driven Architecture and Messaging
    20

    View Slide

  20. Event-Driven Architecture and Messaging
    21

    View Slide

  21. 22
    Apache Kafka with AMQ
    Streams

    View Slide

  22. 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.

    View Slide

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

    View Slide

  24. 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

    View Slide

  25. Everybody is happy with the changes
    29

    View Slide

  26. 30
    Marshmallow Problem

    View Slide

  27. Marshmallow Problem
    31

    View Slide

  28. Marshmallow Problem
    32

    View Slide

  29. Marshmallow Problem
    33

    View Slide

  30. Marshmallow Problem
    34

    View Slide

  31. Marshmallow Problem
    35

    View Slide

  32. Marshmallow Problem
    36

    View Slide

  33. Marshmallow Problem
    37

    View Slide

  34. Marshmallow Problem
    38

    View Slide

  35. Marshmallow Problem
    39

    View Slide

  36. The Contract
    42

    View Slide

  37. The Contract
    43

    View Slide

  38. 44
    Schemas as the Contract

    View Slide

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

    View Slide

  40. Schemas as the Contract
    46

    View Slide

  41. Schemas as the Contract
    47

    View Slide

  42. 48
    Red Hat Service Registry

    View Slide

  43. 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

    View Slide

  44. 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

    View Slide

  45. Schema contract on the wall
    51

    View Slide

  46. Schema contract on the wall
    52

    View Slide

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

    View Slide

  48. 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.

    View Slide

  49. 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

    View Slide