SlideShare a Scribd company logo
1 of 17
Download to read offline
CrealyticsEvents
A step closer to an event-driven architecture
What we have:
message_bus
• Arbitrarily named topics
• Multiple event types per topic
• event_type explicitly defined as part of the message body
• Which topic should I listen to to get a particular event type?
• No schema validation — can send anything
• No schema versioning — how can we evolve the schema?
• No documentation of topics, event data structure, or data fields
• The message body is JSON
What we would like to have:
crealytics_events
• Required field event_type goes away — the topic determines the event
type (1:1 relationship)
• Events are serialized / deserialized to / from Avro
• Event model <=> Avro
• Each topic has its own schema, stored in a schema registry
• Schema evolution and reconciliation is done according to Avro
specifications
• Events are validated against the topic's schema upon production and
consumption
• Schemas and topics are documented with YARD
• The crealytics Ruby interface to Apache Kafka
• Abstracts away all concerns associated with
publishing, consuming, serializing, and
deserializing messages
• Supports MRI and JRuby
crealytics_events
v0.0.1
External dependencies
• avro-schema-registry	
• Implementation of the Confluent Schema Registry API
as a Rails application
• avro-builder	
• Ruby DSL to create Avro schemas
• avromatic	
• Avromatic generates Ruby models from Avro schemas
and provides utilities to encode and decode them
Environment setup
MESOS_ENVIRONMENT=development	
KAFKA_BROKERS=kafka1:9092	kafka2:9092	
KAFKA_TOPICS=["password-reset-requests"]	
KAFKA_SCHEMA_REGISTRY_URL=http://
derp:avro@schema_registry:21000	
PORT0=21000
Configuration
1. Configure using environment variables
(producer example)
Configuration
1. Configure directly
(consumer example)
Event models
• Inherit from BaseEvent
• Provides required fields: uuid, time_stamp, and event_source	
• Provides method emit for sending events
• Have a unique associated topic inferred from the class name
• For example: CustomerEvent => customer-events	
• Include the Avro schemas
Avro Schema DSL
• BaseEvent
• A child event (example)
Sending events
1. Create an event model
2. Fill in all required fields
3. Call emit
Listening for events
(really)
What happens when we get
an event?
Remember event handlers during the configuration step?
Q: But what is an event handler?
A: Any object which responds to a method call
Wait, but where is Kafka?
Don’t worry about it
(CrealyticsEvents encapsulates all Kafka interaction)
Next steps
• Aggregate events, embedding events
• Schema version evolution
• Mapping handlers to event models instead of text
topics
• Improving default decoder
Demo
Danke!

More Related Content

What's hot

Real World Event Sourcing and CQRS
Real World Event Sourcing and CQRSReal World Event Sourcing and CQRS
Real World Event Sourcing and CQRSMatthew Hawkins
 
NiFi - First approach
NiFi - First approachNiFi - First approach
NiFi - First approachMickael Cassy
 
Discover the Capabilities of Windows Azure Service Bus to Power Agile Busines...
Discover the Capabilities of Windows Azure Service Bus to Power Agile Busines...Discover the Capabilities of Windows Azure Service Bus to Power Agile Busines...
Discover the Capabilities of Windows Azure Service Bus to Power Agile Busines...Sergio Compean
 
Busy Developers Guide to AngularJS (Tiberiu Covaci)
Busy Developers Guide to AngularJS (Tiberiu Covaci)Busy Developers Guide to AngularJS (Tiberiu Covaci)
Busy Developers Guide to AngularJS (Tiberiu Covaci)ITCamp
 
Best Features of Azure Service Bus
Best Features of Azure Service BusBest Features of Azure Service Bus
Best Features of Azure Service BusDaniel Toomey
 
Ch. 13 filters and wrappers
Ch. 13 filters and wrappersCh. 13 filters and wrappers
Ch. 13 filters and wrappersManolis Vavalis
 
Multi-threading in the modern era: Vertx Akka and Quasar
Multi-threading in the modern era: Vertx Akka and QuasarMulti-threading in the modern era: Vertx Akka and Quasar
Multi-threading in the modern era: Vertx Akka and QuasarGal Marder
 
Asynchronous programming in ASP.NET
Asynchronous programming in ASP.NETAsynchronous programming in ASP.NET
Asynchronous programming in ASP.NETAlex Thissen
 
No Container: a Modern Java Stack with Bootique
No Container: a Modern Java Stack with BootiqueNo Container: a Modern Java Stack with Bootique
No Container: a Modern Java Stack with BootiqueAndrus Adamchik
 
Basic terminologies for a developer
Basic terminologies for a developerBasic terminologies for a developer
Basic terminologies for a developerUC San Diego
 
Advanced Apache Cayenne
Advanced Apache CayenneAdvanced Apache Cayenne
Advanced Apache CayenneWO Community
 
Introduction to Actor Model and Akka
Introduction to Actor Model and AkkaIntroduction to Actor Model and Akka
Introduction to Actor Model and AkkaYung-Lin Ho
 

What's hot (20)

Codeinator
CodeinatorCodeinator
Codeinator
 
