Java Magazine, Jan/Feb 2016
ORACLE COM JAVAMAGAZINE JANUARY FEBRUARY 2016 87 microservices Updating the JSF Front End Finally lets update our index xhtml file in the ui module to use the created bean and to list the available bookings xml version 10 encoding UTF 8 DOCTYPE html html xmlns http www w3 org 1999 xhtml xmlns f http xmlns jcp org jsf core xmlns h http xmlns jcp org jsf html h head title All available bookings title h head h body h dataTable value bookingsBean allBookings var booking h column f facet name header Booking id f facet booking id h column h column f facet name header Date of order f facet booking orderDate h column h dataTable h body html And were done We have created three microservices that will run independently of each other They communicate through REST interfaces and share common resources such as JPA entities Of course we could use HTML5 with AngularJS or ReactJS for the front end as well Deploying and Running Using Docker We can now build and run our microservices To demonstrate this we will use Docker First we need to create a Dockerfile which will contain the steps to create a Docker image that will build each microservice and run it Because KumuluzEE runs a microservice as a normal single process standalone JAR file with a minimal footprint and does not require a separate app server instance for each microservice it fits perfectly with how Docker operates The Dockerfile is shown next Its routes Dockerfile file is in the downloaded files FROM java openjdk 8u45 jdk MAINTAINER info@ kumuluz com RUN apt get update qq apt get install y wget git RUN wget maven binaries install maven RUN mkdir app WORKDIR app ADD app RUN mvn clean package Pdeploy ENV JAVA_ ENV PRODUCTION EXPOSE 8080 CMD java server cp ui target classes ui target dependency com kumuluz ee EeApplication As we can see the Dockerfile is pretty simple and straightforward It installs the required dependencies builds the microservice and supplies the command to run it In our case we can use the same Dockerfile for every microservice except for the final command which specifies which microservice is going to run in a particular Docker container Next we need to build a Docker image for every microservice that we have
You must have JavaScript enabled to view digital editions.