Giter Site home page Giter Site logo

event-stream-api's Introduction

event-stream-api

Demo for Melbourne Scala User Group.

Quick Start

    ./sbt run

and to bootstrap with some data:

    cd /src/test/resources
    ./play.sh

Actions

This is a system that store deltas or events that can be replayed to represent the state of an entity. It has a REST like interface to save, retrieve and snapshot events.

Events can be streamed for downstream clients wishing to consumer events.

Here are the current actions:

  • POST /event with an event body
  • GET /events --> a paginated stream of events (optional params ?pageSize=10&pageNumber=1&systemName=<systemName>)
  • GET /events/<enitiyId> --> a paginated stream of events for the given entity Id (optional params ?pageSize=10&pageNumber=1&systemName=<systemName>)
  • GET /entity<entityId>/<systemName> --> replays the events building up the entity (optionally pass through the point in time ?at=2015-05-25T12:00:00Z)
  • POST /snapshot/<entityId>/<systemName>/<time> --> Creates a snapshot for the entity at the supplied time.

Database setup

You can use the in memory mutable map by default or you can configure a postgresql database by uncommenting the following line in Main.scala:

  //private val db = new SlickDatabase("events", "events",
  //  "jdbc:postgresql://localhost/events", "org.postgresql.Driver")

  //private val eventStoreInterpreter = new SqlInterpreter(db)
  //Try(sqlInterpreter.createDDL())

and comment out:

    private val eventStoreInterpreter = new MutableMapEventStoreInterpreter()

You will need a running postgresql server with a database called events and a user called events with password events.

event-stream-api's People

Contributors

cwmyers avatar

Watchers

James Cloos avatar joseph knight avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.