{"id":20208525,"url":"https://github.com/ivan770/spartan","last_synced_at":"2025-04-10T12:56:30.445Z","repository":{"id":55391163,"uuid":"255635910","full_name":"ivan770/spartan","owner":"ivan770","description":"Feature-rich MQ server, written in Rust","archived":false,"fork":false,"pushed_at":"2021-01-15T10:36:23.000Z","size":1650,"stargazers_count":15,"open_issues_count":4,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-10T08:17:00.453Z","etag":null,"topics":["help-wanted","message","message-queue","mq","rust","rust-lang","rust-library"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ivan770.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-14T14:41:44.000Z","updated_at":"2025-04-05T15:20:43.000Z","dependencies_parsed_at":"2022-08-14T23:10:54.238Z","dependency_job_id":null,"html_url":"https://github.com/ivan770/spartan","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivan770%2Fspartan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivan770%2Fspartan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivan770%2Fspartan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivan770%2Fspartan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivan770","download_url":"https://codeload.github.com/ivan770/spartan/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248222458,"owners_count":21067783,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["help-wanted","message","message-queue","mq","rust","rust-lang","rust-library"],"created_at":"2024-11-14T05:36:00.301Z","updated_at":"2025-04-10T12:56:30.429Z","avatar_url":"https://github.com/ivan770.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eSpartan MQ\u003c/h1\u003e\n\n\u003ch4 align=\"center\"\u003e\n  Documentation (\u003ca href=\"https://ivan770.github.io/spartan/spartan/\"\u003eServer\u003c/a\u003e | \u003ca href=\"https://ivan770.github.io/spartan/spartan_lib/\"\u003eLibrary\u003c/a\u003e) |\n  \u003ca href=\"https://github.com/ivan770/spartan/wiki/REST-API\"\u003eREST API\u003c/a\u003e\n\u003c/h4\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/ivan770/spartan/workflows/Test%20workspace/badge.svg\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  Spartan MQ is a fast and easy to use message queue, written in Rust 🦀\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./images/curl.png\" width=\"75%\"\u003e\n\u003c/p\u003e\n\n## Features\n* SQS-like message dispatching\n* Rich messages, with support for timezone, timeout, delay, max tries, and states\n* Integrated time handling\n* Queue replication\n* Redis-like database persistence using snapshots and logs\n* Background GC that helps you keep your queues tidy\n* Key-based queue authorization\n* Simple API\n\n## Installation\n\n### Download binary from GitHub\n\n1. Download latest release from [GitHub](https://github.com/ivan770/spartan/releases/latest).\n2. Create configuration file using `./spartan init`.\n3. Start server with `./spartan start`.\n\n### Build from source\n\nMake sure you have latest **nightly** Rust toolchain installed on your system.\n\n```\ngit clone https://github.com/ivan770/spartan\ncd spartan\ncargo build --release\n```\n\n## Configuration\n\n### Generic flags\n\n* `--config` - Change configuration file path (default: `Spartan.toml`).\n\n### `start` command flags\n\n* `--host` - Change server host (default: `127.0.0.1:5680`).\n\n### Spartan.toml keys\n\n* `queues` - Array of queue names (required).\n* `body_size` - Max body size in bytes (default: 32 Kb).\n* `gc_timer` - Amount of seconds between each GC job wake (GC cycle times vary, default: `300`).\n* `persistence` - Persistence configuration for both log and snapshot drivers.\n* `access_keys` - Table of queue access keys. Anonymous access to queues will not be permitted if this key has any value.\n* `replication` - Shared replication configuration.\n* `replication.primary` - Primary node configuration.\n* `replication.replica` - Replica node configuration.\n\n#### `persistence`\nThere are two available persistence drivers, that Spartan supports - `log` and `snapshot`.\n\n|                    | `log` | `snapshot`         |\n|--------------------|-------|--------------------|\n| Performance        | -     | +                  |\n| Small disk usage   | -     | +                  |\n| Reliability        | +     | -                  |\n| Compaction support | +     | Always compacted   |\n\nBy default, after executing `spartan init` command you'll receive config with `snapshot` driver, which is an optimal variant for most cases.\n\nBoth drivers support these configuration keys:\n* `mode` - Persistence mode (default: `snapshot`).\n* `path` - Database path (default: `./db`).\n* `timer` - Timer between each queue persistence cycle for `snapshot` driver, and replication storage persistence cycle for `log` (default: 900 seconds).\n* `compaction` - Enable `log` driver compaction on Spartan startup (default: true).\n\n#### `access_keys`\nSpartan has authentication and authorization mechanism using access keys.\n\nTo get access to protected queue, you need to have valid `Authorization` header in your request, with access key in it.\n\nKeys may have multiple queues attached to them (you may also use `*` to create a wildcard key).\n\nExample of configuration:\n```toml\n[[access_keys]]\nkey = \"IHaveAccessToAllQueues\"\nqueues = [\"*\"]\n\n[[access_keys]]\nkey = \"IHaveAccessToTestQueue\"\nqueues = [\"test\"]\n\n[[access_keys]]\nkey = \"HelloWorld\"\nqueues = [\"test\", \"test2\"]\n```\n\nExample of valid HTTP Authorization header:\n```\nAuthorization: Bearer IHaveAccessToAllQueues\n```\n\n#### `replication`\nSpartan also has support for queue replication.\n\nReplication process will be restarted in case of any minor error (protocol or queue config mismatch).\n\nIf there is any problem with TCP socket, then connection will be dropped and re-opened with each replica.\n\n##### Primary\n\nThe following config will start primary node that communicates with one replica every 180 seconds (default value):\n```toml\n[replication]\nmode = \"primary\"\n\n[replication.primary]\ndestination = [\"127.0.0.1:12345\"]\n```\n\nYou may also use `replication_timer` key to change amount of seconds between each replication:\n```toml\n[replication]\nmode = \"primary\"\n\n[replication.primary]\ndestination = [\"127.0.0.1:12345\"]\nreplication_timer = 30\n```\n\n##### Replica\n\nChange your replication config to following example:\n```toml\n[replication]\nmode = \"replica\"\n\n[replication.replica]\nhost = \"127.0.0.1:12345\"\n```\n\nThen, start replica node with `spartan replica` command.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivan770%2Fspartan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivan770%2Fspartan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivan770%2Fspartan/lists"}