Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Practical Cloud-Native Java Development with MicroProfile
Practical Cloud-Native Java Development with MicroProfile

Practical Cloud-Native Java Development with MicroProfile: Develop and deploy scalable, resilient, and reactive cloud-native applications using MicroProfile 4.1

Arrow left icon
Profile Icon Emily Jiang Profile Icon Nottingham Profile Icon Alcorn Profile Icon McCright Profile Icon Chan +1 more Show less
Arrow right icon
S$36.99 S$52.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.1 (7 Ratings)
eBook Sep 2021 404 pages 1st Edition
eBook
S$36.99 S$52.99
Paperback
S$66.99
Subscription
Free Trial
Arrow left icon
Profile Icon Emily Jiang Profile Icon Nottingham Profile Icon Alcorn Profile Icon McCright Profile Icon Chan +1 more Show less
Arrow right icon
S$36.99 S$52.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.1 (7 Ratings)
eBook Sep 2021 404 pages 1st Edition
eBook
S$36.99 S$52.99
Paperback
S$66.99
Subscription
Free Trial
eBook
S$36.99 S$52.99
Paperback
S$66.99
Subscription
Free Trial

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Practical Cloud-Native Java Development with MicroProfile

Chapter 1: Cloud-Native Applications

When talking about cloud-native applications, it is important to have a shared understanding of what cloud-native means. There is often an assumption that cloud-native and microservices are the same thing, but actually, microservices are just one architectural pattern that can be used when building cloud-native applications. That leads us to the questions: what is a cloud-native application, and what are the best practices for building them? This will be the focus of this chapter.

In particular, we will cover these main topics:

  • What is a cloud-native application?
  • Introducing distributed computing
  • Exploring cloud-native application architectures
  • Cloud-native development best practices

This chapter will provide some grounding for understanding the rest of the book as well as helping you to be successful when building cloud-native applications.

What is a cloud-native application?

