Amped is a Java-based, cloud-native, reference architecture using many Open Source projects including the following:
- Dropwizard for microservin'
- Jetty for HTTP servin'.
- Jersey for REST modelin'.
- Jackson for JSON parsin' and generatin'.
- Logback for loggin'.
- Hibernate Validator for validatin'.
- Metrics for figurin' out what your application is doin' in production.
- JDBI and Hibernate for databasin'.
- Liquibase for migratin'.
- SPDY for speedy web pagin'
- Swagger for API documentin'
- Hazelcast for cachin and all things distributed
- Cache frequently accessed data in-memory, often in front of a database
- Store temporal data like web sessions
- In-memory data processing/analytics
- Service registry and discovery
- Distributed configuration
- Cross-JVM communication/shared storage
- Camel for EIP'n
- Good for decomposition / Component based (routes/components)
- Service Orchestration
- Cross-JVM communications
- Hystrix for fault tolerance
- Command Pattern
- Circuit Breaker
- Fallback & Degrade Abilities
- MongoDB for persistin
- Document Database
* Cynical Software * Architected for Change * Problem based Solution * Deterministic & Metric Driven * High Performance * High Availability * Easy Scalability * Easy Maintainability
- Uses Netflix Hystrix
- Stop cascading failures.
- Fail-fast and rapidly recover.
- Reduce mean-time-to-discovery (with dashboards) *Reduce mean-time-to-recovery (with dynamic configuration)
- Scale up only some parts of the application
- Isolate services based depending on their security profiles (PII)
- Fault tolerance
- Cloud friendly
- The Unix Philosophy (Camel friendly)
- Write programs that do one thing and do it well.
- Write programs to work together.
- Write programs that handle text streams, because that is a universal interface.
- With pipes, many programs could work together, and they could work together at a distance.
The following project layout is typical of many distributed applications such as Dropwizard:
- Many of these are optional based on Service implementation needs
- Customer-facing REST-based edge service
- Uses DropWizard
- Uses Hazelcast
- Optionally uses Camel
- Internal REST-based middletier service called by the edge service
- Optionally uses DropWizard
- Optionally uses Spring Boot
- Uses Hazelcast
- Uses Camel
- Shared classes between edge and middletier
- guava-libraries
To summarize, don’t reinvent the wheel. If you need to do something that seems like it should be reasonably common, there may already be a class in the libraries that does what you want. If there is, use it; if you don’t know, check. Generally speaking, library code is likely to be better than code that you’d write yourself and is likely to improve over time. This is no reflection on your abilities as a programmer. Economies of scale dictate that library code receives far more attention than most developers could afford to devote to the same functionality.
Please see [wiki] (https://github.com/7erry/amped/wiki) for detailed documentation.
https://github.com/dropwizard/dropwizard
http://www.slideshare.net/tomaslin/dropwizard-and-groovy
https://github.com/dropwizard/metrics
https://github.com/wordnik/swagger-core/wiki/JavaDropwizard-Quickstart
-
mvn 3.x
mvn -version
Apache Maven 3.2.2 (45f7c06d68e745d05611f7fd14efb6594181933e; 2014-06-17T09:51:42-04:00) Maven home: /Users/twalters/Documents/tools/apache-maven-3.2.2 Java version: 1.8.0_11, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home/jre Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "10.9.3", arch: "x86_64", family: "mac"
-
java 8
java -version
java version "1.8.0_11" Java(TM) SE Runtime Environment (build 1.8.0_11-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)
-
JAVA_HOME set
echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home
Tested on: ========== OS X: 10.9.3
Ubuntu: 14.04.1
-
To package the amped-helloworld application run.
mvn package
-
To setup the h2 database run.
java -jar target/amped-helloworld-0.8.0-SNAPSHOT.jar db migrate amped.yml
-
To run the server run.
java -jar target/amped-helloworld-0.8.0-SNAPSHOT.jar server example.yml
-
To hit the Hello World example (hit refresh a few times).
-
To post data into the application.
curl -H "Content-Type: application/json" -X POST -d '{"fullName":"Other Person","jobTitle":"Other Title"}' http://localhost:8080/people
-
To view the API catalog. http://localhost:8080/ui/index.html