After the producer and consumer are developed and tested, package and then publish the service. The following describes how to publish a service using the current demo.
Note: The EDAS RPC service uses Port 12200. Therefore, ensure that the port on the ECS instance where the service runs can be accessed by the service consumer.
Two applications (detail.war and itemcenter.war) need to be published. Therefore, prepare at least two ECS instances with EDAS Agent installed. For details, see Install EDAS Agent. Assume that the names of the two ECS instances are edas-detail and edas-itemcenter. The procedure of deploying applications is as follows:
Log on to the EDAS console and choose Applications in the left-side navigation pane. Click Create Application in the upper-right corner of the page.
In the Create Application dialog box, select the region and enter the application name and click Next.
In the Application Type dialog box, select the corresponding ECS instance from the instance list and click Create Application.
Here, we create two applications: app-detail and app-itemcenter, which are deployed on edas-detail and edas-itemcenter respectively.
After applications are created, choose Applications and select app-detail and app-itemcenter to go to the details page. In the upper-right corner of the page, click Deploy.
In the dialog box that appears, select the WAR package that is compressed in Service packaging. Then, upload and deploy the package.
After deployment, click Start in the upper-right corner of the page.
After the application is started on the ECS instance, the status of the corresponding ECS instance is displayed in the Instance Information tab of the application basic information page. If the real-time status of the ECS instance is Normal and the task status is Successful, then the application is successfully started on the ECS instance.
After the two applications are started, on the Applications page, select the app-temcenter application to go to the application details page.
Choose Services > Published Service in the left-side navigation pane. The published service defined in the Spring configuration file is:
If you go to the app-detail application page and choose Services > Published Service, the consumed service defined in the Spring configuration file is:
Log on to edas-detail ECS instance and go to the logs directory of AliTomcat (assume that the path is /home/admin/taobao-tomcat/logs/) as the admin user. You can view the following log information in the output of catalina.out:
Item[id: 1, nam: Mercedes Benz], which is the
Itemobject returned by the service provider (app-itemcenter).