Real World Event Sourcing and CQRS
Real World Event Sourcing and CQRSReal World Event Sourcing and CQRS
Real World Event Sourcing and CQRS
 
NiFi - First approach
NiFi - First approachNiFi - First approach
NiFi - First approach
 
Node ts1
Node ts1Node ts1
Node ts1
 
Express yourself
Express yourselfExpress yourself
Express yourself
 
Cetpa dotnet taining
Cetpa dotnet tainingCetpa dotnet taining
Cetpa dotnet taining
 
Road Trip To Component
Road Trip To ComponentRoad Trip To Component
Road Trip To Component
 
Discover the Capabilities of Windows Azure Service Bus to Power Agile Busines...
Discover the Capabilities of Windows Azure Service Bus to Power Agile Busines...Discover the Capabilities of Windows Azure Service Bus to Power Agile Busines...
Discover the Capabilities of Windows Azure Service Bus to Power Agile Busines...
 
Signal rity1
Signal rity1Signal rity1
Signal rity1
 
Busy Developers Guide to AngularJS (Tiberiu Covaci)
Busy Developers Guide to AngularJS (Tiberiu Covaci)Busy Developers Guide to AngularJS (Tiberiu Covaci)
Busy Developers Guide to AngularJS (Tiberiu Covaci)
 
Best Features of Azure Service Bus
Best Features of Azure Service BusBest Features of Azure Service Bus
Best Features of Azure Service Bus
 
Ch. 13 filters and wrappers
Ch. 13 filters and wrappersCh. 13 filters and wrappers
Ch. 13 filters and wrappers
 
Multi-threading in the modern era: Vertx Akka and Quasar
Multi-threading in the modern era: Vertx Akka and QuasarMulti-threading in the modern era: Vertx Akka and Quasar
Multi-threading in the modern era: Vertx Akka and Quasar
 
Asynchronous programming in ASP.NET
Asynchronous programming in ASP.NETAsynchronous programming in ASP.NET
Asynchronous programming in ASP.NET
 
No Container: a Modern Java Stack with Bootique
No Container: a Modern Java Stack with BootiqueNo Container: a Modern Java Stack with Bootique
No Container: a Modern Java Stack with Bootique
 
Basic terminologies for a developer
Basic terminologies for a developerBasic terminologies for a developer
Basic terminologies for a developer
 
Uniqueness of java
Uniqueness of javaUniqueness of java
Uniqueness of java
 
Windows 8 Metro apps and the outside world
Windows 8 Metro apps and the outside worldWindows 8 Metro apps and the outside world
Windows 8 Metro apps and the outside world
 
Advanced Apache Cayenne
Advanced Apache CayenneAdvanced Apache Cayenne
Advanced Apache Cayenne
 
Introduction to Actor Model and Akka
Introduction to Actor Model and AkkaIntroduction to Actor Model and Akka
Introduction to Actor Model and Akka
 

Similar to CrealyticsEvents - a step closer to an event-driven architecture

Ruby Microservices with RabbitMQ
Ruby Microservices with RabbitMQRuby Microservices with RabbitMQ
Ruby Microservices with RabbitMQZoran Majstorovic
 
Kafka for Microservices – You absolutely need Avro Schemas! | Gerardo Gutierr...
Kafka for Microservices – You absolutely need Avro Schemas! | Gerardo Gutierr...Kafka for Microservices – You absolutely need Avro Schemas! | Gerardo Gutierr...
Kafka for Microservices – You absolutely need Avro Schemas! | Gerardo Gutierr...HostedbyConfluent
 
The Meteor Framework
The Meteor FrameworkThe Meteor Framework
The Meteor FrameworkDamien Magoni
 
Introduction to Adapters 3.7
Introduction to Adapters 3.7Introduction to Adapters 3.7
Introduction to Adapters 3.7StephenKardian
 
Server-side JS with NodeJS
Server-side JS with NodeJSServer-side JS with NodeJS
Server-side JS with NodeJSLilia Sfaxi
 
JDD 2016 - Jacek Bukowski - "Flying To Clouds" - Can It Be Easy?
JDD 2016 - Jacek Bukowski - "Flying To Clouds" - Can It Be Easy?JDD 2016 - Jacek Bukowski - "Flying To Clouds" - Can It Be Easy?
JDD 2016 - Jacek Bukowski - "Flying To Clouds" - Can It Be Easy?PROIDEA
 
Flying to clouds - can it be easy? Cloud Native Applications
Flying to clouds - can it be easy? Cloud Native ApplicationsFlying to clouds - can it be easy? Cloud Native Applications
Flying to clouds - can it be easy? Cloud Native ApplicationsJacek Bukowski
 
Deep Dive on AWS Lambda - January 2017 AWS Online Tech Talks
Deep Dive on AWS Lambda - January 2017 AWS Online Tech TalksDeep Dive on AWS Lambda - January 2017 AWS Online Tech Talks
Deep Dive on AWS Lambda - January 2017 AWS Online Tech TalksAmazon Web Services
 
