Code Monkey home page Code Monkey logo

pragmatic-microservices-lab's Introduction

Pragmatic Microservices with Java EE and MicroProfile

This hands-on lab demonstrates developing reasonable microservices appropriate for most ordinary blue collar IT organizations in a step-by-step fashion. We initially focus on nothing but vanilla Java EE and simple, fast deploying thin war files. We then also cover concepts such as fat-jars, configuration, circuit-breakers, metrics and health checks using MicroProfile and Payara Micro. Lastly we will also discuss container solutions like Docker and cloud platforms such as AWS.

Part of this code is used as a demo for this talk. A video for the talk can be found here. The code is derived from the Cargo Tracker project.

This lab uses Payara 5. It should be possible to use any Java EE 8 compatible application server such as GlassFish, WildFly or WebSphere Liberty. We use Payara Micro as our fat-jar solution. It should be possible to use any other MicroProfile compatible runtime such as Thorntail. We use NetBeans but you can use any Maven capable IDE.

Setup

  • Download this project somewhere into your file system, probably as a zip file (and extract it).
  • Make sure you have the latest version of JDK 8 installed. Older and newer versions may cause unexpected issues.
  • Please download and install NetBeans 8.2 from here. Make sure to download the Java EE edition. Older and newer versions may cause unexpected issues.
  • Download Payara Server 5 from here.
  • Please unzip the zip file anywhere in your file system.
  • You now need to setup Payara in NetBeans. You do that by going to Services -> Servers -> Add Server -> GlassFish Server. Enter the location of the Payara directory. Choose the defaults in the next few screens to register Payara with NetBeans.

Instructions

  • There are three distinct sections of the lab separated into separate directories of the zip - monolith, javaee-microservices and microprofile-microservices. We will explore each in turn.
  • After discussing the basic concepts behind microservices, we will explore the code under monolith. The directory contains a single vanilla Java EE application named Cargo Tracker. In microservices parlance, the application can be considered a monolith. Please follow the instructions in the directory to get the application running.
  • Having explored the Cargo Tracker Java EE application, we will discuss how the routing service can be separated into a separate REST service. We will call this separate service the path-finder application. In microservices parlance, Path Finder can be considered a microservice. We will develop path-finder as a separate Maven war project using JAX-RS, JSON-B, EJB, CDI and Bean Validation. The Cargo Tracker application will use the JAX-RS client API to access the Path Finder application along with JSON-B. Cargo Tracker and Path Finder can be deployed to the same Payara instance or different Payara instances.
  • The javaee-microservices directory has a possible solution for breaking up the Cargo Tracker application into simple, practical vanilla Java EE based microservices. You should follow the instructions in the directory to get the solution running and explore it. We will discuss this solution in detail.
  • Having discussed how we can develop simple microservices using vanilla Java EE war files, we are ready to introduce Payara Micro as a fat jar solution. Introducing Payara Micro also enables us to add other MicroProfile features besides fat jars such as configuration, health-check, circuit-breakers/bulkheads and metrics. After discussing these concepts, we will convert path-finder from a war file to a self-contained fat-jar.
  • The microprofile-microservices directory has a possible solution for converting path-finder into a Payara Micro based fat jar. You should follow the instructions in the directory to get the solution running and explore it. We will discuss this solution in detail.
  • The complex-concepts directory contains some examples of more advanced concepts such as configuration, health-check, metrics, containers and cloud deployment. We will discuss these concepts as time permits.

To Do

  • Use Jelastic for cloud demo.

pragmatic-microservices-lab's People

Contributors

ivargrimstad avatar m-reza-rahman avatar ondromih avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.