19
A production project’s architecture with Clojure :) February 2016 @jordillonch

A production project's architecture with clojure

Embed Size (px)

Citation preview

A production project’s architecture

with Clojure :)

February 2016 @jordillonch

introduction

• inspired by horus

• why?

some concepts and libraries

domain• contexts

• modules

• application services

• value objects/aggregates

• interfaces for repositories and external services

• buses

• command bus

• oracle

• domain event publisher

infrastructure• http rest api server

• rabbitmq workers

• key/value database

• relational database

• non blocking promises

libraries• com.stuartsierra/component: managing the lifecycle and dependencies of software components which have runtime state

• co.paralleluniverse/pulsar: provides high-performance lightweight threads, Go-like channels, Erlang-like actors, and other asynchronous programming tools

• prismatic/schema: declarative data description and validation

• funcool/catacumba: web toolkit

• com.taoensso/timbre: logging and profiling

• hikari-cp: high-performance JDBC connection pool

• slingshot: enhanced throw and catch for Clojure

• com.gearswithingears/shrubbery: mocking

• com.novemberain/langohr: RabbitMQ client

• com.taoensso/carmine: Redis client

how it looks?

contexts

leaderboard

board

yearmonth

friends

shared infrastructure

storage

storage score

schema

finder updater

reseter repository

schema

lister updater

repository

finder updater

deleter repository

logic blocks

shared infrastructure

buses

logger jdbc connection pool

command bus

domain event publisher

oracle

oauth2 access token repository http server api

http server api oauth2

domain event backup

infrastructure

some examples

leaderboard score updater

controller

command bus

command handler

updater

repository

controller

oracle

oracle handler

finder

repository

leaderboard score finder

show me the code!

some interesting points

• Stuart Sierra component

• lifecycle and dependencies management of runtime state

• rapid workflow

• component next

• adaptation of Stuart Sierra components map definition

• simplifiers

• bus handlers

• api rest routing

components

• value objects/aggregates definition

• validation

• coercion

schema

command bus

• use of promises

• 2 modes of use:

• fire and forget

• wait response

• behaviour

• mocking

• stubs generation

• acceptance

• system setup

• system reset

test

enhanced throw and catch

• slingshot