Deploy Microservices with Function Compute: Visitor Card of Cloud Customer Service

By Du Wan

Alibaba Cloud Function Compute is a fully hosted and serverless running environment that takes away the need to manage infrastructure and enables businesses to focus on software development. You can deploy microservices on Alibaba Cloud with Function Compute; in this article, we will be doing this with the Cloud Customer Service product as an example.

Note: At the time of writing, Cloud Customer Service is only available for Mainland China Alibaba Cloud accounts.

Alibaba Cloud’s Cloud Customer Service is a complete intelligent service system that can be easily integrated into websites, applications, public accounts, and other systems. Cloud Customer Service provides complete hotline and online service functions for users to easily access other systems such as CRM. It dynamically manages the centralized knowledge bases and knowledge documents used by customers and agents. Based on Alibaba Cloud’s intelligent algorithms, chatbots can accurately understand your intention and answer any questions. In addition, it collects and analyzes the data in the customer service center in real time, helping enterprise decision-makers understand the most common issues and service bottlenecks from a global perspective.

As a function of Cloud Customer Service, Visitor Card associates the users of Cloud Customer Service with those in the CRM system to help the customer service personnel understand the customers’ basic information for better support.

The Visitor Card Integration Guide provided by Cloud Customer Service is a web project implemented based on Spring MVC. For users who use Node.js, they can migrate from Java to Function Compute and provide function as a service for core business calls implemented with Node.js.


Users have tried to migrate Java by themselves but encountered the following technical challenges:

  • JAR provided by Cloud Customer Service is a private Maven warehouse and cannot be accessed by the external network. Therefore, JAR must be copied to Maven for integration.
  • How should the Maven plug-in be properly configured to generate a JAR package that is supported by Function Compute?

Dependencies on Local JAR Packages

fccsplatform-common-crypto- is a package in the Maven warehouse in Alibaba Cloud’s internal network. It is only available to external network customers through Cloud Customer Service. The following XML fragment is a common way in which Maven depends on local JAR packages. Because this is not a typical scenario, additional information is required to complete it.

<scope>system</scope> indicates that the JAR package is searched from the system path rather than the warehouse. This command must be used with <systemPath/> . <systemPath/> indicates the actual path of a JAR package. This command is normally used with ${project.basedir} (namely, it is relative to the project directory).

Encapsulate the Handler function

Spring MVC exposes a service as a Controller. For Function Compute, only a Handler API is required.

Visitor Card services are simple, and only require an encryption API and a decoding API without calling any third-party services.

The preceding and implement the StreamRequestHandler API, while the class encapsulates the service logic.


The official Function Compute documentation recommends two packaging methods, namely, maven-assembly-plugin and maven-dependency-plugin.

  • The maven-assembly-plugin method extracts all dependent class files and repackages them into a smaller JAR package. However, this may introduce several problems.
  • The maven-dependency-plugin method packages all dependent JAR packages to the internal lib/ directory and then packages them as nested JAR packages. During runtime, Function Compute decompresses the top-layer JAR packages.

In this example, maven-assembly-plugin is not feasible because it cannot package the transitive dependency specified by systemPath, resulting in missing classes during the runtime. Therefore, the maven-dependency-plugin method is used instead.

Deploy Fun

Configure the template.yml file on Fun for description, and then run mvn package && fun deploy.


Using a language as a service boundary is one of the most common ways to define the boundaries for a service architecture. Function Compute supports multi-language environments and provides high scalability and availability, making it an ideal solution for supporting the multi-language architecture as a service.

Normally, developers have accumulated rich experience in familiar languages and have established a complete architecture and deployment O&M system. However, to expand the business boundary, they sometimes have to select an unfamiliar programming language and architecture. To address this challenge, Function Compute uses a single simple language to develop businesses, resolving your concerns about architecture and O&M and mitigating the developers’ workload.


Follow me to keep abreast with the latest technology news, industry insights, and developer trends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store