/nixmash-bootique-microservices-demo

Microservices application with Bootique, Jersey, Jackson, Shiro and Mustache

Primary LanguageJava

NixMash Microservices

  • NixMash Jangles - small backend for cloud configuration and shared components (GitHub)
  • Bootique - a lightweight Java Framework http://bootique.io/
  • Jetty - embedded web server
  • Jersey - REST services for JAX-RS
  • Jackson - JSON/POJO binding
  • Apache Shiro - user authentication and authorization, including using a BearerAuthenticationToken in REST (v0.2.0)
  • Google Guice - injection
  • Mustache - the Spullara Java Mustache Implementation for "logic free" templating (GitHub)
  • Bootstrap - responsive web theming

Contents

NixMash Posts by Branch

microservices-v0.2.0

microservices-v0.1.0

Installation

The Jangles Module sets the application configuration in External Property and Config files.

  1. Create a MySQL database.
  2. MySQL Setup scripts are located in jangles:/install/sql. Run schema.sql and data.sql.
  3. Copy external files in /install/external to a subdirectory of your /home/user directory. Enter the path to those files in jangles:/resources/jangles.properties and update the MySQL Connection settings in connections.xml.

Running the Application

NixMash Microservices currently consists of a User Microservice and a Web Client. Use Maven or your IDE to run the Userservice module followed by theWeb REST Client.

If running the application with Maven, the following will produce JARs for userservice and webclient

{PROJECT_ROOT}/$ mvn clean install

Then run the resulting JARs in two terminal windows.

{PROJECT_ROOT}/$ java -jar userservice/target/userservice.jar
{PROJECT_ROOT}/$ java -jar web/target/webclient.jar

User Service

Userservice displays a list of users from the MySQL database in JSON. The URL for the User Service is http://localhost:8000. The initial JSON output from the REST User Service looks like this.

{
    "applicationId": "userservice",
    "serviceName": "User Microservice",
    "users": {
    "params": {
    "rel": "users"
    },
    "href": "http://localhost:8000/users"
    }
}

The JSON output at http://localhost:8000/users would look like this.

[
    {
        "userId": 1,
        "applicationId": "Jim",
        "serviceName": "Jim Johnson",
        "lastUpdated": "06-12-2017 09:00:21",
        "isActive": true,
        "link": "http://localhost:8000/users/1"
    },
    {
        "userId": 2,
        "applicationId": "Bill",
        "serviceName": "Bill Blaster",
        "lastUpdated": "06-12-2017 09:00:21",
        "isActive": true,
        "link": "http://localhost:8000/users/2"
    }
]

Web Client

The Web client module URL is http://localhost:9001. This is the page with url http://localhost:9001/users displaying users from Users Service.

Last Updated: 4/23/18