Skip to main content

A gRPC-based Saga Orchestration System for distributed transactions

Project description

🧩 grpc-orchestrator

grpc-orchestrator is a lightweight, gRPC-based Saga orchestration system for coordinating distributed transactions across microservices. It helps ensure data consistency by executing a series of steps with compensating rollbacks in case of failures.


🚀 Key Features

  • Saga Pattern Implementation: Coordinates multi-step transactions with compensation support for failures.
  • gRPC-Native Architecture: Fast and type-safe communication using Protocol Buffers and gRPC.
  • Flexible Step Definition: Each step supports service, method, timeout, and optional compensation logic.
  • Asynchronous Orchestration: Steps execute in order, compensation runs in reverse on failure.
  • In-Memory Storage: Ideal for prototyping and testing. Easily swappable for custom persistent backends.
  • Execution Logging: Tracks timestamps, success/failure, payloads, and error messages per step.

📦 Components

1. Protobuf APIs

Defines the orchestrator and participant interfaces:

service SagaOrchestratorService {
  rpc StartSagaTransaction (StartSagaRequest) returns (StartSagaResponse);
  rpc GetSagaStatusTransaction (GetSagaStatusRequest) returns (GetSagaStatusResponse);
}

service SagaParticipant {
  rpc Execute (SagaParticipantRequest) returns (SagaParticipantResponse);
  rpc Compensate (SagaParticipantRequest) returns (SagaParticipantResponse);
}

###pip install grpc_orchestrator

```python

from grpc_orchestrator.core.client.client import GrpcOrchestratorClient

client = GrpcOrchestratorClient(orchestrator_host="localhost")
steps = [
    {
        "port": 50052,
        "rpc_method": "CleateOrder",
        "compensation_method": "RollbackOrder",
        "timeout_seconds": 5,
    },
    {
        "port": 50052,
        "rpc_method": "CheckoutOrder",
        "compensation_method": "CheckoutOrder",
        "timeout_seconds": 5,
    },
]
client.start_transaction(transaction_id="1234",steps=steps,payload={
    "id": "1",
    "name":"item1"
})

status = client.get_transaction_status(transaction_id="order_123")
print(status)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

grpc_orchestrator-0.0.5.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

grpc_orchestrator-0.0.5-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file grpc_orchestrator-0.0.5.tar.gz.

File metadata

  • Download URL: grpc_orchestrator-0.0.5.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for grpc_orchestrator-0.0.5.tar.gz
Algorithm Hash digest
SHA256 c2f70686e4759a7eff4e64e5562cc1f2c9ccd88b87a7632482880474ea308925
MD5 b2c675fddab7cb0d6a28e896ac2c5aca
BLAKE2b-256 244ed65e872a806f7c2904eef1a712c154712f70f429cbed9a6f2c560ef28149

See more details on using hashes here.

File details

Details for the file grpc_orchestrator-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for grpc_orchestrator-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ef74307564b61becc437337adaebcce47703ead3b66b7f04c5a36c9422f9a651
MD5 d60daf9d6cf94b7e20e7f62de160b38e
BLAKE2b-256 57e194f15cdbad2df29facf9a817db9038d86e817fd43387128dc43e55dd82a5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page