The Payara Platform contains many products and some you may not have heard of! For example, have you heard of Payara Embedded Full Profile or Payara Embedded Web Profile?Here's a full list of Payara Platform products:
- Payara Server Full Profile
- Payara Server Web Profile
- Payara Micro
- Payara Embedded Full Profile
- Payara Embedded Web Profile
The first three products are probably well known by most of you. Payara Server is a more traditional application server that you install, configure, and deploy Jakarta EE applications on. Payara Micro is a runtime capable of running Jakarta EE Web Profile-based applications without the need for a separate configuration step.
But what is Payara Embedded?
As you can guess from the name, it allows you to embed the Payara Server code into a Java application. With a few lines of Java code, you can start a Payara Server instance with your application and start responding to user requests. The functionality of this embedded version is the same as the standalone version. Payara Embedded is a specific packaging of Payara Server so that you can use it as a project dependency and it has some additional classes and methods to start up the Payara Server instance.
So in theory, you can also create some clusters using the Deployment Group functionality but that is not the intention of the Payara Embedded edition. In this blog, I discuss the two common use cases for Payara Embedded.
Bundle your Application
There are situations that the installation of the Payara Server and the deployment of the applications cannot be done on a central infrastructure. Sometimes it can be more reliable to have an installation in all your shops, for example, instead of a central one.
In this case, you can bundle Payara Server with the application within a single application, which makes it easier for installing it. Instead of having the three steps, installing Payara Server, configuring the environment, and deploying the application, you can do all those steps within the application containing Payara Embedded. You only need to start the application and the system is ready to respond to user requests.
Using Payara Micro for this scenario is easier, so unless you need some specifications that are only available in the Full Profile, like the SOAP support, our recommendation is to create an uber jar with Payara Micro and your application for this scenario rather than use Payara Embedded.
You can have a look at the blog Using Payara Embedded with Maven for some more details.
When performing integration testing, we need to deploy the application to the server and verify the behavior of the code we have written. You can use a standalone installation of Payara Server for that but sometimes you can have issues that the cleanup is not always done correctly when there is a test failure. Other tests can fail from that point on because the environment is no longer in the state you expect it to be.
Starting Payara Server for testing can be done easier in the embedded form. You can start it up at the beginning of the test and verify the functionality. You can start a clean instance for each test and thus you will not have any issues because of an unexpected state of the environment.
Starting a Payara Embedded version can also be done using the Arquillian connector we have developed. In that case, you don't have to code anything, you perform the necessary configuration. The Embedded instance is started, the artifact deployed to it, and tested out. You can read more about our Arquillian connector for Payara Embedded on the documentation page.