Apache Cayenne for WO Devs
Apache Cayenne for WO DevsApache Cayenne for WO Devs
Apache Cayenne for WO DevsWO Community
 
Pipelines for model deployment
Pipelines for model deploymentPipelines for model deployment
Pipelines for model deploymentRamon Navarro
 
Schema registry
Schema registrySchema registry
Schema registryWhiteklay
 
Raffaele Rialdi
Raffaele RialdiRaffaele Rialdi
Raffaele RialdiCodeFest
 
Event Grid - quiet event to revolutionize Azure and more
Event Grid - quiet event to revolutionize Azure and moreEvent Grid - quiet event to revolutionize Azure and more
Event Grid - quiet event to revolutionize Azure and moreSean Feldman
 
AWS Security Architecture - Overview
AWS Security Architecture - OverviewAWS Security Architecture - Overview
AWS Security Architecture - OverviewSai Kesavamatham
 
Running database infrastructure on containers
Running database infrastructure on containersRunning database infrastructure on containers
Running database infrastructure on containersMariaDB plc
 
Spark Kernel Talk - Apache Spark Meetup San Francisco (July 2015)
Spark Kernel Talk - Apache Spark Meetup San Francisco (July 2015)Spark Kernel Talk - Apache Spark Meetup San Francisco (July 2015)
Spark Kernel Talk - Apache Spark Meetup San Francisco (July 2015)Robert "Chip" Senkbeil
 

Similar to CrealyticsEvents - a step closer to an event-driven architecture (20)

Ruby Microservices with RabbitMQ
Ruby Microservices with RabbitMQRuby Microservices with RabbitMQ
Ruby Microservices with RabbitMQ
 
Kafka for Microservices – You absolutely need Avro Schemas! | Gerardo Gutierr...
Kafka for Microservices – You absolutely need Avro Schemas! | Gerardo Gutierr...Kafka for Microservices – You absolutely need Avro Schemas! | Gerardo Gutierr...
Kafka for Microservices – You absolutely need Avro Schemas! | Gerardo Gutierr...
 
The Meteor Framework
The Meteor FrameworkThe Meteor Framework
The Meteor Framework
 
Introduction to Adapters 3.7
Introduction to Adapters 3.7Introduction to Adapters 3.7
Introduction to Adapters 3.7
 
Server-side JS with NodeJS
Server-side JS with NodeJSServer-side JS with NodeJS
Server-side JS with NodeJS
 
JDD 2016 - Jacek Bukowski - "Flying To Clouds" - Can It Be Easy?
JDD 2016 - Jacek Bukowski - "Flying To Clouds" - Can It Be Easy?JDD 2016 - Jacek Bukowski - "Flying To Clouds" - Can It Be Easy?
JDD 2016 - Jacek Bukowski - "Flying To Clouds" - Can It Be Easy?
 
Flying to clouds - can it be easy? Cloud Native Applications
Flying to clouds - can it be easy? Cloud Native ApplicationsFlying to clouds - can it be easy? Cloud Native Applications
Flying to clouds - can it be easy? Cloud Native Applications
 
Deep Dive on AWS Lambda - January 2017 AWS Online Tech Talks
Deep Dive on AWS Lambda - January 2017 AWS Online Tech TalksDeep Dive on AWS Lambda - January 2017 AWS Online Tech Talks
Deep Dive on AWS Lambda - January 2017 AWS Online Tech Talks
 
Apache Cayenne for WO Devs
Apache Cayenne for WO DevsApache Cayenne for WO Devs
Apache Cayenne for WO Devs
 
Pipelines for model deployment
Pipelines for model deploymentPipelines for model deployment
Pipelines for model deployment
 
Schema registry
Schema registrySchema registry
Schema registry
 
Ember - introduction
Ember - introductionEmber - introduction
Ember - introduction
 
Raffaele Rialdi
Raffaele RialdiRaffaele Rialdi
Raffaele Rialdi
 
Docker in the Cloud
Docker in the CloudDocker in the Cloud
Docker in the Cloud
 
Sas 2015 event_driven
Sas 2015 event_drivenSas 2015 event_driven
Sas 2015 event_driven
 
Event Grid - quiet event to revolutionize Azure and more
Event Grid - quiet event to revolutionize Azure and moreEvent Grid - quiet event to revolutionize Azure and more
Event Grid - quiet event to revolutionize Azure and more
 
AWS Security Architecture - Overview
AWS Security Architecture - OverviewAWS Security Architecture - Overview
AWS Security Architecture - Overview
 
Running database infrastructure on containers
Running database infrastructure on containersRunning database infrastructure on containers
Running database infrastructure on containers
 
Spark Kernel Talk - Apache Spark Meetup San Francisco (July 2015)
Spark Kernel Talk - Apache Spark Meetup San Francisco (July 2015)Spark Kernel Talk - Apache Spark Meetup San Francisco (July 2015)
Spark Kernel Talk - Apache Spark Meetup San Francisco (July 2015)
 
eCAP Developer Walkthru
eCAP Developer WalkthrueCAP Developer Walkthru
eCAP Developer Walkthru
 

CrealyticsEvents - a step closer to an event-driven architecture