A Step-by-Step Guide from Traditional Java EE to Reactive Microservice Design

Cloud & Microservices

A workshop given at JPrime conference in May 2018.

Have you wondered how you can improve the design of your applications to improve its performance? You probably heard that reactive design can help achieve better response time and make your applications more flexible. But you’re asking: Do I need to rewrite my applications from scratch? Do I need to learn a new framework for all that? The answer is no, especially if your application is built on top of Java EE and Java 8.

 

Together, we will explore how we can migrate parts of an existing Java EE application step-by-step, in order to increase its response time, throughput, and make it more flexible and robust. We will show you by example how to apply reactive design to a traditional codebase. We will then split the application into several microservices and deploy them to a cloud environment. In the end, we’ll compare the performance and the flexibility after the redesign to find out about pros and cons of our approach.

 

Instructions: Instructions for the Hands-On-Lab.pdf

 

Main repository: https://github.com/OndrejM-demonstrations/ReactiveWay-cargotracker-ext

 

Subrepository (with the Monolith project): https://github.com/OndrejM-demonstrations/ReactiveWay-cargotracker

 

Complete resources offline (Instructions, Work and Example project): https://drive.google.com/file/d/1orkovvJI9hHDb2zSMzW0KF4hT2f6Uyt-/view?usp=sharing

 

{{cta(‘4c7626f5-1e53-418e-90c8-add6e4af19c9’)}}

 

Comments (4)

Post a comment

Your email address will not be published. Required fields are marked *

Payara needs the contact information you provide to us to contact you about our products and services. You may unsubscribe from these communications at any time. For information on how to unsubscribe, as well as our privacy practices and commitment to protecting your privacy, please review our Legal & Privacy Policy.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  1. jose diaz

    Hi Ondrej!! nice article.

    I execute all the steps without problems until 5.2 ( Running the main application in Docker).

    This is my problem:

    The guide says: “docker run -p 8080:8080 -v ‘PATH_TO_THE_GITHUB_REPO/cargo-tracker/
    target/autodeploy’:/opt/payara41/deployments reactivems/payara-server
    bin/asadmin start-domain -v”

    I replaced it command with:

    docker run -p 8080:8080 -v ‘/Users/josediaz/Projects/MicroProfile/ReactiveWay-cargotracker/target/autodeploy’:/opt/payara41/deployments reactivems/payara-server bin/asadmin start-domain -v

    The commando ‘docker ps -a’ shows:

    3f623b6c44a3 reactivems/payara-server “bin/asadmin start-d…” 29 minutes ago Up 29 minutes 4848/tcp, 5900/tcp, 8009/tcp, 8181/tcp, 0.0.0.0:8080->8080/tcp reverent_edison

    But the url is not running:

    http://localhost:8080/cargo-tracker/

    returns error 404.

    Can you help me with some tip?

    Jose

  2. Ondro Mihalyi

    Hi Jose, I’m glad you like the workshop lecture and that you got so far without any problems. I realized the instructions for running in docker are obsolete and I forgot to fix them.

    Instead of using the custom reactivems/payara-server image which isn’t needed anymore, use the standard Payara 5 image with the following:

    docker run -p 8080:8080 -v ‘/Users/josediaz/Projects/MicroProfile/ReactiveWay-cargotracker/cargo-tracker/target/autodeploy’:/opt/payara/deployments payara/server-full

    And then to execute Payara Micro instances, run the following (you need to supply the internal IP address of the Payara Server container):

    docker run -v ‘PATH_TO_THE_GITHUB_REPO/pathfinder/target’:/opt/payara/deployments payara/micro java -jar /opt/payara/payara-micro.jar –deploy /opt/payara/deployments/pathfinder.war –clustermode domain:IP_OF_PAYARA_SERVER_CONTAINER:4900

  3. Jose Diaz

    The first command run successfully.
    But the second give it error:

    ocker run -v ‘/Users/josediaz/Projects/MicroProfile/ReactiveWay-cargotracker-ext/pathfinder/target’:/opt/payara/deployments payara/micro java -jar /opt/payara/payara-micro.jar –deploy /opt/payara/deployments/pathfinder.war –clustermode domain:172.17.0.2:4900
    Jul 30, 2018 3:47:15 AM fish.payara.micro.impl.PayaraMicroImpl scanArgs
    SEVERE: Argument(s) provided are invalid: java,-jar. Try –help for valid command options

  4. Jose Diaz

    Ok I found the fix.

    docker run -v ‘/Users/josediaz/Projects/MicroProfile/ReactiveWay-cargotracker-ext/pathfinder/target’:/opt/payara/deployments payara/micro –deploy /opt/payara/deployments/pathfinder.war –clustermode domain:172.17.0.2:4900

    java -jar /opt/payara/payara-micro.jar is not necessary anymore.

    Thanks Ondrej

Related Posts

Cut Jakarta EE Startup Times from Seconds to Milliseconds with CRaC 8 minutes
Jakarta EE

Cut Jakarta EE Startup Times from Seconds to Milliseconds with CRaC 

Jakarta EE applications can take anywhere from several seconds to over a minute to start, depending on their size […]

Blue background with coral and fish. Left text: 'MONTHLY CATCH'. Right: laptop screen with tech tabs and Payara Community logo. 4 minutes
Community

The Payara Monthly Catch – December 2025

As we kick off the new year, this January edition of The Monthly Catch looks back at everything that […]

Application Modernization 7 minutes
Thought Leadership

8 Key Benefits of Application Modernization for Business Growth

Modernizing enterprise applications is a strategic imperative for organizations that want to remain competitive and resilient. According to our […]