Test the Extension
In this task, you build the purchase project and test the new REST service using a REST client. Testing requires a Gateway Proxy pointing to a running MATRIXX Engine.
About this task
For more information about the MATRIXX environment variables, see the discussion about container directories and environment variables in MATRIXX Installation and Upgrade.
Procedure
- Go to to the /mtxsdk/projects/target/purchase directory.
- Copy the extensions.jar file to the /opt/mtx/ext/common directory.
-
Edit the /opt/mtx/conf/extension-containers.yaml file.
Note: If this file does not exist, you must create it.
-
Add the MDC definition files to extension-containers.yaml.
For example:
extension-core: /extension-containers.yaml Extension-rest: /extension-rest-mdc.xml
- Copy the libraries or dependencies to /opt/mtx/ext/common the directory.
-
Build the project.
At the command prompt, type:
mvn clean install
- Copy the rsgwextension.jar file to the /opt/mtx/ext/rsgateway directory.
-
Enter the following command to restart RS Gateway:
sudo systemctl restart mtx_rsgateway
- Check the RS Gateway log file (/var/log/mtx/rsgateway.log) to confirm that the extensions loaded correctly.
-
Configure the Gateway Proxy on the local pod to communicate with a running engine.
See the discussion about configuring the Gateway Proxy in MATRIXX Installation and Upgrade.
-
Using your REST client, send the following request.
URL:
POST http://localhost:8080/rsgateway/data/json/demo/subscriber/1-2-3-4/offer
Request Body:{"Type": "phone", "Amount": 52.99, "Color":rose-gold}
Results
{
"$": "DemoResultSubscriberPurchase",
"Result": 0,
"ResultText": "Ok -> hello from DemoServices",
"_resultCode": 0,
"_resultText": "Ok -> hello from DemoServices",
"_resultType": "Create"
}