### Start Local Development Server Source: https://github.com/sofastack/sofa-registry/blob/master/CONTRIBUTING.md Start an all-in-one server for local development using the 'dev' profile. ```bash cd server/server/integration mvn spring-boot:run -Dspring.profiles.active=dev ``` -------------------------------- ### Example Commit Messages Source: https://github.com/sofastack/sofa-registry/blob/master/CONTRIBUTING.md Illustrative examples of commit messages following the specified format, including module prefixes and issue tracking. ```bash [session] Fix connection timeout handling The previous implementation did not properly handle timeouts when the meta server was unreachable. Fixes #456 ``` ```bash [client] Add retry mechanism for failed registrations ``` -------------------------------- ### Start Sofa-Registry with Docker Compose Source: https://github.com/sofastack/sofa-registry/blob/master/docker/compose/README.md Use this command to start Sofa-Registry services in detached mode using the specified Docker Compose file. ```shell docker-compose -f sofa-registry-in-docker-compose.yml up -d ``` -------------------------------- ### Build Project Source: https://github.com/sofastack/sofa-registry/blob/master/CONTRIBUTING.md Build the entire project, skipping tests, or build a specific module. Also includes generating protobuf classes. ```bash mvn clean install -DskipTests # Build specific module mvn clean install -DskipTests -pl server/server/meta -am # Generate protobuf classes make proto ``` -------------------------------- ### Clone Repository and Verify Environment Source: https://github.com/sofastack/sofa-registry/blob/master/CONTRIBUTING.md Clone the SOFARegistry repository and verify that your Java and Maven versions meet the prerequisites. ```bash git clone https://github.com/sofastack/sofa-registry.git cd sofa-registry java -version # Should be 1.8.x mvn -version # Should be 3.2.5+ ``` -------------------------------- ### SOFARegistry Build and Test Commands Source: https://github.com/sofastack/sofa-registry/blob/master/AGENTS.md Common development commands for building, testing, and generating artifacts for the SOFARegistry project using Maven and Make. ```bash # Build (skip tests) mvn clean install -DskipTests # Run unit tests mvn test # Run integration tests mvn verify -Pintegration-test # Run single test class mvn test -Dtest=ClassName # Generate protobuf make proto # Build Docker image make image_build ``` -------------------------------- ### Session Server Batching Configuration Source: https://github.com/sofastack/sofa-registry/blob/master/Session-Auto-Batching-Duration.md Configure basic and auto-tuning batching parameters for the SOFARegistry Session server in the application.properties file. ```properties # Basic batching parameters session.server.data.change.debouncing.millis=1000 session.server.data.change.max.debouncing.millis=3000 session.server.push.data.task.debouncing.millis=500 # Auto-tuning parameters session.server.push.efficiency.auto.enable=false session.server.push.efficiency.debouncing.time.enable=false session.server.push.efficiency.debouncing.time.max=1000 session.server.push.efficiency.debouncing.time.min=100 session.server.push.efficiency.debouncing.time.step=100 session.server.push.efficiency.max.debouncing.time.enable=false session.server.push.efficiency.max.debouncing.time.max=3000 session.server.push.efficiency.max.debouncing.time.min=1000 session.server.push.efficiency.max.debouncing.time.step=200 ``` -------------------------------- ### Branch Naming Conventions Source: https://github.com/sofastack/sofa-registry/blob/master/CONTRIBUTING.md Follow a structured format for branch names, indicating the type of change and a short description. ```bash / Examples: feature/add-health-check-api fix/session-timeout-issue docs/update-readme refactor/simplify-push-logic ``` -------------------------------- ### Run Unit Tests Source: https://github.com/sofastack/sofa-registry/blob/master/CONTRIBUTING.md Execute all unit tests, a specific test class, or run tests with debug output enabled. ```bash mvn test # Run specific test class mvn test -Dtest=YourTestClass # Run with debug output mvn test -Dtest=YourTestClass -Dtest.logging.level=DEBUG ``` -------------------------------- ### Use Project Logger Source: https://github.com/sofastack/sofa-registry/blob/master/CONTRIBUTING.md Always use the project's logger (LoggerFactory) instead of SLF4J directly. Use parameterized logging for better performance and clarity. ```java // Use project logger, not SLF4J directly import com.alipay.sofa.registry.log.Logger; import com.alipay.sofa.registry.log.LoggerFactory; private static final Logger LOGGER = LoggerFactory.getLogger(MyClass.class); // Use parameterized logging LOGGER.info("Processing request: {}, count: {}", requestId, count); // For critical errors CRITICAL_LOGGER.safeError("Fatal error: {}", message, exception); ``` -------------------------------- ### Run Integration Tests Source: https://github.com/sofastack/sofa-registry/blob/master/CONTRIBUTING.md Execute integration tests, which may take longer, or run a specific integration test class. ```bash mvn verify -Pintegration-test # Run specific integration test mvn test -Dtest=PubSubTest -pl test ``` -------------------------------- ### Default SOFARegistry Configuration Source: https://github.com/sofastack/sofa-registry/blob/master/Session-Auto-Batching-Duration.md This configuration uses default batching settings and has auto-tuning disabled. Suitable for general use cases where specific tuning is not yet required. ```properties # Basic batching changeDebouncingMillis=1000 changeDebouncingMaxMillis=3000 pushTaskDebouncingMillis=500 # Auto-tuning (disabled by default) enableAutoPushEfficiency=false enableDebouncingTime=false enableMaxDebouncingTime=false ``` -------------------------------- ### Java Naming Conventions Source: https://github.com/sofastack/sofa-registry/blob/master/CONTRIBUTING.md Adhere to standard Java naming conventions for classes, methods, variables, constants, and packages. ```java // Classes: PascalCase public class SessionServerBootstrap { } // Methods/Variables: camelCase public void handleRequest() { } private int connectionCount; // Constants: UPPER_SNAKE_CASE public static final int MAX_RETRY_COUNT = 3; // Packages: lowercase package com.alipay.sofa.registry.server.session; ``` -------------------------------- ### Sync with Upstream and Run Local Checks Source: https://github.com/sofastack/sofa-registry/blob/master/CONTRIBUTING.md Before submitting a pull request, fetch upstream changes, rebase your branch, and run local checks including code style, unit tests, and build verification. ```bash git fetch upstream git rebase upstream/master # Code style check mvn pmd:check # Unit tests mvn test # Build verification mvn clean install -DskipTests ``` -------------------------------- ### Low Latency SOFARegistry Configuration Source: https://github.com/sofastack/sofa-registry/blob/master/Session-Auto-Batching-Duration.md This configuration prioritizes low push latency by decreasing batching durations and keeping auto-tuning disabled. It is suitable for applications sensitive to push delays. ```properties # Basic batching changeDebouncingMillis=300 changeDebouncingMaxMillis=1000 pushTaskDebouncingMillis=100 # Auto-tuning (disabled) enableAutoPushEfficiency=false enableDebouncingTime=false enableMaxDebouncingTime=false ``` -------------------------------- ### Commit Message Format Source: https://github.com/sofastack/sofa-registry/blob/master/CONTRIBUTING.md Format commit messages with a module prefix, a short description, and an optional detailed explanation. Include 'Fixes #issue_number' when applicable. ```bash [module] Short description (under 72 chars) Optional longer description explaining the change. - Why is this change necessary? - How does it address the issue? Fixes #123 ``` -------------------------------- ### High Throughput SOFARegistry Configuration Source: https://github.com/sofastack/sofa-registry/blob/master/Session-Auto-Batching-Duration.md This configuration is optimized for high throughput scenarios by increasing batching durations and enabling auto-tuning. It includes settings for minimum and maximum auto-tuning values. ```properties # Basic batching changeDebouncingMillis=1500 changeDebouncingMaxMillis=4000 pushTaskDebouncingMillis=1000 # Auto-tuning (enabled) enableAutoPushEfficiency=true enableDebouncingTime=true debouncingTimeMax=1500 debouncingTimeMin=200 debouncingTimeStep=100 enableMaxDebouncingTime=true maxDebouncingTimeMax=5000 maxDebouncingTimeMin=1500 maxDebouncingTimeStep=200 ``` -------------------------------- ### Handle Exceptions Meaningfully Source: https://github.com/sofastack/sofa-registry/blob/master/CONTRIBUTING.md Catch specific exceptions and log them with relevant details. Avoid swallowing exceptions silently. ```java // Do: Handle exceptions meaningfully try { doSomething(); } catch (SpecificException e) { LOGGER.error("Failed to do something: {}", e.getMessage(), e); throw new RegistryException("Operation failed", e); } // Don't: Swallow exceptions silently try { doSomething(); } catch (Exception e) { // Bad: silent catch } ``` -------------------------------- ### Stop Sofa-Registry with Docker Compose Source: https://github.com/sofastack/sofa-registry/blob/master/docker/compose/README.md Use this command to stop and remove the containers, networks, and volumes defined in the Docker Compose file. ```shell docker-compose -f sofa-registry-in-docker-compose.yml down ``` -------------------------------- ### SOFARegistry Critical Rules Source: https://github.com/sofastack/sofa-registry/blob/master/AGENTS.md These are critical rules to follow when working with generated files and code in the SOFARegistry project. They cover file editing, code compatibility, dependency management, exception handling, thread usage, sensitive data, and test skipping. ```plaintext 1. DO NOT edit generated files in target/ 2. DO NOT delete backward-compatible code without discussion 3. DO NOT add new dependencies without review 4. DO NOT swallow exceptions silently 5. DO NOT create threads directly - use thread pools 6. DO NOT hardcode sensitive data 7. DO NOT skip tests with @Ignore without explanation ``` -------------------------------- ### Check Health of Meta Role Source: https://github.com/sofastack/sofa-registry/blob/master/docker/compose/README.md This command checks the health of the meta role instances. It queries the health check endpoint on port 9615. ```shell # 查看meta角色的健康检测接口:(3台机器,有1台是Leader,其他2台是Follower) $ curl http://localhost:9615/health/check ``` -------------------------------- ### Check Health of Session Role Source: https://github.com/sofastack/sofa-registry/blob/master/docker/compose/README.md This command checks the health of the session role instances. It queries the health check endpoint on port 9603. ```shell # 查看session角色的健康检测接口: $ curl http://localhost:9603/health/check ``` -------------------------------- ### Check Health of Data Role Source: https://github.com/sofastack/sofa-registry/blob/master/docker/compose/README.md This command checks the health of the data role instances. It queries the health check endpoint on port 9622. ```shell # 查看data角色的健康检测接口: $ curl http://localhost:9622/health/check ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.