$ show apolloconfig/apollo
Apollo is a distributed configuration management system designed for microservices architectures. It provides a centralized web portal (AngularJS frontend with Spring Boot backend) for managing application configurations across multiple environments (DEV, FAT, UAT, PRO, etc.) and clusters. The system supports real-time configuration updates via long-polling, version management, grayscale (canary) releases, role-based access control, and comprehensive audit logging. It exposes REST APIs for programmatic management through an OpenAPI v1 layer and provides client SDKs for various languages. The architecture consists of three main services: apollo-portal (management UI and OpenAPI endpoints), apollo-adminservice (admin CRUD operations), and apollo-configservice (client-facing configuration delivery with long-polling notifications). These services share a common business logic module (apollo-biz) and persist data in MySQL databases (ApolloConfigDB and ApolloPortalDB). The portal communicates with admin services via REST, while clients poll the config service for updates. The system also includes a service registry module for discovery of admin service instances, supporting multiple discovery mechanisms (Eureka, Consul, Nacos, Zookeeper, database, Kubernetes). Key entry points include the portal web UI, OpenAPI v1 endpoints (/openapi/v1/), admin service REST APIs, and config service APIs for client configuration retrieval and notification. The primary data flow involves creating/modifying configurations through the portal or OpenAPI, which are stored in the database. Changes trigger release messages that are scanned by the config service to notify connected clients. Clients then fetch the latest configurations via the config service. The system also supports gray releases, branching, rollback, and configuration import/export. External dependencies include MySQL (primary database), optional service discovery mechanisms (Eureka, Consul, Nacos, Zookeeper, Kubernetes), LDAP/OIDC for authentication, and email/MQ services for notifications. The codebase is modular with clear separation of concerns, extensive test coverage, and a well-defined SPI (Service Provider Interface) pattern for extensibility.
The LLM identified 5 files worth highlighting for reuse:
A thread-safe, case-insensitive multimap implementation using ConcurrentHashMap and ConcurrentHashMap.newKeySet(). It provides efficient key-value storage with case-insensitive key matching and concurrent set factory for thread-safe operations. This component is self-contained and can be reused in any Java project requiring a case-insensitive multimap with thread safety.
A custom exception class with static factory methods for common validation errors (e.g., namespaceNotExists, appAlreadyExists). It extends RuntimeException and provides a clean pattern for structured error responses in REST APIs. The component is self-contained and can be extracted to any Java project for consistent error handling.
A wrapper around Spring RestTemplate that implements retry logic with separate policies for GET (idempotent) and mutating methods. It retries on failures with configurable backoff and failover across multiple admin service instances. This component demonstrates a reusable pattern for resilient HTTP communication and can be adapted to other projects needing retry logic.
A thread-safe cache for gray release rules that supports incremental updates via message handling. It initializes by scanning all rules from the database and updates specific rules when release messages arrive. Uses synchronized blocks for thread-safe cache updates and provides efficient lookup by appId, cluster, and namespace. This pattern is reusable for any caching layer that needs incremental updates from a message queue.
A utility class for validating common input parameters such as appId, cluster name, namespace name, and email. It uses regex patterns and length checks to ensure valid inputs. The component is self-contained and can be reused in any Java project for input validation.