DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
The Latest "Software Integration: The Intersection of APIs, Microservices, and Cloud-Based Systems" Trend Report
Get the report
  1. DZone
  2. Data Engineering
  3. Data
  4. Implementing Microservices Using KumuluzEE

Implementing Microservices Using KumuluzEE

Here's a great guide to getting started with microservices on Kumuluz EE.

Lieven Doclo user avatar by
Lieven Doclo
·
Nov. 17, 15 · Tutorial
Like (5)
Save
Tweet
Share
5.18K Views

Join the DZone community and get the full member experience.

Join For Free

A lot of people in the Java ecosphere know about writing embedded microservices (without a separate container) using either Spring Boot or Dropwizard. Both have their merits but neither is completely Java EE oriented. Both reuse some Java EE component, for example Dropwizard uses JAX-RS for REST APIs and both support JPA for persistence. But if you want to use pure Java EE this becomes quite hard (although Spring Boot can be used completely in a Java EE-style).

Recently some new tools have popped up to support Java EE microservices with embedded containers, such as JBoss Swarm, Payara Micro and KumuluzEE. Today, I’ll show how to set up a simple KumuluzEE project. Bear in mind that KumuluzEE is not final and does not support all the Java EE specifications, but for most microservices it does the job.

We’re going to start off adding the necessary dependencies to our build file (Gradle).

compile 'com.kumuluz.ee:kumuluzee-core:1.0.0'      
compile 'com.kumuluz.ee:kumuluzee-servlet-jetty:1.0.0'      
compile 'com.kumuluz.ee:kumuluzee-cdi:1.0.0'      
compile 'com.kumuluz.ee:kumuluzee-jax-rs:1.0.0'      
compile 'com.kumuluz.ee:kumuluzee-bean-validation:1.0.0'    

This adds the necessary dependencies to build a basic REST based microservice.

Next, we’re adding the basic Application class needed for JAX-RS deployments.

@ApplicationPath("/rest/")      
public class TestApplication extends Application {      
}    

This will set the root path for all the REST endpoints you’ll add. Next, we’re going to add a basic REST endpoint.

@Path("/test")      
public class TestResource {                 
  @GET          
  public int getInt() {              
    return 42;          
  }      
}    

To run the application, you can start it in your IDE using the EeApplication class from KumuluzEE. This class has a main method and will start up the embedded Jetty container and deploy all the EE classes. Nothing more is needed. Alternatively, you can create an uberjar or use Capsule to create a self-running JAR, using the EeApplication as the main class.

That’s all there is to it. KumuluzEE supports the CDI standard, so you can easily add any of the Deltaspike integrations. It also supports JPA out of the box. It does not support JSF or WebSockets yet, but this is to be included in the next version. However, nothing prohibit you to include for example Atmosphere to add support for WebSockets already.

While not as feature-complete as the other players out there (Dropwizard and Spring Boot), KumuluzEE is a welcome addition to the microservices platforms. Check it out here

microservice Java EE Spring Framework

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • HTTP vs Messaging for Microservices Communications
  • REST vs. Messaging for Microservices
  • Fargate vs. Lambda: The Battle of the Future
  • Full Lifecycle API Management Is Dead

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: