Eventing Data with RabbitMQ and Riak

29
Eventing Data with RabbitMQ and Riak Jon Brisbin [email protected] - @j_brisbin

description

The slides from my presentation at Erlang Factory 2011.

Transcript of Eventing Data with RabbitMQ and Riak

Page 1: Eventing Data with RabbitMQ and Riak

Eventing Data with RabbitMQ and Riak

Jon [email protected] - @j_brisbin

Page 2: Eventing Data with RabbitMQ and Riak
Page 3: Eventing Data with RabbitMQ and Riak

Evented Data is a reflection of

different aspects of a single

application.

Page 4: Eventing Data with RabbitMQ and Riak

What is Data, then?

Page 5: Eventing Data with RabbitMQ and Riak

Data

cono flno flda8

1 3877 20110609

1 468 20110822

Page 6: Eventing Data with RabbitMQ and Riak
Page 7: Eventing Data with RabbitMQ and Riak

Data[{ “company_number”: 1, “flight_number”: 3877, “flight_date”: 20110609},{ “company_number”: 1, “flight_number”: 468, “flight_date”: 20110822}]

Page 8: Eventing Data with RabbitMQ and Riak
Page 9: Eventing Data with RabbitMQ and Riak

Data

PUT /services/flightinfoContent-Type: text/plain

1,3877,201106091,468,20110822

Page 10: Eventing Data with RabbitMQ and Riak

Data

Exchange: flightRouting-Key: infoX-Meta-Company: 1Content-Type: application/json

[ [3877,20110609], [468,20110822]]

Page 11: Eventing Data with RabbitMQ and Riak

The only important pieces of data

are... [ [3877,20110609], [468,20110822]]

Page 12: Eventing Data with RabbitMQ and Riak
Page 13: Eventing Data with RabbitMQ and Riak

Where the data is stored doesn’t really matter...

Page 14: Eventing Data with RabbitMQ and Riak

...nor does the language used to

extract it...

Page 15: Eventing Data with RabbitMQ and Riak

...nor does the language of the

server in which it is stored.

Page 16: Eventing Data with RabbitMQ and Riak

The only thing that matters is THE

DATA.

Page 17: Eventing Data with RabbitMQ and Riak

It is the Alpha and the Omega of the

project.

Page 18: Eventing Data with RabbitMQ and Riak
Page 19: Eventing Data with RabbitMQ and Riak
Page 20: Eventing Data with RabbitMQ and Riak

The RabbitMQ SideCustom exchange type “x-riak”

Page 21: Eventing Data with RabbitMQ and Riak

The RabbitMQ SideCustom exchange type “x-riak”

Arguments:

host = “localhost”port = 8087type-module = “..._topic”maxclients = 5

Page 22: Eventing Data with RabbitMQ and Riak

The RabbitMQ SideCustom exchange type “x-riak”

Possible type-modules:

rabbit_exchange_type_topicrabbit_exchange_type_directrabbit_exchange_type_fanoutrabbit_exchange_type_headersmymodule_custom_type_foo

Page 23: Eventing Data with RabbitMQ and Riak

presentation.startDemo();

Page 25: Eventing Data with RabbitMQ and Riak

The Riak SidePUT /riak/bucketContent-Type: application/json

{ props: { postcommit: [ { mod: “riak_rabbitmq”, fun: “postcommit_send_amqp” } ] }}

Page 26: Eventing Data with RabbitMQ and Riak

The Riak SideMetadata:

X-Riak-Meta-Amqp-ExchangeX-Riak-Meta-Amqp-Routing-KeyX-Riak-Meta-Amqp-HostX-Riak-Meta-Amqp-PortX-Riak-Meta-Amqp-VhostX-Riak-Meta-Amqp-UserX-Riak-Meta-Amqp-PasswordX-Riak-Meta-Amqp-Ignore

Page 27: Eventing Data with RabbitMQ and Riak

Store metadata on a special entry named “AMQP-Meta” in that

bucket

Page 28: Eventing Data with RabbitMQ and Riak

presentation.startDemo();

Page 29: Eventing Data with RabbitMQ and Riak

http://github.com/jbrisbin

@j_brisbin

[email protected]