Skip to content

Modules Overview

Simba is organized as a multi-module Gradle project. Each module has a focused responsibility, from core abstractions to backend-specific implementations and Spring Boot auto-configuration.

Module Dependency Graph

mermaid
graph TB
    subgraph sg_24 ["Build & Analysis"]

        BOM["simba-bom"]
        DEPS["simba-dependencies"]
        CR["code-coverage-report"]
    end
    subgraph sg_25 ["Application"]

        EX["simba-example"]
    end
    subgraph sg_26 ["Spring Boot"]

        STARTER["simba-spring-boot-starter"]
    end
    subgraph sg_27 ["Backend Implementations"]

        JDBC["simba-jdbc"]
        REDIS["simba-spring-redis"]
        ZK["simba-zookeeper"]
    end
    subgraph sg_28 ["Core"]

        CORE["simba-core"]
        TEST["simba-test"]
    end

    CORE --> DEPS
    JDBC --> CORE
    REDIS --> CORE
    ZK --> CORE
    STARTER --> CORE
    STARTER -.->|"springRedisSupport"| REDIS
    STARTER -.->|"jdbcSupport"| JDBC
    STARTER -.->|"zookeeperSupport"| ZK
    TEST --> CORE
    EX --> STARTER
    CR --> JDBC
    CR --> REDIS
    CR --> ZK
    CR --> STARTER
    CR --> CORE
    CR --> TEST

    style BOM fill:#2d333b,stroke:#6d5dfc,color:#e6edf3
    style DEPS fill:#2d333b,stroke:#6d5dfc,color:#e6edf3
    style CR fill:#2d333b,stroke:#6d5dfc,color:#e6edf3
    style EX fill:#2d333b,stroke:#6d5dfc,color:#e6edf3
    style STARTER fill:#2d333b,stroke:#6d5dfc,color:#e6edf3
    style JDBC fill:#2d333b,stroke:#6d5dfc,color:#e6edf3
    style REDIS fill:#2d333b,stroke:#6d5dfc,color:#e6edf3
    style ZK fill:#2d333b,stroke:#6d5dfc,color:#e6edf3
    style CORE fill:#2d333b,stroke:#6d5dfc,color:#e6edf3
    style TEST fill:#2d333b,stroke:#6d5dfc,color:#e6edf3

Module Catalogue

ModuleRoleKey TypesDependencies
simba-coreCore interfaces, abstract classes, value objectsMutexContender, MutexContendService, SimbaLocker, AbstractSchedulerkotlin-logging, cosid-core, guava
simba-jdbcJDBC/MySQL backend with optimistic lockingJdbcMutexContendService, JdbcMutexOwnerRepositorysimba-core, JDBC driver
simba-spring-redisRedis backend with Lua scripts and pub/subSpringRedisMutexContendService, Lua scriptssimba-core, spring-data-redis
simba-zookeeperZookeeper backend using Curator LeaderLatchZookeeperMutexContendServicesimba-core, curator-recipes
simba-spring-boot-starterAuto-configuration for all backendsSimbaJdbcAutoConfiguration, SimbaSpringRedisAutoConfiguration, SimbaZookeeperAutoConfigurationsimba-core + conditional backend deps
simba-testTCK (Technology Compatibility Kit)MutexContendServiceSpec, LockSpecsimba-core, JUnit 5
simba-bomBOM (Bill of Materials) for version management----
simba-dependenciesDependency version constraints----
simba-exampleExample applicationExampleAppsimba-spring-boot-starter
code-coverage-reportJaCoCo aggregated report--all modules

Backend Comparison

mermaid
graph LR
    subgraph sg_29 ["JDBC Backend"]

        J_REPO["MutexOwnerRepository"]
        J_SCHED["ScheduledThreadPoolExecutor<br>(polling)"]
        J_DDL["simba_mutex table<br>optimistic locking"]
    end
    subgraph sg_30 ["Redis Backend"]

        R_LUA["Lua Scripts<br>acquire/guard/release"]
        R_PS["Pub/Sub<br>RedisMessageListenerContainer"]
        R_ZSET["Sorted Set<br>contender queue"]
    end
    subgraph sg_31 ["Zookeeper Backend"]

        Z_LATCH["LeaderLatch<br>/simba/{mutex}"]
        Z_CUR["CuratorFramework"]
    end

    style J_REPO fill:#2d333b,stroke:#6d5dfc,color:#e6edf3
    style J_SCHED fill:#2d333b,stroke:#6d5dfc,color:#e6edf3
    style J_DDL fill:#2d333b,stroke:#6d5dfc,color:#e6edf3
    style R_LUA fill:#2d333b,stroke:#6d5dfc,color:#e6edf3
    style R_PS fill:#2d333b,stroke:#6d5dfc,color:#e6edf3
    style R_ZSET fill:#2d333b,stroke:#6d5dfc,color:#e6edf3
    style Z_LATCH fill:#2d333b,stroke:#6d5dfc,color:#e6edf3
    style Z_CUR fill:#2d333b,stroke:#6d5dfc,color:#e6edf3
FeatureJDBCRedisZookeeper
Coordination mechanismPoll with ScheduledThreadPoolExecutorLua scripts + pub/subCurator LeaderLatch
Lock storagesimba_mutex tableRedis key (simba:{mutex})ZNode (/simba/{mutex})
Ownership transferOptimistic locking via version columnSorted set wait queue + pub/sub notificationZK watcher on latch participants
Time sourceMySQL current_timestamp(3)System clock (client-side)ZK server time
External dependencyMySQL instanceRedis instanceZooKeeper ensemble
Best forExisting relational DB infrastructureHigh-throughput, low-latencyStrong consistency guarantees

Gradle Feature Variants

The simba-spring-boot-starter uses Gradle feature variants so consumers only pull the backend dependency they need:

kotlin
dependencies {
    // Pull only the Redis backend
    implementation("me.ahoo.simba:simba-spring-boot-starter") {
        capabilities {
            requireCapability("me.ahoo.simba:spring-redis-support")
        }
    }
}

Available feature variants:

VariantCapabilityBackend Module
springRedisSupportme.ahoo.simba:spring-redis-supportsimba-spring-redis
jdbcSupportme.ahoo.simba:jdbc-supportsimba-jdbc
zookeeperSupportme.ahoo.simba:zookeeper-supportsimba-zookeeper

See Also

Released under the Apache License 2.0.