Creating Microservices with Bootique

When it comes to writing microservices in Java, plenty of tools and frameworks exist. In the following tutorial, I’d like to demonstrate another minimalistic framework called Bootique by implementing a simple microservice exposing its functions either as a RESTful web-service or as a runnable command executed using the command line. Bootique Command Line Dependencies Using Maven here, we’re adding the following elements to our project’s pom.xml: Bootiques Bill of Materials as dependency management: bootique-bom Bootique Jersey for our REST service: bootique-jersey Bootique Logback for logging: bootique-logback Maven Shade Plugin to assemble our fat-jar ...

September 18, 2016 · 6 min · 1070 words · Micha Kops

Allocating available random Ports in a Maven Build

Recently in a project I encountered the following problem: The development team used Git with a branch-per-feature-like workflow and the integration server, Bamboo in this case, was configured not only to run the integration-tests for the master-branch but also for every change in a feature branch. As the team developed a Java EE web application ports like 8080 occasionally were already bound and builds failed. I knew a plug-in for Jenkins CI I to search for available ports and assign them to a build variable but I wanted to control such information directly within the Maven build life-cycle so I searched and finally found Sonatype’s Port Allocator Plug-in for Maven. ...

May 7, 2014 · 6 min · 1074 words · Micha Kops

Embedding Jetty or Tomcat in your Java Application

Recently I needed to control an embedded web container from a Java application and I wanted to see how this could be achieved using an embedded instance of either Tomcat or Jetty here. In the following short examples I would like to show how to embed both servers in an application in no time using Gradle or Maven as build tool. Dependencies We just need to add the web container libraries to our project here .. I’ve added the build config for Gradle and Maven here… ...

July 9, 2013 · 4 min · 782 words · Micha Kops

HTML5 Server Send Events using Node.js or Jetty

The HTML5 working draft describes different techniques to push information from a server to the client and the one described in this tutorial are Server-Send Events (SSE). Using Server-Send-Events eliminates the need to poll a server periodically for information using AJAX and is really easy to implement because of the simple specification and the fact that nearly all modern browsers already implement this specification. The Client Side Registering for Server Send Events (SSE) is quite easy .. simply create a new EventSource object that is bound to the URL where the events are propagated. ...

October 21, 2012 · 4 min · 720 words · Micha Kops

Contract-First Web-Services using JAX-WS, JAX-B, Maven and Eclipse

Using the contract-first approach to define a web service offers some advantages in contrast to the code-first approach. In the following tutorial we’re going to take a look at some details of this approach and we’re going to implement a real SOAP service using JAX-WS, Maven and the Eclipse IDE. Finally we’re going to run our service implementation on an embedded Jetty instance and we’re going to take a look at soapUI and how to test our service using this neat tool. ...

August 23, 2011 · 9 min · 1777 words · Micha Kops

How to create a simple OSGi Web Application using Maven

In this tutorial we will take a look at the development of a simple OSGi Web Application and what tools can save us some time. The Maven Bundle Plugin makes our life much easier here as does the OSGi Bundle Repository that offers some nice bundles – in our case the servlet API and an embedded Jetty web server. So lets develop some bundles .. Prerequisites You are going to need a JDK (>=5), Maven2, the Apache Felix OSGi implementation and and text editor/http://eclipse.org/[IDE] of your choice. ...

July 25, 2010 · 8 min · 1505 words · Micha Kops