Back in 2010, Paul Freemantle wrote an early blog post about cloud-native (http://pzf.fremantle.org/2010/05/cloud-native.html) and used the analogy of trying to drive a horse-drawn cart on a 6-lane highway. No matter how much better a highway is as a road, there is a limit to how much a cart can transport and how quickly. You need vehicles that are designed for driving on a highway. The same is true of applications.

An application designed to run in a traditional data center is not going to run well on the cloud compared to one that was designed specifically to take advantage of the cloud. In other words, a cloud-native application is one that has been specifically designed to take advantage of the capabilities provided by the cloud. The Stock Trader application from Chapter 8, Building and Testing Cloud-Native Applications, is an example of such an application. A real-world example of microservices is Netflix.

Perhaps at its core, the promise of the cloud is being able to get compute resources on-demand, in minutes or seconds rather than days or weeks, and being charged based on incremental usage rather than upfront for potential usage – although, for many, the attraction is just no longer having to manage and maintain multiple data centers. The commoditization of compute resources that the cloud provides leads to a very different way of thinking about, planning for, and designing applications, and these differences significantly affect the application. One of the key changes in application design is the degree to which applications are distributed.

Introducing distributed computing

Most cloud-native architectures involve splitting an application into several discrete services that communicate over a network link rather than an in-process method invocation. This makes cloud-native applications implicitly distributed applications, and while distributed computing is nothing new, it does increase the need to understand the benefits and pitfalls of distributed computing. When building distributed applications, it is important to consider and understand the eight fallacies of distributed computing. These are as follows:

  • The network is reliable.
  • Latency is zero.
  • Bandwidth is infinite.
  • The network is secure.
  • Topology doesn't change.
  • There is one administrator.
  • Transport cost is zero.
  • The network is homogeneous.

In essence, what these fallacies mean is that a network call is slower, less secure, less reliable, and harder to fix than invoking a Java method call or a C procedure. When creating cloud-native applications, care needs to be taken to ensure these fallacies are correctly accounted for, otherwise, the application will be slow, unreliable, insecure, and impossible to debug.

An application consisting of multiple services interacting across the network can produce many benefits, such as the ability to individually scale and update services, but care must be taken to design services to minimize the number of network interactions required to deliver the ultimate business solution.

As a result, several cloud-native architectures can be used to build cloud-native applications that present different tradeoffs between the benefits and challenges of distributed computing.

Exploring cloud-native application architectures

Since 2019, there has been increasing discussion in the industry about the pros and cons of microservices as a cloud-native application architecture. This has been driven by many microservice-related failures and as a result, people are now discussing whether some applications would be better off using different architectures. There has even been the start of a renaissance around the idea of building monoliths, after several years of those kinds of applications being seen as an anti-pattern.

While it is attractive to think of cloud-native as just being a technology choice, it is important to understand how the development processes, organization structure, and culture affect the evolution of cloud-native applications, the system architecture, and any ultimate success. Conway's Law states the following:

Any organization that designs a system will produce a design whose structure is a copy of the organization's communication structure.

A simple way of thinking of this is if your development organization is successful at building monoliths, it is unlikely to be successful at building microservices without some kind of reorganization. That doesn't mean every team wanting to do cloud-native should go out and reorganize; it means that you should understand your strengths and weaknesses when deciding what architecture to adopt. You should also be open to reorganizing if necessary.

This section discusses a number of the more popular cloud-native application architectures out there and the pros and cons of using them. Let's start with microservices.

Microservices

Although Netflix didn't invent the idea of microservices, their use of the architecture did popularize it. A single microservice is designed to do one thing. It doesn't, despite the name, mean that service is small or lightweight – a single microservice could be millions of lines of code, but the code in the microservice has a high level of cohesion. A microservice would never handle ATM withdrawals and also sell movie tickets. Identifying the best way to design a cloud-native application into a series of well-designed microservices is not a simple task; different people might take different views of whether a deposit into and withdrawal from a bank account would warrant a single microservice or two.

Microservices usually integrate with each other via REST interfaces or messaging systems, although gRPC and GraphQL are growing in popularity. A web-facing microservice is likely to use a REST or GraphQL interface, but an internal one is more likely to use a messaging system such as Apache Kafka. Messaging systems are generally very resilient to network issues, since once the messaging system has accepted the message, it will store the message until it can be successfully processed.

The key promise of the microservice-based architecture is that each microservice can be independently deployed, updated, and scaled, allowing teams that own disparate microservices to work in parallel, making updates without the need to coordinate. This is perhaps the biggest challenge with microservice architectures. It is relatively common for well-meaning developers who set out to build microservices to end up building a distributed monolith instead. This often occurs because of poorly defined and poorly documented APIs between services and insufficient acceptance testing, resulting in a lack of trust in updating a single microservice without impacting the others. This is called a distributed monolith because you end up with all the disadvantages of a monolith and microservices and miss out on the benefits.

In an ideal world, a development organization building microservices will align the microservices with an individual development team. This may be difficult if there are more microservices than development teams. As the number of microservices a team manages increases, more time will be spent managing the services rather than evolving them.

Monoliths

Monoliths are strongly associated with pre-cloud application architectures and are considered an anti-pattern for cloud-native applications. For that reason, it might seem strange that this appears in a discussion of cloud-native architecture. However, there are some reasons for including them.

The first is really just the reality that monoliths are the simplest kind of application to build. While the individual services cannot be independently scaled, as long as the monolith has been designed to scale, this may not be an issue.

The second is that there are a lot of monoliths out there and many enterprises are moving them to the cloud. MicroProfile provides additional APIs to retrofit many cloud-native behaviors into an existing app.

The trick with a monolith is ensuring that despite the colocation of services in a single deployment artifact, the monolith can start quickly enough to enable dynamic scaling and restart if there is an application failure.

Typically, a small development organization will benefit from monoliths since there is only a single application to build, deploy, and manage.

Macroservices

Macroservices sit somewhere between a monolith and a microservice architecture and are also referred to as modular monoliths. With macroservices, the services are combined into a small number of monoliths that interoperate in the same way that a series of microservices would.

This provides many of the benefits of microservices but significantly simplifies the operations environment since there are fewer things to manage. If a macro-service has been written well, then individual services in that macro-service can be broken out if they would benefit from an independent life cycle. A well-known example of a macro-service is Stack Overflow. Stack Overflow (https://www.infoq.com/news/2015/06/scaling-stack-overflow/) is famously a monolith except for the tagging capability, which is handled in another application due to the different performance needs. This split moves it from being a pure monolith into the realm of macroservices (although Stack Overflow uses the term monolith-plus).

This architecture can work especially well when a development organization is organized into a smaller number of teams than the number of services.

Function as a Service

Function as a Service (FaaS), often referred to as serverless, is an architecture where a service is created as a function that is run when an event occurs. The function is intended to be fast starting and fast executing and can be triggered by things such as HTTP requests or messages being received. FaaS promises that you can deploy the function to a cloud, and it is started and executed by the event trigger, rather than having to have the function running just in case. Typically, public cloud providers that support FaaS only charge for the time the function is running. This is very attractive if the event is relatively uncommon since there is no financial cost in having a system running for when an uncommon event occurs.

The challenge with this architecture is that your function needs to be able to start quickly and usually has to finish executing quickly too; as a result, it isn't suitable for long-running processes. It also doesn't remove the server; the server is still there. Instead, it just shifts the cost from the developer to the cloud provider. If the cloud provider is a public cloud, then that is their problem, since they are charging for the function runtime, but if you are deploying to a private cloud, this becomes your problem, thereby removing some of the benefits.

Event sourcing

Often, we think of services as providing a REST endpoint, and services make calls to them. In fact, factor VII of the Twelve-Factor App (discussed in the next section) explicitly states this. The problem with this approach is that a REST call is implicitly synchronous and prone to issues if the service provider is running slow or failing.

When providing an external API to a mobile app or a web browser, a REST API is often the best option. However, for services within an enterprise, there are many benefits to using a messaging system such as Kafka and using asynchronous events instead. A messaging system that can guarantee that the message will be delivered allows the client and service to be decoupled such that an issue with the service provider doesn't prevent the request from occurring; it just means it'll be processed later. A one-to-many event system makes it easy for a single service to trigger multiple different actions with just a simple message send. Different actions can be taken by different services receiving a copy of the message and if new behavior is required, an additional service can receive the same message without having to change the sending service. A simple illustration of this might be that an event that orders an item can be processed by the payment service, the dispatch service, a reorder service, and a recommendation service that provides recommendations based on past purchases.

One of the trends with cloud-native applications is that data is moved from a centralized data store closer to the individual services. Each service operates on data it holds, so if something happens to slow down the data store for one service, it doesn't have a knock-on effect on others. This means that new mechanisms are required to ensure data consistency. Using events to handle data updates helps with this, since a single event can be distributed to every service that needs to process the update independently. The updates can take effect even if the service is down when the update is triggered. Another advantage of this approach is that if the data store fails, it can be reconstructed by replaying all the events.

Having chosen the architecture (or architectures) for building your cloud-native application, the next step is to start building it, and to do that, it is a good idea to understand some of the industry best practices around cloud-native application development.

Cloud-native development best practices

There are many best practices that, if followed, will improve the chances that your cloud-native application will be a success. Following these best practices doesn't guarantee success, just as ignoring them doesn't guarantee failure, but they do encode key practices that have been shown to enhance the chances of success. The most famous set of best practices is the Twelve-Factor App.

Twelve-Factor App

The Twelve-Factor App (https://12factor.net) is a set of 12 best practices that, if followed, can significantly improve the chance of success when building cloud-native applications. Some of the factors would be considered obvious by many software developers even outside of cloud-native, but taken together, they form a popular methodology for building cloud-native applications. The 12 factors are as follows:

  • Code base
  • Dependencies
  • Config
  • Backing services
  • Build, release, run
  • Process
  • Port binding
  • Concurrency
  • Disposability
  • Dev/prod parity
  • Logs
  • Admin processes

I – Code base

The first factor states that a cloud-native application consists of a single code base that is tracked in a version control system, such as Git, and that code base will be deployed multiple times. A deployment might be to a test, staging, or production environment. That doesn't mean that the code in the environments will be identical; a test environment will obviously contain code changes that are proposed but haven't been proven as safe for production, but that is still one code base.

II – Dependencies

It has been common development practice for Java applications to use dependencies stored in Maven repositories such as Maven Central for some time. Tools such as Maven and Gradle require you to express your dependencies in order to build against them. While this practice absolutely requires this, it goes beyond just build-time dependencies to runtime ones as well. A 12-factor application packages its dependencies into the application to ensure that a single development artifact can be reliably deployed in any suitable environment. This means that having an administrator provide the libraries in a well-known place on the filesystem is not acceptable since there is always a chance the administrator-deployed library and the application-required one are not compatible.

When considering this practice, it is important to make a clear decision about what the cloud-native application is, since at some point there will be a split between what the application provides and what the deployment environment provides. This factor triggered a trend in enterprise Java away from WAR files to executable JAR files, since many viewed the application server as an implicit dependency. However, that just shifted the implicit dependency down a level; it didn't remove it. Now the implicit dependency is Java. To a certain extent, containerization addresses this issue and at the same time, it removes the need to rearchitect around an executable JAR file.

III – Config

Since a 12-factor application may have many deployments and each deployment may connect to different systems with different credentials, it is critical that configuration be externalized into the environment. It is also common to read in the media about security issues caused by a developer accidentally checking credentials into a version control system, which would not happen if the configuration was stored externally to the code base.

Although this factor states that configuration is stored in environment variables, there are many who are uneasy about the idea of storing security-sensitive configuration in environment variables. The key thing here is to externalize configuration in a way that can be simply provided in production.

IV – Backing services

Backing services are treated as attached resources. It should be possible to change from one database to another with a simple change in configuration.

V – Build, release, run

All applications go through some kind of build, release, run process, but a 12-factor application has strict separation between those phases. The build phase involves turning the application source into the application artifact. The release phase combines the application artifact with the configuration so it can be deployed. The run phase is when it is actually executing. This strict separation means that a configuration change is never made in the run phase since there is no way to roll it back to the release stage. Instead, if a configuration change is required, a new release is made and run. The same is true if a code change is required. There is no changing the code that is running without going through a build and a run. This makes sure that you always know what is running and can easily reproduce issues or roll back to a prior version.

VI – Process

A 12-factor application consists of one or more stateless processes. This does not mean that each request is mapped to a single process; it is perfectly reasonable in Java to have a single JVM processing multiple requests at the same time. This means that the application should not rely on any one process being available from one request to another. If a single client is making 20 requests, the assumption must be that each request is handled by a separate process with no state being retained between processes. It is a common pattern to store the server-side state associated with a user. This state should always be persisted to an external datastore, so if a follow-on request is sent to a different process, there is no impact on the client.

VII – Port binding

Applications export services via port binding. What this means is that an HTTP application should not rely on being installed into a web container, but instead it should declare a dependency on the HTTP server and cause it to open a port during startup. This has led many to take the view that a 12-factor Java application must be built as an uber-jar, but this is just one realization of the idea of building a single deployment artifact that binds to ports. An alternative and significantly more useful interpretation is to use containers; containers are very much built around the idea of port binding. It should be noted that this practice does not always apply; for example, a microservice driven by a Kafka message would not bind to a port. Also, many FaaS platforms do not provide an API for port binding.

VIII – Concurrency

Concurrency in Java is typically achieved by increasing the resources allocated to a process so more threads can be created. With 12-factor, you increase the number of instances rather than the compute capacity. There is a limit to how easy it is to add compute capacity to a single machine, but adding a new virtual machine of equivalent size is relatively easy. This practice is related to factor VI, so they complement and reinforce each other. Although this could be read to suggest a single process per request model, a Java-based application is more than capable of running multiple threads more efficiently than having a 1:1 ratio between process and request.

IX – Disposability

Every application should be treated as disposable. This means making sure the process starts quickly, shuts down promptly, and copes with termination. Taking this approach makes the application scale out well and quickly, as well as being resilient to unexpected failure, since a process can be quickly and easily restarted from the last release.

X – Dev/prod parity

Lots of application problems manifest themselves because of differences between development and staging environments. In the past, this happened because installing and starting all the downstream software was difficult, but the advent of containers has significantly simplified this experience, making it possible to run many of these systems in earlier environments. The advantage of this is that you no longer experience problems because your development database interprets SQL differently from the dev environment.

XI – Logs

Applications should write logs, and these should be written to the process output as opposed to being written to the filesystem. When deployed, the execution environment will take the process output and forward it to a final destination for viewing and long-term storage. This is very useful in Kubernetes, where logs stored inside the container do not persist if the container is destroyed, and they are easier to obtain using the Kubernetes log function, which follows the process output and not the log files.

XII: Admin processes

Admin processes should be run as one-off processes separate from the application and they should not run in line with application startup. The code for these application processes should be managed with the main application such that the release used for normal flow can be used to execute the admin task. This makes sure the application and the admin code do not diverge.

Other best practices

The concept of the 12-factor application has been around for a while; it is important to remember with any methodology that what works for some people may not work for others, and sometimes the methodology needs to evolve as our understanding of how to be successful does. As a result, several other best practices are often added to the 12 factors discussed previously. The most common relates to the importance of describing the service API and how to test it to ensure that changes to one service do not require the coordinated deployment of client services.

APIs and contract testing

While the 12-factor methodology details a lot of useful practices for the creation and execution of cloud-native applications, it does little to talk about how application services interact and how to ensure that changing one doesn't cause another to need to change. Well-designed and clearly documented APIs are critical to ensuring that changes to a service do not affect the clients.

It isn't enough to just have documentation for the API; it is also important to ensure that changes to the service provider do not negatively affect the client. Since any bug fix could result in a change, it is often possible for the provider to believe a change is safe and accidentally break a client. This is where contract testing can come in. The advantage of contract testing is that each system (the client and the server) can be tested to ensure that changes to either do not violate the contract.

Security

One of the most noticeable gaps in the 12-factor methodology is the lack of best practices around security. From a certain perspective, this is because there is an existing set of best practices for securing applications and these apply as much to cloud-native applications as they do to traditional applications. For example, the third practice on config addresses, at least partly, how to protect credentials (or other secrets) by externalizing them outside of the application, However, this factor doesn't talk about how to securely inject secrets into the environment and how they are stored and secured. Something that depends on the deployment environment. This is discussed in more detail in Chapter 7, MicroProfile Ecosystem with Open Liberty, Docker, and Kubernetes.

Breaking things down into microservices adds additional complexity that doesn't apply in a monolith. With a monolith, you can trust the various components of the application because they are co-deployed often in the same process space. However, when a monolith is broken down into microservices and network connections are used, other mechanisms need to be used to maintain trust. The use of JSON Web Tokens (JWTs) is one such mechanism of managing and establishing trust between microservices. This is discussed in more detail in Chapter 5, Enhancing Cloud-Native Applications.

GraphQL

There is a default assumption involved in much of cloud-native thought that the APIs exposed are REST-based ones. However, this can lead to increased network calls and excessive data being sent across the network. GraphQL is a relatively new innovation that allows a service client to request the exact information it needs from a data store over an HTTP connection. A traditional REST API has to provide all the data about the resource, but often only a subset is required. Network bandwidth and client-side data processing is often wasted when using RESTful APIs since data is provided that the client does not use. GraphQL solves this by allowing the client to send a query to the service requesting exactly the data they need and no more. This reduces the data being transported and fetched from the backing data store. MicroProfile provides a Java-based API for writing a GraphQL backend, which makes it easy to write a service that provides such a query-based API for clients.

Summary

In this chapter, we have learned what a cloud-native application is and learned about some architectures for building them. We have also learned about some best practices for building cloud-native applications and why they exist, so we can determine whether and when to apply them. This provides a good grounding for applying what you'll learn in the rest of the book to be able to be successful in building and deploying cloud-native applications.

In the next chapter, we will explore what MicroProfile is and how it can be used to build cloud-native applications.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Apply your knowledge of MicroProfile APIs to develop cloud-native applications
  • Use MicroProfile Health to provide the startup, liveness, and readiness status of your enterprise application
  • Build an end-to-end stock trader project and containerize it to deploy to the cloud with Istio interaction

Description

In this cloud-native era, most applications are deployed in a cloud environment that is public, private, or a combination of both. To ensure that your application performs well in the cloud, you need to build an application that is cloud native. MicroProfile is one of the most popular frameworks for building cloud-native applications, and fits well with Kubernetes. As an open standard technology, MicroProfile helps improve application portability across all of MicroProfile's implementations. Practical Cloud-Native Java Development with MicroProfile is a comprehensive guide that helps you explore the advanced features and use cases of a variety of Jakarta and MicroProfile specifications. You'll start by learning how to develop a real-world stock trader application, and then move on to enhancing the application and adding day-2 operation considerations. You'll gradually advance to packaging and deploying the application. The book demonstrates the complete process of development through to deployment and concludes by showing you how to monitor the application's performance in the cloud. By the end of this book, you will master MicroProfile's latest features and be able to build fast and efficient cloud-native applications.

Who is this book for?

This book is for Java application developers and architects looking to build efficient applications using an open standard framework that performs well in the cloud. DevOps engineers who want to understand how cloud-native applications work will also find this book useful. A basic understanding of Java, Docker, Kubernetes, and cloud is needed to get the most out of this book.

What you will learn

  • Understand best practices for applying the 12-Factor methodology while building cloud-native applications
  • Create client-server architecture using MicroProfile Rest Client and JAX-RS
  • Configure your cloud-native application using MicroProfile Config
  • Secure your cloud-native application with MicroProfile JWT
  • Become well-versed with running your cloud-native applications in Open Liberty
  • Grasp MicroProfile Open Tracing and learn how to use Jaeger to view trace spans
  • Deploy Docker containers to Kubernetes and understand how to use ConfigMap and Secrets from Kubernetes

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Sep 22, 2021
Length: 404 pages
Edition : 1st
Language : English
ISBN-13 : 9781801072052
Vendor :
Eclipse Foundation
Concepts :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Sep 22, 2021
Length: 404 pages
Edition : 1st
Language : English
ISBN-13 : 9781801072052
Vendor :
Eclipse Foundation
Concepts :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just S$6 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just S$6 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total S$ 208.97
Practical Cloud-Native Java Development with MicroProfile
S$66.99
Building Microservices with Micronaut®
S$74.99
Modern API Development with Spring and Spring Boot
S$66.99
Total S$ 208.97 Stars icon
Banner background image

Table of Contents

17 Chapters
Section 1: Cloud-Native Applications Chevron down icon Chevron up icon
Chapter 1: Cloud-Native Applications Chevron down icon Chevron up icon
Chapter 2: How Does MicroProfile Fit into Cloud-Native Application Development? Chevron down icon Chevron up icon
Chapter 3: Introducing the IBM Stock Trader Cloud-Native Application Chevron down icon Chevron up icon
Section 2: MicroProfile 4.1 Deep Dive Chevron down icon Chevron up icon
Chapter 4: Developing Cloud-Native Applications Chevron down icon Chevron up icon
Chapter 5: Enhancing Cloud-Native Applications Chevron down icon Chevron up icon
Chapter 6: Observing and Monitoring Cloud-Native Applications Chevron down icon Chevron up icon
Chapter 7: MicroProfile Ecosystem with Open Liberty, Docker, and Kubernetes Chevron down icon Chevron up icon
Section 3: End-to-End Project Using MicroProfile Chevron down icon Chevron up icon
Chapter 8: Building and Testing Your Cloud-Native Application Chevron down icon Chevron up icon
Chapter 9: Deployment and Day 2 Operations Chevron down icon Chevron up icon
Section 4: MicroProfile Standalone Specifications and the Future Chevron down icon Chevron up icon
Chapter 10: Reactive Cloud-Native Applications Chevron down icon Chevron up icon
Chapter 11: MicroProfile GraphQL Chevron down icon Chevron up icon
Chapter 12: MicroProfile LRA and the Future of MicroProfile Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.1
(7 Ratings)
5 star 14.3%
4 star 85.7%
3 star 0%
2 star 0%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




@book_a_holic_17 Oct 15, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
MicroProfile has grown to be a very capable set of standard API for doing cloud-native Java applications. A book like this is long overdue. This book has been authored by people heavily influential in the development of MicroProfile, both in terms of specifications as well as implementations. Needless to say, they know what they're talking about.The scope and structure of the book is well thought out. In the early chapters, it level-sets on the whole concept of cloud-native (this is necessary, because it's not a particularly well-defined term and so having a common perspective as you read is really helpful). Each of the chapters includes many useful code examples and all the code is available in a public git repository.The book gives a high-level overview of the history of MicroProfile and the roles of different specifications in relation to cloud-native. This is a helpful level-set before getting into the meat of things. It also introduces a comprehensive sample application demonstrating the concepts and technologies in a way that is closer to real-world than you tend to find in most books of this type.What follows is a deep-dive into the MicroProfile Platform from a developer and operations perspective. It starts with details on developing and consuming RESTful services. It then moves on to the more advanced topics of fault tolerance, publishing APIs, securing APIs and injecting configuration. Lastly it moves on to observability, covering the creation of health endpoints, producing metrics and tracing requests, all essential for observing and acting upon the health of your cloud-native applications. In subsequent chapters, the authors broaden out from MicroProfile to discuss where it fits within the context of the cloud-native technology ecosystem, covering Docker (Containers), Kubernetes and Service Mesh. There's also an all-too-important section on building and testing, and details on day-2 operations, the latter going into the role of Kubernetes operators, with examples shown in the popular OpenShift platform.Finally, the book takes a look at the MicroProfile standalone specifications (capabilities that are not part of the core platform). These include developing reactive applications, GraphQL for query-based services, and Long-running Actions for Saga-based transactions (an approach to coordinating updates across microservices where it is inappropriate to use distributed two-phase commit transactions).Overall, the depth of experience of the authors shines through in this book. The examples are detailed and will prove very helpful for anyone looking to create cloud-native applications with MicroProfile.
Amazon Verified review Amazon
Matt Jan 26, 2022
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
I purchased this book on packtpub.com, not Amazon, but I couldn't find a review mechanism on that site.I bought this book because I want to learn more about using Java to make web applications/APIs. I've been using the Java language for years, but whenever I tried to learn how to use Java to actually make something and deploy it, I got overwhelmed. There's so much out there... Jakarta EE, Micronaut, and all the other stuff. It feels like if you try to learn Java development from scratch these days, everything you find online assumes you know things already, as if you've already been using Java in production for years and you just need to learn about new stuff.This book is the first one on Java development that seemed holistic. Its approach was helpful for me. It starts by explaining what makes an application cloud native and why MicroProfile helps with this. It touches on the difference between MicroProfile and Jakarta EE, and lists some example implementations like Quarkus. Throughout the book, it uses Open Liberty as an example implementation. This gave me a starting point where I could finally grok what enterprise Java was all about.It was after reading the first few chapters that I knew the basics of JAX-RS, JSON-P, and JSON-B, and had an idea of what Open Liberty was. That was when I realized I could start writing some code to learn hands on. I needed to pick a MicroProfile implementation, so I picked Open Liberty because that's what the book uses. When I read the Open Liberty documentation, I found it to be just as approachable as this book, so it was a great choice for example implementation.When I got to the section on advanced MicroProfile usage, I found the content to be a bit dry. It throws a lot of the MicroProfile spec at you, and it has a small example for each part of the spec. But it doesn't explain how to use it in a complete application. I guess the idea is that you'd consult the IBM Stock Trader application that was presented at the beginning of the book as reference, but it would have been nice to see real world examples as I go too. I feel like it would have made more sense to have the chapters introduce the parts of the spec by showing the example application being built. Without this insight as I go, this part feels more like reference material than a book. For reference material, I'd rather consult online documentation. So that's an area where the book could be improved.I haven't finished the book yet, but despite its flaws I described above, I already know I don't regret my purchase. The book is still the most approachable on enterprise Java that I've found so far. I probably won't even end up using Open Liberty in production. But I like using it as a starting point for learning MicroProfile, knowing I can move to other implementations of it later if I want to. This book was the enterprise Java resource I was looking for.
Amazon Verified review Amazon
Orozco Lopez Victor Leonel Sep 24, 2021
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Year after year many enterprise companies are struggling to embrace Cloud Native practices that we tend to denominate as Microservices, however Microservices is a metapattern that needs to follow a well defined approach, like:- (We aim for) reactive systems- (Hence we need a methodology like) 12 Cloud Native factors- (Implementing) well-known design patterns- (Dividing the system by using) Domain Driven Design- (Implementing microservices via) Microservices chassis and/or service mesh- (Achieving deployments by) Containers orchestrationMany of these concepts require a considerable amount of context, but some books, tutorials, conferences and YouTube videos tend to focus on specific niche information, making difficult to have a "cold start" in the microservices space if you have been developing regular/monolithic software. For me, that's the best thing about this book, it provides a holistic view to understand microservices with Java and MicroProfile for "cold starter developers".## About the bookUsing a software architect perspective, MicroProfile could be defined as a set of specifications (APIs) that many microservices chassis implement in order to solve common microservices problems through patterns, lessons learned from well known Java libraries, and proposals for collaboration between Java Enterprise vendors.Subsequently if you think that it sounds a lot like Java EE, that's right, it's the same spirit but on the microservices space with participation for many vendors, including vendors from the Java EE space -e.g. Red Hat, IBM, Apache, Payara-.The main value of this book is the willingness to go beyond the APIs, providing four structured sections that have different writing styles, for instance:- Section 1: Cloud Native Applications - Written as a didactical resource to learn fundamentals of distributed systems with Cloud Native approach- Section 2: MicroProfile Deep Dive - Written as a reference book with code snippets to understand the motivation, functionality and specific details in MicroProfile APIs and the relation between this APIs and common Microservices patterns -e.g. Remote procedure invocation, Health Check APIs, Externalized configuration-- Section 3: End-to-End Project Using MicroProfile - Written as a narrative workshop with source code already available, to understand the development and deployment process of Cloud Native applications with MicroProfile- Section 4: The standalone specifications - Written as a reference book with code snippets, it describes the development of newer specs that could be included in future under MicroProfile's umbrella## Things that could be improvedAs any review this is the most difficult section to write, but I think that a second edition should:- Extend the CDI section due its foundational status- Switch the order of the Stock Tracer presentation- Extend the data consistency discussión -e.g. CQRS, Event Sourcing-, hopefully with advances from LRAThe last item is mostly a wish since I'm always in the need for better ways to integrate this common practices with buses like Kafka or Camel using MicroProfile. I know that some implementations -e.g. Helidon, Quarkus- already have extensions for Kafka or Camel, but the data consistency is an entire discussion about patterns, tools and best practices.## Who should read this book?- Java developers with strong SE foundations and familiarity with the enterprise space (Spring/Java EE)
Amazon Verified review Amazon
K. Sutter Oct 18, 2021
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
I might be a little biased because of my close relationship with both MicroProfile and Open Liberty, but this book would be an excellent addition to your Enterprise Java bookshelf! When I am in the market for a book on a technical topic, I look for numerous specific coding and deployment examples. This book has many code snippets, deployment scripts, and references to GitHub repositories that contain everything documented through out the book.If you are generally familiar with MicroProfile and its history, then I'd skip chapters 1-2 and jump directly to chapter 3, which gives an overview of the Stock Trader application which is used through out the book. If you want to continue to get your feet wet with technology, then skip to Chapter 8 which further explains how to build and test the Stock Trader application using Open Liberty’s implementation of MicroProfile. At this point, you’ll have a solid understanding of the Stock Trader Application.After experimenting with Stock Trader, you could go back and read through the chapters that outline the various technologies that make up the MicroProfile Platform. Chapter 4 focuses on the key technologies of MicroProfile -- JAX-RS, CDI, JSONB, JSONP, and Rest Client. Chapter 5 expands on that foundation by explaining the Config, Fault Tolerance, OpenAPI (documentation), and JWT (security) technologies. And, to finish off this MicroProfile description, chapter 6 documents the monitoring features -- Health, Metrics, and OpenTracing.Chapter 9 goes beyond the basic deployment scenarios which most books focus on. More advanced deployments with composite operators and OpenShift are explored and explained. My own experience with OpenShift is limited, so this chapter was very helpful with understanding the intricacies of deploying Stock Trader and then maintaining that deployment with Day 2 operations.The last section (chapters 10, 11, and 12) explores the MicroProfile components beyond the Platform. In addition, some thoughts are explored about the future direction of MicroProfile.This is an excellent technical reference for MicroProfile specifications and Open Liberty’s implementation of MicroProfile.. All of the authors are experts in their respective fields and the writing shows their technical expertise. I would recommend this book for anyone looking to expand their knowledge of MicroProfile.
Amazon Verified review Amazon
GenX Oct 13, 2021
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
If you are an experienced java/java ee developer working on cloud-native java applications then this book is for you. This book teaches you how to use Microprofile with Java EE framework to produce cloud-native applications.Authors have done a commendable job to explain what it means to be cloud-native and how to create a full-fledged cloud native java based applications.The book is divided into three sections:First section creates a landscape to help understand the fundamentals of cloud-native, microservices, distributed applications, 12 factor app, microprofile, the solo pieces of a puzzle which book beautifully pieces together to answer one being questions "what is a cloud-native app and how does java/ee/microprofile promise to create one?".Next sections delves in to the depth of microprofile specification and how it principally aligns its components to the methodologies of "12 factor app". Each component of microprofile is covered in details with concrete examples chosen from real world scenarios.This sections goes above and beyond call of duty and extends the reader's knowledge on how to deploy/operate a microprofile application on kubernetes by explaining basic building blocks of docker/kubernetes.Third and last section puts everything in action and like Authors say it in the book "This is where the rubber meets the road". The famous IBMStockTraderApplication is conceived/designed/developed and deployed on kubernetes cluster.What I Liked about the book======================My philosophy of understanding something new in java world has always been "start with specification" to understand "why I need it" and ends with documentation to know "how do I do it". This books does just that. It explains each and every concept like you are reading a specification and introduces the code snippets like a documentation to show how you do it. Authors have marvellously found the balance between theory and code. The chapters on standalone microprofile components like Microprofile ReactiveMessaging, Microprofile ContextPropogation, Microprofile GraphQL brings a completeness to the book and were delight to read.What I did not like about the book==========================I believe that book was short of explaining and showing how to achieve asynchronous/reactive applications using JAX-RS and Microprofile RestClient by showing how to pass the context from jax-rs to rest clients. While authors have tried to explain each parts in isolation, I guess they should have shown the complete working example of it since many of the components are new and readers might find it hard to visualise and code this pattern.Disclaimer : I received the free copy of the book for the evaluation and review. I have been developing cloud-native application using microprofile from 3 years.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.