Brief introduction:After more than a year of construction, Matrix now has features such as unified access to multiple channels, third-party ecological interconnection, and scenario-based encapsulation of characteristic fund transactions. Matrix enables users to understand risks and investments in terms of technology and experience by building high-quality and warm company, so as to continuously create value for customers.



The author is an architect of Internet Finance Department of Boshi Fund and a development supervisor of Internet Finance Department of Zeng Zhiboshi Fund

With the impressive performance in the past two years, the public offering fund has witnessed the development of riding the wind and waves. By the end of January 2021, the asset management scale has exceeded 20 trillion yuan, hitting a record high.

In the context of high-quality development of China’s new economy and technological innovation, many financial Internet platforms have cooperated with fund companies. The integration of Internet financial technology and traditional financial business makes the information technology system of traditional financial companies more open.

Accordingly, in 2020, the Internet Finance Department of Boshi Fund started the construction of Matrix, an Internet open platform.

Construction Background and Objectives of Matrix, an Internet Open Platform of Boshi Foundation

1. Problems and challenges encountered by traditional financial architecture

The traditional financial system architecture is challenged by Internetization, which is mainly manifested in the following aspects:

1) Lack of Internet access control

There are multiple teams providing different forms of Internet services, with inconsistent interface protocols and access control methods. As more and more services and interfaces grow, the problem of inadequate API governance will become apparent.

2) The system is relatively closed with insufficient opening capacity

The traditional fund industry system ecology is relatively closed, and the ability to open the ecology with partners needs to be improved.

3) Insufficient financial scenario packaging capability

Traditional fund industry systems generally rely on ACID features provided by the underlying database to achieve transaction consistency. After the micro-service, this mechanism for the financial scenario of product packaging capacity appears to be limited.

2. System construction objectives

1) Unified security access through multiple channels

Provide standardized and unified access for its own system and operating manufacturers, and realize unified control of internal and external API.

Matrix is open for use by third-party platforms certified by Boshi Internet platforms, and it needs to conduct interface level authority control according to different identities identified by the third-party platforms.

2) Provide openness

Build an open platform and build an open ecology with partners. After being authorized by Matrix Platform, developers of the third-party platform can provide the third-party platform with comprehensive services such as fund product information inquiry, registration and account opening, points exchange, fund redemption, assets inquiry, joint login and so on by using the interface capability of BoShi Fund Internet open platform. The third-party platform can freely choose or combine APP, WeChat official account, WeChat applet, H5 and other front-end methods for connection according to its own actual situation.

3) encapsulate the characteristics of the fund industry

The application layer implements the distributed transaction framework to ensure the consistency of the whole transaction. Based on this, it encapsulates complex financial scenario functions such as discount purchase and investment company, so that developers can focus on business development and improve customers’ investment experience.

Matrix Construction Ideas

1. Overall structure

1) Internet architecture diagram

Based on the Spring Cloud microservice suite and RocketMQ messaging middleware, the enterprise Cloud native architecture is built.

2. Key components

1) API gateway

API gateway is one of the important components of microservice architecture, and it is the only portal of service. The API gateway encapsulates the internal system architecture and horizontally removes common functions, such as permission checking, fuse limiting, load balancing, etc. Through the API gateway can be the internal API unified control.



At present, Internet business access of Boshi Fund is mainly divided into three categories:

  • Boshi Fund mobile terminal APP and H5 for self-supporting business.
  • OpenAPI for partners. In other words, as the entrance of the open platform, the OpenAPI of the service will provide conditional access restrictions (time, flow, frequency), and the management of flow control, security authentication, and interface authorization needs to be considered.
  • API for enterprise internal management system, providing access to enterprise internal system.

Matrix’s API Gateway is built based on Spring Cloud Gateway. The built-in Route, Predicate and Filter modules of SCG can facilitate the expansion of cross-section functions such as Route forwarding and unified authentication. Based on the requirement of internal and external network isolation, we independently deployed two sets of gateways, among which the Kylin gateway provides Internet access. Phoenix Gateway is used for intra-domain system access and provides access control for domain accounts.

2) Certification Center

In order to protect the security of OpenAPI and avoid security risks caused by malicious access, unauthorized access and hacker attack, the open platform needs to add authorization authentication module. At the same time, there is also the need for single sign-on between the internal application systems of the blog. A unified certification authority is an essential component of a microservices architecture.

Matrix builds a unified authentication center based on OAuth2 protocol, which realizes the unified authentication and authentication of users, applications and interfaces. The core idea of OAuth2 is to authenticate the user’s identity through various authentication means and issue tokens, so that third-party applications can use the tokens to access the specified resources in a limited time and range. Matrix supports OAuth2’s Authorization Code, Resource Owner Credentials and Client Credentials. Different authorization types are used to issue tokens to protect the security of the open platform.

3) RocketMQ messaging middleware

