In this post we're introducing a Microservices Application built in Java with Bootique. Its name is Listreme and it gets its name by retrieving Twitter User List Tweets and filtering out all but the most popular. Thus, Twitter User Lists Extreme. You'll find it at listreme.com.
In Part 1 we'll look at the application layout and run through the functionality. In Part 2 we'll look at the role each Module plays in the overall application.
Here's the Project Structure.
- Batch uses Bootique Jobs to retrieve tweets for processing and entry into MySQL. It retrieves tweet updates, user profile updates and other functions using Twitter4J.
- Jangles is a common library for shared DTOs and utility functions. It does not use Bootique in its design but it does use Google Guice for Injection.
- TwitterService provides all of the data to various clients in JSON REST and HTML format.
- Web is the sole client at present, using Bootique Jetty, Bootique MVC with Mustache, and Bootique Shiro along with Twitter4J for user authentication. The data displayed on the Web Site is all from the TwitterService module retrieved in JSON and HTML.
The Twitter Elements
As I said, Listreme retrieves User List Tweets and filters them based on criteria for that List defined in Listreme. To that end I created a Listreme Twitter Account and the User Lists I wanted to initially include in the application. (The lists were created programatically with Twitter4J based on existing private lists.) It's important to note that the Listreme Application can use any public Twitter User List, not just those of the Listreme User.
Here's a link to the U.S. News and Politics User List on Twitter, your typical User List. Below is what it looks like on Listreme with only posts having 250 or more Likes and Retweets. Each tweet links to its counterpart on Twitter for all comments and media.
Updating the User List
Listreme User Lists are updated every 10 minutes by a Bootique NewTweets Job. New Tweets meeting the filter criteria (and not duplicate retweets or quotes) are added and a prompt is displayed on the sidebar.
The statistics of existing Tweets are updated every 30 minutes with a second Bootique Job called TweetUpdates.
The Web Module uses Bootique Shiro and Twitter4J to authenticate users. Logged-in users can Retweet and Like tweets without leaving the application. Anonymous users are shown a message to log in.
The future plans of the application depend on its popularity, but with its Microservices design we can, say, add an Echo Skill which retrieves from the TwitterService REST application. We could use Bootique RabbitMQ to hand off tweets to Solr for searching functionality if we wanted as another example of building off the Microservices architecture. In other words, stay tuned!