Create the first Service Fabric Java application on Linux, linuxfabric
Prerequisites
Before you start, install Service Fabric SDK and Azure CLI, and set up a development cluster in the Linux development environment. If Mac OS X is used, you can use Vagrant to set the Linux development environment in the virtual machine.
You also need to configure Azure CLI 2.0 (recommended) or XPlat CLI to deploy applications.
Create an application
The Service Fabric application contains one or more services. Each Service has a specific role when providing application functions. The Service Fabric SDK for Linux contains the Yeoman generator, which allows you to easily create the first Service and add more services later. In addition, you can use the plug-in for Eclipse to create, generate, and deploy the Service Fabric Java application. See use Eclipse to create and deploy the first Java application. For this quick start, use Yeoman to create an application with a single service, which is used to store and obtain counter values.
Build applications
The Service Fabric Yeoman template contains the Gradle generation script, which can be used to generate applications from the terminal. To generate and package an application, run the following command:
Bash Copy
cd myappgradle
Deploy applications
After an application is generated, it can be deployed to a local cluster.
Use Azure CLI 2.0 with XPlat CLI
The generated application is deployed in the same way as any other Service Fabric application. For more information, see related documents to learn how to use Azure CLI to manage Service Fabric applications.
The parameters of these commands can be found in the build list in the application package.
After the application is deployed, open the browser and navigate to Service Fabric Explorer. Its address is http: // localhost: 19080/Explorer. Expand the "application" node. Note that one entry is used for the application type, and the other is used for the first instance of this type.
Start the test client and perform failover
The Execution Component itself does not perform any operations. It requires other services or clients to send messages to it. The execution component template contains a simple test script that can be used to interact with the Execution Component Service.
Delete An Application
You can use the uninstall script provided in the template to delete application instances, unregister application packages, and delete application packages from the image storage area of the cluster.
Bash Copy
./uninstall.sh
In Service Fabric Explorer, you can see that the application and application type are no longer displayed on the application node.
Subsequent steps
Related Articles
- Getting started with Service Fabric and Azure CLI 2.0
- Get started with Service Fabric XPlat CLI