This is a sample Akka/Java application that has a Customer service that allows you, via REST, to:
- Add a customer
- Get a customer
- List customers (via read-side view)
- Disable a customer (acting as a soft delete)
This implementation uses Cassandra for both the write-side and read-side.
- Akka HTTP (with HttpApp bootstrap)
- Bulkheading of blocking HTTP call with custom dispatcher
- Akka Persistence (with Cassandra)
- Akka Persistence Query (for CQRS using eventsByTag and a stored offset)
- Akka Cluster
- Akka Cluster Sharding for CustomerPersistentActor
- Kryo Serializer
- Lombok (for @Value immutable object)
- Guava for ImmutableList (you can use PCollections too)
- SBT Revolver for hot reloading of application after code changes (see SBT commands)
- Docker image build and publish (see SBT commands)
- Kubernetes deployment script (see other .md files)
~reStart
,reStop
Triggered Restarts via SBT Revolver (Restart app after Java source changes)docker:publishLocal
JAR and Docker images via SBT Native Packager
You must be running Cassandra separately when executing on local machine; default port is 9042.
- curl -H "Content-Type: application/json" -X POST -d '{"name": "Eric Murphy", "city": "San Francisco", "state": "CA", "zipCode": "94105"}' http://localhost:9000/customer
- curl http://localhost:9000/customer/51c25a39-39b8-4937-b56b-5cca7f79acc1
- curl http://localhost:9000/customer
- curl -X PUT http://localhost:9000/customer/disable/51c25a39-39b8-4937-b56b-5cca7f79acc1
- curl http://localhost:9000/customer/51c25a39-39b8-4937-b56b-5cca7f79acc1 (run again to check disabled)