{"id":21859631,"url":"https://github.com/yarhrn/rozklad","last_synced_at":"2026-03-01T13:37:17.028Z","repository":{"id":57684225,"uuid":"458614605","full_name":"yarhrn/rozklad","owner":"yarhrn","description":"simple persistent task queue for Scala","archived":false,"fork":false,"pushed_at":"2025-05-12T21:01:47.000Z","size":164,"stargazers_count":1,"open_issues_count":7,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-21T01:36:57.448Z","etag":null,"topics":["task-queue"],"latest_commit_sha":null,"homepage":"","language":"Scala","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/yarhrn.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-02-12T19:06:40.000Z","updated_at":"2025-05-12T20:48:15.000Z","dependencies_parsed_at":"2023-11-12T23:26:59.803Z","dependency_job_id":"c09a80ed-6cf1-438d-bb8e-ecf0a8d1a5aa","html_url":"https://github.com/yarhrn/rozklad","commit_stats":null,"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"purl":"pkg:github/yarhrn/rozklad","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yarhrn%2Frozklad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yarhrn%2Frozklad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yarhrn%2Frozklad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yarhrn%2Frozklad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yarhrn","download_url":"https://codeload.github.com/yarhrn/rozklad/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yarhrn%2Frozklad/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29970517,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T13:32:00.443Z","status":"ssl_error","status_checked_at":"2026-03-01T13:32:00.084Z","response_time":124,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["task-queue"],"created_at":"2024-11-28T02:57:58.930Z","updated_at":"2026-03-01T13:37:12.009Z","avatar_url":"https://github.com/yarhrn.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rozklad\n\nRozklad(means schedule in Ukrainian) is persistent Postgresql based task-queue with delayed execution. Core capabilities:\n- schedule task to be executed in the future\n- executor that is reading from DB and executing all scheduled tasks (supports multi-node deployment, concurrency is handled by Postgresql)\n\n## Install\n![version](https://jitpack.io/v/yarhrn/rozklad.svg)\n\n```scala\nresolvers += \"jitpack\" at \"https://jitpack.io\"\nlibraryDependencies += \"com.github.yarhrn\" % \"rozklad\" % \"{take version from badge above}\"\t\n```\n\n## Usage\n### Scheduling\nTo schedule a task instance of `TaskScheduler[F[_]]` is required. \nTo obtain instance of `TaskScheduler[F[_]]` you can provide `doobie.Transactor[F[_]]` to the `new DoobieTaskScheduler[F[_]](tx)`.\n\nThen you can schedule a task by calling `TaskScheduler.schedule`.\n`TaskScheduler.schedule` accepts:\n- `id` - task identifier, e.g. rozkald.api.Id.random\n- `triggerAt`: Instant - point in time after which task should be executed\n- `scheduledAt`: Instant - point in time when task is scheduled, e.g. Instant.now\n- `payload`: JsValue - some task specific data\n### Rescheduling\nTo support different workflows starting from 1.0.0 added capability to \"reschedule\" tasks.\nRescheduling is done via `TaskScheduler.schedule` method. \nRescheduling will occur in case there is scheduled task with the same id and status of task is one of `Created`, `Failed`, `Successful` or `Rescheduled`.\nTo introspect history of task use `ScheduledTaskService.logs`. During rescheduling it is possible to update task's trigger at time and payload.\n\n\n### Executing\nThere are two ways how scheduled tasks can be executed.\n\nLow-level approach gives you full control on acquiring and committing task result. `ScheduledTaskService[F[_]]` (`DoobieScheduledTaskService\n`) allows you to:\n- `acquireBatch` - atomically and concurrently-safe acquire some number of tasks\n- `done` - mark task as successful\n- `failed` - mark task as failed\n\nTo obtain instance of `ScheduledTaskService[F[_]]` you can provide `doobie.Transactor[F[_]]` to the `DoobieScheduledTaskService[F[_]]`.\n\n\nScheduledTask.status([enum](https://github.com/yarhrn/rozklad/blob/main/src/main/scala/api/ScheduledTask.scala#L29)) lifecycle diagram\n```mermaid\nflowchart TD\n    initial --\u003e created \n    created --\u003e acquired\n    acquired --\u003e successful\n    acquired --\u003e failed\n    created --\u003e rescheduled\n    failed --\u003e rescheduled\n    successful --\u003e rescheduled\n    rescheduled --\u003e rescheduled\n    rescheduled --\u003e acquired\n```\n\nHigh-level approach is done via `rozklad.api.ExecutorService.start` that accepts \n`rozklad.api.ScheduledTaskExecutor` - client provided way of how `ScheduledTask` should be executed.\nIt is implemented as never ending fiber that constantly trying to acquire and execute tasks.\nAlso, there is method `rozklad.api.ExecutorService.stop` for graceful shutdown.\n\n### DB Scheme\nThis library is tested with Postgresql and rely on Postgresql features like `select for update` and `skip locked`.\nLibrary requires proper Postgresql scheme setup:\n```sql\n\ncreate table scheduled_tasks\n(\n    id char(36) primary key not null ,\n    scheduled_at timestamp with time zone not null ,\n    trigger_at timestamp with time zone not null ,\n    status smallint not null ,\n    updated_at timestamp with time zone not null ,\n    failed_reason smallint ,\n    payload jsonb not null\n);\n\ncreate table scheduled_tasks_change_log(\n    id char(36) primary key not null ,\n    task_id char(36) not null ,\n    status smallint not null ,\n    created_at timestamp with time zone not null ,\n    failed_reason smallint ,\n    payload jsonb not null ,\n    trigger_at timestamp with time zone not null\n);\n\ncreate index scheduled_tasks_status_trigger_at_index\n    on scheduled_tasks (status, trigger_at);\n```\n### Migration\nfrom 1.0.2 to 1.0.3\n```sql\ndrop index if exists scheduled_tasks_change_log;\ncreate index scheduled_tasks_status_trigger_at_index\n    on scheduled_tasks (status, trigger_at);\n```\n\nfrom 0.14 to 1.0.0\n```sql\nalter table scheduled_tasks_change_log\n    add column trigger_at timestamp with time zone default null;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyarhrn%2Frozklad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyarhrn%2Frozklad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyarhrn%2Frozklad/lists"}