示例应用简介Introduction to the sample app

在本快速入门中,我们使用名为 PiggyMetrics 的个人财务示例演示如何将应用部署到 Azure Spring Cloud 服务。In this quickstart, we use a personal finances sample called PiggyMetrics to show you how to deploy an app to the Azure Spring Cloud service. PiggyMetrics 演示了微服务体系结构模式并突出显示了服务明细。PiggyMetrics demonstrates the microservice architecture pattern and highlights the services breakdown. 你将了解如何通过强大的 Azure Spring Cloud 功能(包括服务发现、Config Server、日志、指标和分布式跟踪)将其部署到 Azure。You will see how it is deployed to Azure with powerful Azure Spring Cloud capabilities including service discovery, config server, logs, metrics, and distributed tracing.

若要遵循 Azure Spring Cloud 部署示例,只需使用根据需要提供的源代码位置。To follow the Azure Spring Cloud deployment examples, you only need the location of the source code, which is provided as needed.

功能服务Functional services

PiggyMetrics 可分解为三个核心微服务。PiggyMetrics is decomposed into three core microservices. 所有微服务都是由业务域组织的可独立部署的应用程序。All of them are independently deployable applications organized by business domains.

  • 帐户服务(待部署) :包含常规用户输入逻辑和验证:收入/支出项、节省额和帐户设置。Account service (To be deployed): Contains general user input logic and validation: incomes/expenses items, savings, and account settings.
  • 统计信息服务(本快速入门中未使用) :对主要统计信息参数执行计算,并捕获每个帐户的时序。Statistics service (Not used in this quickstart): Performs calculations on major statistics parameters and captures time series for each account. 数据点包含规范化为基本货币和时间段的值。Datapoint contains values, normalized to base currency and time period. 此数据用于跟踪帐户生存期内的现金流动态。This data is used to track cash flow dynamics in account lifetime.
  • 通知服务(本快速入门中未使用) :存储用户联系人信息和通知设置,如提醒和备份频率。Notification service (Not used in this quickstart): Stores users contact information and notification settings, such as remind and backup frequency. 计划的辅助进程从其他服务收集所需的信息,并将电子邮件消息发送给订阅的客户。Scheduled worker collects required information from other services and sends e-mail messages to subscribed customers.

基础结构服务Infrastructure services

分布式系统中有几种常用模式,有助于核心服务的运行。There are several common patterns in distributed systems that help make core services work. Azure Spring Cloud 提供了强大的工具,可增强 Spring Boot 应用程序的行为以实现这些模式:Azure Spring cloud provides powerful tools that enhance Spring Boot applications behavior to implement those patterns:

  • 配置服务(由 Azure Spring Cloud 托管) :Azure Spring Cloud Config 是一种面向分布式系统的可水平缩放的集中式配置服务。Config service (Hosted by Azure Spring Cloud): Azure Spring Cloud Config is a horizontally scalable centralized configuration service for distributed systems. 它使用当前支持本地存储、Git 和 Subversion 的可插入存储库。It uses a pluggable repository that currently supports local storage, Git, and Subversion.
  • 服务发现(由 Azure Spring Cloud 托管) :它允许自动检测服务实例的网络位置,由于自动缩放、故障和升级,可能会有动态分配的地址。Service discovery (Hosted by Azure Spring Cloud): It allows automatic detection of network locations for service instances, which could have dynamically assigned addresses because of autoscaling, failures and upgrades.
  • 授权服务(待部署) 授权责任完全提取到单独的服务器,该服务器为后端资源服务授予 OAuth2 令牌。Auth service (To be deployed) Authorization responsibilities are completely extracted to a separate server, which grants OAuth2 tokens for the backend resource services. Auth Server 在外围中进行用户授权和安全的机器对机器通信。Auth Server does user authorization and secure machine-to-machine communication inside a perimeter.
  • API 网关(待部署) :这三个核心服务向客户端公开外部 API。API Gateway (To be deployed): The three core services expose an external API to client. 在实际系统中,函数的数量可能会随系统的复杂性迅速增长。In real-world systems, the number of functions can grow very quickly with system complexity. 呈现一个复杂的网页可能会涉及数百个服务。Hundreds of services might be involved in rendering of one complex webpage. API 网关是系统中的单个入口点,用于处理请求并将请求路由到相应的后端服务,或调用多个后端服务来聚合结果。The API Gateway is a single entry point into the system, used to handle requests and route them to the appropriate backend service or to invoke multiple backend services, aggregating the results.

PiggyMetrics 的示例用法Sample usage of PiggyMetrics

有关完整的实现详细信息,请参阅 PiggyMetricsFor full implementation details, see PiggyMetrics. 示例根据需要引用源代码。The samples reference the source code as needed.

后续步骤Next steps