Permalink
Browse files

Overview and usage instructions

  • Loading branch information...
krasserm committed Aug 11, 2012
1 parent c35d91e commit f2de91894031d0c77c0e7c6bef7987a43e607cbf
Showing with 22 additions and 2 deletions.
  1. +20 −2 README.md
  2. +2 −0 src/main/scala/org/eligosource/eventsourced/example/service/PaymentService.scala
View
@@ -1,14 +1,32 @@
Info
----
This project re-implements [eventsourcing-example](https://github.com/krasserm/eventsourcing-example) based on the Eligosource [Eventsourced](https://github.com/eligosource/eventsourced) library.
This project re-implements [eventsourcing-example](https://github.com/krasserm/eventsourcing-example) based on the Eligosource [Eventsourced](https://github.com/eligosource/eventsourced) library. Regarding library usage, it demonstrates how to
- implement command-sourcing (for managing state of invoices)
- implement event-sourcing (for managing state of payment processes and for recording usage statistics)
- implement domain services (to handle requests via UI and XML/JSON API)
- implement business processes (to deal with long-running background activities)
- recover from crashes (incl. recovery of business processes)
Compared to the [old implementation](https://github.com/krasserm/eventsourcing-example), domain events are now decoupled from the immutable domain model. Web UI and XML/JSON API are built on top of [Jersey](http://jersey.java.net/), [Scalate](http://scalate.fusesource.org/) and [JAXB](http://jcp.org/en/jsr/detail?id=222). A [Play](http://www.playframework.org/)-based version will follow (which supports asynchronous responses in contrast to Jersey).
Run
---
First checkout and build the [Eventsourced](https://github.com/eligosource/eventsourced) library
git clone git://github.com/eligosource/eventsourced.git
cd eventsourced
sbt publish-local
Then checkout the example application run it
git clone git://github.com/eligosource/eventsourced-example.git
cd eventsourced-example
sbt 'run-nobootcp org.eligosource.eventsourced.example.server.Webserver'
Then go to [http://localhost:8080](http://localhost:8080) and create some invoices.
Finally go to [http://localhost:8080](http://localhost:8080) and create some invoices.
Web API
-------
@@ -20,6 +20,8 @@ class PaymentService(invoiceComponent: Component) extends Actor {
// because payments may take several days to arrive ...
Future { invoiceComponent.inputChannel ! Message(InvoicePaymentReceived(invoiceId, amount)) }
// here we assume that an external payment service will
// retry notifying us should this app be not available
}
}
}

0 comments on commit f2de918

Please sign in to comment.