Skip to content

AndyGee/microprofile-conference

 
 

Repository files navigation

Microprofile Showcase Application

General information

The application consists of several Microservices and a Web-Application managing a conference :

  • microservice-schedule : Schedule of the conference

  • microservice-session : Sessions of the conference

  • microservice-speaker : Speakers of the conference

  • microservice-vote : Votes for each session

  • web-application : Frontend Angular2 | Bootstrap4

The WebApp is a direct subscriber to the individual Microservices. This means that there is no aggregator / middle-man application. The WebApp itself provides a known relative EndPoint microservice that enables the lookup of URLs to the other services.

If you would like to participate in the community effort to advance EE then by all means feel free to join us on the following sites:

Microprofile.io - The community landing site.

Google+ Microprofile groups - Public discussion lists (We do not have private lists).

Kanban board - A nice Kanban integration for our GitHub issues.

All source code - Apache Licence V2 project OSS code.

Technologies

  • Java

  • Micro Profile

  • JAX-RS 2.0 / JSON-P 1.0 / CDI 1.1

Quickstart - Run all services and UI in separate runtimes

This will run each service in the runtime container that its setup for and the UI in a Node.js server to interact with them.

Build, package and run all microservices and the UI:

mvn clean package -P start,ui

Run just the microservices:

mvn package -Pstart -pl :microservice-start

Run just the UI:

mvn package -Pui -pl :microservice-start

Running on Liberty

To run all the services on individual WebSphere Liberty servers add the 'liberty' profile to the command:

mvn clean package -P start,ui,liberty
mvn package -P start,liberty -pl :microservice-start

Development Build

mvn clean install -DskipTests
  • Build the projects using Maven (mvn clean install) or (mvn -fn clean install) to skip over failed tests.

  • To get the technical documentation, just mvn clean generate-resources under the docs directory. You will find a PDF and HTML version of the documentation under docs/target/generated-docs

Development Tests

mvn clean test

Run Individual Services

Each service can run on any container (this is the Microprofile guarantee), but the service projects have been written by vendors to use their container.

The following sections describe vendor specifics:

microservice-schedule

The Schedule service is provided using a special microprofile release of Payara Micro which can be downloaded from Maven Central

Build and run the service When building the service Payara Microprofile packages both the war file and the microprofile runtime into a single UberJar for convenience.

cd microservice-schedule
mvn clean package
java -jar target\microservice-schedule.jar --port 6060

Port Bindings By default the microservice would bind to port 8080, if this is not available it will bind to the next available port e.g. 8081. Specifying the port using --port as a command line option overrides this.

To verify that the schedule microservice is running, use the following link: http://localhost:6060/schedule/all

To see a full set options run the jar with the --help command line option or see the Payara Micro Documentation for a full list of options.

Running on Liberty

Alternatively you can run this service on liberty by doing:

cd microservice-schedule
mvn -Pliberty package
java -jar target/microservice-schedule-liberty.jar

microservice-session

Provided using WildFly Swarm

Build and run the service

cd microservice-session
mvn clean package
java -jar target/microservice-session-swarm.jar [-D<OPTION>]

Address & Port Bindings

Table 1. Session Service Options
Flag Description Default

swarm.bind.address=<address>

Interface to bind servers

0.0.0.0

swarm.http.port=<port>

Sets the port for the HTTP server

8080

swarm.port.offset=<offset>

Sets a global port adjustment

0

For example, if you want to change the HTTP port to 5050, run the application like this:

java -jar target/microservice-session-swarm.jar -Dswarm.http.port=5050

Click on this link to verify that everything ran fine: http://localhost:5050/sessions

For a full set of configuration options please see the Wildfly Swarm Userguide

Running on Liberty

Alternatively you can run this service on liberty by doing:

cd microservice-session
mvn -Pliberty package
java -jar target/microservice-session-liberty.jar

microservice-speaker

Provided using Apache TomEE 7.x

Build and run the service

cd microservice-speaker

mvn clean package

java -jar target/microservice-speaker-exec.jar

If you look at the output, you will find messages like the following:

INFO - REST Application: http://localhost:4040/speaker               -> io.microprofile.showcase.speaker.rest.Application@68cda174
INFO - Service URI: http://localhost:4040/speaker/              -> Pojo io.microprofile.showcase.speaker.rest.ResourceSpeaker
INFO - DELETE http://localhost:4040/speaker/remove/{id}   ->      void remove(String)

There you can see the URLs of the endpoints exposed by TomEE for your application.

To verify that everything worked fine, you can try to access http://localhost:4040/speaker

Running on Liberty

Alternatively you can run this service on liberty by doing:

cd microservice-speaker
mvn -Pliberty package
java -jar target/microservice-speaker-liberty.jar

microservice-vote

Provided using WebSphere Liberty

Build and run the service

cd microservice-vote
mvn package
java -jar target/microservice-vote.jar

Access the app at http://localhost:7070/vote

Port Bindings By default the microservice will start on port 7070. To set it to a different port use the following Maven properties:

-DtestServerHttpPort=9080 -DtestServerHttpsPort=9443

Note: if you run the package command with the 'liberty' profile the jar file will be called microservice-vote-liberty.jar.

Web Application (UI)

This starts the UI app and all services running in an embedded container. The landing page is http://localhost:8080

Console 1
mvn clean package tomee:run -pl :web-application -DskipTests

This starts a gulp task that monitors and updates changes to the static resources.

Console 2
$ cd web-application
$ mvn frontend:gulp

Open a browser at http://localhost:8080/

Common problems/bugs

NPM issues

The web-application project uses the com.github.eirslett:frontend-maven-plugin to download and install all node and npm requirements. Sometimes this may fail if console permissions are not permissive enough.

In such cases you will have to manually install some reqiurements:

  1. Download and install node: https://nodejs.org/en/download/current/

  2. Install npm manually:

cd web-application/src/main/static
npm install npm
npm install typings --global
typings install --global

Notes

This application is a collaborative demonstration application by:

  • WebSphere Liberty

  • London Java Community

  • SouJava

  • Red Hat

  • Tomitribe

  • Payara

Releases

No releases published

Packages

No packages published

Languages

  • Java 76.4%
  • TypeScript 11.6%
  • HTML 7.4%
  • JavaScript 4.5%
  • Ruby 0.1%