Skip to content

Latest commit

 

History

History
99 lines (72 loc) · 3.35 KB

README.adoc

File metadata and controls

99 lines (72 loc) · 3.35 KB

Running tasks asynchronously or parallelly in Java microservices

Note
This repository contains the guide documentation source. To view the guide in published form, view it on the Open Liberty website.

Learn how to run tasks asynchronously or parallelly in Java microservices by using Jakarta Concurrency APIs.

What you’ll learn

Introduction

  • explain Jakarta Concurrency APIs

  • describe the application

Application architecture where inventory service uses the Jakarta Concurrency APIs to call the system service.

Try what you’ll build

Polish the following instruction.

Navigate to the finish directory.

cd finish

Start inventory service in dev mode:

mvn -pl inventory liberty:run

Start system service in dev mode:

mvn -pl system liberty:run

Visit http://localhost:9080/openapi/ui for inventory REST APIs that perform asynchronous or parallel tasks

Creating asynchronous tasks in the InventoryManager bean

  • start the dev mode

  • create the InventoryAsyncTask utility class

  • create and explain asynchronous task

  • replace the InventoryResource class

  • add/update REST endpoint to call asynchronous task

Calling the system service in parallel

  • start the dev mode

  • replace the InventoryAsyncTask utility class

  • create and explain parallel task

  • replace the InventoryResource class

  • add/update REST endpoint to call parallel task

Testing the inventory application

Running the tests

Great work! You’re done!

You have just …​ by using Jakarta Concurrency APIs in Open Liberty.