In Part 1 of our Bootique Microservices Application Intro we covered the project layout and what the application does. In this post we'll look at the role each of the modules play in the overall application design. The Application is called Listreme and it displays only the most popular tweets of a Twitter User List, i.e., Twitter Lists Extreme. It is online at listreme.com.
Project Layout Refresher
Before we talk about the individual modules, here's the project layout we covered in Part 1. Modules include Batch – Bootique Jobs to retrieve tweets, Jangles – shared DTOs and utilities, TwitterService – REST data to clients, and Web – displays content from TwitterService Microservice.
Retrieving Twitter Content with the Batch Module
The Batch Module is built with Bootique Jobs. It executes several jobs based on their configuration in a Bootique yaml file. Here we're firing up our Bootique Batch Module with the jobs we want to run.
And here is the job configuration in our Bootique yaml file.
Jangles, That Tricky Common Library Module
Jangles is a "Lean Application Starter" module you'll find on GitHub here. It supports logging, external properties, localization, caching and other basic functions. When serving as a shared library in a distributed application, the keyword is LEAN, which makes it interesting what goes into a shared module. We don't want redundant code across modules, but we don't want a big fat JAR dependency either. Here's the layout of the shared module, which you can see contains mostly shared DTOs, Shiro and Twitter4J configuration classes, a few utility classes and common User Authentication services.
Twitter Service Module, Heart of the Application
Each of the Modules in the Listreme Application is essential, but the Twitter Service module is the heart of the application, much like the hub of a spoke wheel with data going out to various clients with REST. The Twitter Service Module uses the Bootique Jersey Module which gives us REST features with Jackson. When we fire up the Service and go to the address this is our response.
We can click on the /userlists link to see a list of the active User Lists with addition links to the list's tweets and members.
A Web Client
The Web Module is simply a client of the Twitter Microservice, potentially one of many. The Web Module uses Bootique MVC with Mustache, Bootique Jersey, Bootique Jetty and Bootique Shiro for user authentication along with Twitter4J.
In future posts we'll continue to drill down and look at various interesting functions and the interplay among the various components.