TCC-TRANSACTION Documentation

repository·master-2.x·Indexed 27 days ago

https://github.com/changmingxie/tcc-transaction

An open-source distributed transaction solution for microservice architectures implementing the Try-Confirm-Cancel pattern to ensure eventual consistency. The system includes tcc-transaction-server for backend operations and tcc-transaction-dashboard for managing transaction events, tasks, and domains. It supports Redis Cluster storage via JedisClusterTransactionStorage and provides a web-based management interface for monitoring and manipulating distributed transactions.

Tokens
3K
Snippets
1
Records
28
Agent score
88%

What's inside TCC-TRANSACTION

  1. Understand the TCC Distributed Transaction Model

    master-2.x

    TCC-TRANSACTION is an open-source solution for TCC-style (Try-Confirm-Cancel) distributed transactions in microservice architectures. It ensures high performance and eventual consistency across multiple services and databases using a three-phase approach:

    1. Try: Executes the business logic, performs all necessary consistency checks, and reserves the required business resources (providing quasi-isolation).
    2. Confirm: Executes the business logic using the resources reserved during the Try phase. It performs no additional business checks and must be idempotent.
    3. Cancel: Releases the business resources reserved during the Try phase. This operation must also be idempotent.

    If all Try operations succeed, the system proceeds to the Confirm phase. If any Try operation fails, the system proceeds to the Cancel phase to roll back the reserved resources.

  2. Get Started with TCC-TRANSACTION

    master-2.x

    To begin using TCC-TRANSACTION, refer to the official documentation for setup guides, tutorials, and version-specific information:

  3. Manage public assets and URLs

    master-2.x

    The development server is configured to serve physical files only from the public directory.

    • To reference files in the public folder within index.html, use the %PUBLIC_URL% prefix (e.g., <link rel="icon" href="%PUBLIC_URL%/favicon.ico">).
    • To access the public URL in JavaScript code, use process.env.PUBLIC_URL.

    Note: It is recommended to import images and other assets directly from src via JavaScript/Webpack rather than placing them in public whenever possible.

  4. Requirements for running the Dashboard

    master-2.x

    To successfully run the dashboard via startup.sh, ensure the following:

    1. Java Environment: JAVA_HOME must be set, or a valid java executable must be available in your path. JDK 8 or later is recommended.
    2. Directory Structure: The script expects to be run from a location where it can resolve the ${BASE_DIR} (one level up from the bin directory) to find lib/, conf/, and logs/.
    3. Permissions: Ensure the script has execution permissions (chmod +x startup.sh).
  5. Start the TCC Transaction Dashboard

    master-2.x

    Use the startup.sh script located in the dashboard/bin/ directory to launch the TCC transaction dashboard. The script requires a Java environment (JDK 8 or later is recommended) and will automatically attempt to locate JAVA_HOME if it is not already set in your environment.

    Logs are written to the ${BASE_DIR}/logs/start.out file. The dashboard runs in the background using nohup.

  6. Configure Webpack Dev Server environment variables

    master-2.x

    The tcc-transaction-admin-web development server can be configured using several environment variables to control the host and WebSocket connection for hot reloading:

    • HOST: The hostname to serve the dev server on (defaults to 0.0.0.0).
    • WDS_SOCKET_HOST: The hostname for the WebSocket connection used by the hot reloading server.
    • WDS_SOCKET_PATH: The pathname for the WebSocket connection (defaults to /sockjs-node).
    • WDS_SOCKET_PORT: The port for the WebSocket connection.
    • DANGEROUSLY_DISABLE_HOST_CHECK: Set to true to force-disable the host check, which is useful for development in cloud environments or using subdomains when a proxy is configured.