When a WSO2 product starts, it starts all components, features and related artifacts bundled with it. In many cases that is just fine. But there are cases where you want to start only parts of the product.
The API Manager is such an example where the four individual parts (Store, Publisher, Gateway and Key Manager) can be started individually.
Why the API Manager?
The API Manager consists of a number of parts that each has a specific function. The API store lets developers discover APIs and sign up for use. This part should be available to all potential users / developers.
The API Publisher is used to manage the Lifecycle of an API, from creation to deprecation and should only be available to the organization or people within the organization that created the store. The API Gateway keeps track of all the API calls that are done and again should be available for all.
Lastly, the API Keymanager is responsible for the tokens and should be placed in within the organizations network.
Different parts end up in different places and multi-profile support allows you to run the product on a selected profile so that only the features specific to that profile along with common features start up with the server.
If you are running the API Gateway, you only need the OSGI bundles for that function, not the rest.
So in the WSO2 API Manager there are the following profiles available:
Profile | Command Option with Profile Name | Description |
Gateway manager | -Dprofile=gateway-manager |
Starts only the components related to the API Gateway.
You use this when the API Gateway acts as a manager node in a cluster. This profile starts frontend/UI features such as login as well as backend services that allow the product instance to communicate with other nodes in the cluster. |
Gateway worker | -Dprofile=gateway-worker |
Starts only the components related to the API Gateway.
You use this when the API Gateway acts as a worker node in a cluster. This profile only starts the backend features for data processing and communicating with the manager node. |
Key Manager | -Dprofile=api-key-manager |
Starts only the features relevant to the Key Manager component of the API Manager. |
API Publisher | -Dprofile=api-publisher |
Starts only the front end/backend features relevant to the API Publisher. |
API Store | -Dprofile=api-store |
Starts only the front end/backend features relevant to the API Store.v |
It is important to realize that when you start a WSO2 product with a profile will only load the needed OSGI bundles but does not block the Web applications. So you can start with a Gateway profile and still start the API Store for instance.
How do you start a WSO2 product with a profile?
In order to start a product with a profile, use the following extentions to the regular startup command:
OS | Command |
Windows | <PRODUCT_HOME>/bin/wso2server.bat -Dprofile=<preferred-profile> --run |
Linux/Solaris | sh <PRODUCT _HOME>/bin/wso2server.sh -Dprofile=<preferred-profile> |
Starting a WSO2 product without a preferred profile will actually start the ‘Default’ profile which contains references to all profiles.
A bit on the mechanics of profiles
As said, starting with a profile will only load a subset of features defined in that bundle. If you go to the <PRODUCT_HOME>/repository/components/
directory you will see some files that will indicate the bundles available. Not all directories are profiles by the way.
Which profiles are available?
We know that there are a number of profiles in the API Manager. But how can you identify the profiles in the WSO2 product that you are running? It is actually quite easy to see what profiles are available.
Let’s see what profiles are available in the WSO2 Business Process Server.
Start the server in the normal way (WSO2SERVER.BAT or WSO2SERVER.SH) with the added
-DosgiConsole
system property. This will give the access to the OSGi console.
Please note that when you do this, the window looks the same as it normally does, with the exception that you can actually type in a command (you will see a blinking cursor).
Type in the command provlp
followed by Return.
This will give the list of server profiles available in the run-time, in this case the Business Process Server that only has one profile: worker. This is of course in addition to the default profile.
Working daily with WSO2 products we sometimes encounter things that even we did not know yet, but in fact are so handy we want to share it with the whole world. We have created a new group of articles called WSO-2-EASY that will show some of best tips and tricks that will help you to either save time or create tidier code. | |