Technology selection

In the process of technology selection, we mainly consider the following points:

The first must be domestic products, and the second is more popular and high community active open source products.

Also, focus on the MQ features:

  • Reliable message delivery, that is, to ensure that the message is not lost.
  • Distributed transactions, the need to support distributed transactions to reduce the complexity of the business.
  • Performance: Our scenario is mainly an online financial business, which requires MQ to have the low latency feature to support financial level.

In the end, from an architectural evolution perspective, we chose RocketMQ to seamlessly align our hybrid cloud architecture.

RocketMQ is an independent research and development of Alibaba and the core link messaging product of Singles’ Day transaction, providing highly reliable messaging services of financial level. On the open source side, RocketMQ has completed the integration of cloud native technology stack, including event source in Knative, Exporter of Prometheus, Operator of K8S, etc. It also supports SpringCloud, a microservice framework, and OpenWhisk, a function computing framework. At the same time, many connectors have been developed as sinks or sources to connect Elk, Flume, Flink, Hadoop and other excellent open Source products in the field of big data and data analysis.

RocketMQ has three main scenarios for use on the Matrix open platform.

1) Scenarialized packaging of financial products

Business scenario:

Typical business scenarios such as discount purchase, basic people through the discount purchase function to subscribe to the fund, the transaction rate can be reduced to 0. In simple terms, it is the first to buy Bo money fund, and then buy target fund through the means of rapid repurchase, exemption of relevant conversion rate.

Implementation Principle:

Matrix builds a highly reliable and highly available transaction message platform — transaction center based on RocketMQ transaction messages, which involves the following business processes:

The first stage is Prepare, where the business system sends RocketMQ’s semi-transactional message to the transaction center. The transaction center does not publish and waits for a second confirmation. After the Prepare is completed, the business system executes the master transaction, that is, buys the money fund. After the Prepare is successful, it commits to the transaction center, and the transaction center delivers the message to the slave transaction. If the primary transaction fails, a ROLLBACK is posted to the transaction center.



Anti-check mechanism:

The secondary acknowledgement of transaction messages may be lost due to network jitter, business system restart and other reasons. At this point, we need to rely on the anti-lookup mechanism to restore the context of the entire distributed transaction. The Message Status Check mechanism provided by RocketMQ is designed to solve the timeout problem in distributed transactions. The process of the anti-lookup mechanism of the transaction center is to check the internal state of the transaction center first, and then check the execution result of local transactions through the anti-lookup interface. After the transaction context is restored, the subsequent process is normally advanced.



Relating on RocketMQ’s transaction messages, the transaction center implements distributed transactions at the application level, which greatly improves the ability to scenario-wrap financial products.

2) Used for decoupling between systems

Business scenario:

Department A is responsible for the output of high-quality accompanying contents according to the market, products and customers’ accompanying scenarios, while Department B is responsible for reaching these accompanying contents to different channels and users.

Implementation Principle:

RocketMQ messages are used for business decoupling between A’s companion event triggering service and B’s companion touch service, that is, the two parties have no dependencies and do not have to be online at the same time.



3) Asynchronous call

Business scenario:

Asynchronous invocation is used in many scenarios, such as user registration, user key behavior tracking, etc. In the user behavior tracking scenario, key behaviors and related attributes of users are recorded asynchronously on the server side, which can lay a foundation for hierarchical operation and precision marketing of users.

Implementation Principle:

Asynchronous non-core business processes can reduce the response time of the system and improve the throughput, which is a common method of system optimization. RocketMQ provides an efficient communication mechanism that makes business systems very easy to use.

Summary and future outlook

With the continuous penetration of Internet technology in the financial field and the development of financial innovation, the Internet business of public offering funds needs continuous process transformation, model innovation and service capability upgrading. On the basis of optimizing scene experience, the Internet service platform based on the trinity of platform, scene and product should be continuously built.

After more than a year of construction, Matrix now has features such as unified access to multiple channels, third-party ecological interconnection, and scenario-based encapsulation of characteristic fund transactions. Matrix enables users to understand risks and investments in terms of technology and experience by building high-quality and warm company, so as to continuously create value for customers.

In the future, there will be more partners to join Matrix. I hope we can swim together in the sea of innovative technology and achieve win-win cooperation.

To learn more about RocketMQ, join the community exchange group, which is called the Tailu.com Group, and you are welcome to add your comments.

Copyright Notice:The content of this article is contributed by Aliyun real-name registered users, and the copyright belongs to the original author. Aliyun developer community does not own the copyright and does not bear the corresponding legal liability. For specific rules, please refer to User Service Agreement of Alibaba Cloud Developer Community and Guidance on Intellectual Property Protection of Alibaba Cloud Developer Community. If you find any suspected plagiarism in the community, fill in the infringement complaint form to report, once verified, the community will immediately delete the suspected infringing content.