All Projects → sky-uk → kafka-message-scheduler

sky-uk / kafka-message-scheduler

Licence: BSD-3-Clause License
Scheduler for delayed messages to Kafka topics

Programming Languages

scala
5932 projects

Projects that are alternatives of or similar to kafka-message-scheduler

swordfish
Open-source distribute workflow schedule tools, also support streaming task.
Stars: ✭ 35 (+59.09%)
Mutual labels:  scheduler
su-downloader3
nodejs HTTP downloader with pause/resume support and segmented downloading
Stars: ✭ 14 (-36.36%)
Mutual labels:  scheduler
php-cron-expr
Ultra lightweight, Dependency free and Super Fast Cron Expression parser for PHP
Stars: ✭ 42 (+90.91%)
Mutual labels:  scheduler
pink
分布式任务调度平台
Stars: ✭ 61 (+177.27%)
Mutual labels:  scheduler
bitnami-docker-airflow-scheduler
Bitnami Docker Image for Apache Airflow Scheduler
Stars: ✭ 19 (-13.64%)
Mutual labels:  scheduler
spring-boot-scheduler-example
The project demonstrates how to schedule tasks with Spring Boot using the @scheduled annotation
Stars: ✭ 27 (+22.73%)
Mutual labels:  scheduler
scheduler
Task Scheduler for Laravel applications. UI from scratch
Stars: ✭ 18 (-18.18%)
Mutual labels:  scheduler
WSPRBeacon
Arduino Firmware for the Zachtek WSPR Desktop Transmitter. Coordinated global WSPR transmissions for synchronized weak signal Beacon operation.
Stars: ✭ 18 (-18.18%)
Mutual labels:  scheduler
granitic
Web/micro-services and IoC framework for Golang developers
Stars: ✭ 32 (+45.45%)
Mutual labels:  scheduler
linda
Linda is a simple dispatcher library.
Stars: ✭ 12 (-45.45%)
Mutual labels:  scheduler
CoopThreads
Lightweight, platform agnostic, stackful cooperative threads library.
Stars: ✭ 18 (-18.18%)
Mutual labels:  scheduler
Python-notes
Python related technologies used in work: crawler, data analysis, timing tasks, RPC, page parsing, decorator, built-in functions, Python objects, multi-threading, multi-process, asynchronous, redis, mongodb, mysql, openstack, etc.
Stars: ✭ 104 (+372.73%)
Mutual labels:  scheduler
resc
A task orchestrator using redis, written in rust
Stars: ✭ 27 (+22.73%)
Mutual labels:  scheduler
scheduler-framework-sample
This repo is a sample for Kubernetes scheduler framework.
Stars: ✭ 35 (+59.09%)
Mutual labels:  scheduler
sgx-orchestrator
SGX-aware container orchestrator
Stars: ✭ 35 (+59.09%)
Mutual labels:  scheduler
asparagus
An easy to use task scheduler for distributed systems
Stars: ✭ 14 (-36.36%)
Mutual labels:  scheduler
route53-dynamic-dns
Update AWS Route53 hosted zone with current public IP address. Alternative to Dynamic DNS services such as Dyn, No-IP, etc
Stars: ✭ 29 (+31.82%)
Mutual labels:  scheduler
yerbie
A blazing fast job queue built for ease of use and scalability
Stars: ✭ 16 (-27.27%)
Mutual labels:  scheduler
mesos-framework
A wrapper around the Mesos HTTP APIs for Schedulers and Executors. Write your Mesos framework in pure JavaScript!
Stars: ✭ 61 (+177.27%)
Mutual labels:  scheduler
threadpool
Golang simple thread pool implementation
Stars: ✭ 68 (+209.09%)
Mutual labels:  scheduler

Kafka Message Scheduler

This application is a scheduler for low-frequency and long-term scheduling of delayed messages to Kafka topics.

Background

This component was initially designed for Sky's metadata ingestion pipeline. We wanted to manage content expiry (for scheduled airings or on-demand assets) in one single component, instead of implementing the expiry logic on all consumers.

Given that the pipeline is based on Kafka, it felt natural to use it as input, output and data store.

How it works

The Kafka Message Scheduler (KMS for short) consumes messages from configured source (schedule) topics. On this topic:

  • message keys are "Schedule IDs" - string values, with an expectation of uniqueness
  • message values are Schedule messages, encoded in Avro binary format according to the Schema.

A schedule is composed of:

  • The topic you want to send the delayed message to
  • The timestamp telling when you want that message to be delivered
  • The actual message to be sent, both key and value

The KMS is responsible for sending the actual message to the specified topic at the specified time.

The Schedule ID can be used to delete a scheduled message, via a delete message (with a null message value) in the source topic.

Startup logic

When the KMS starts up it uses the kafka-topic-loader to consume all messages from the configured schedule-topics and populate the scheduling actors state. Once this has completed, all of the schedules loaded are scheduled and the application will start normal processing. This means that schedules that have been fired and tombstoned, but not compacted yet, will not be replayed during startup.

Schema

To generate the avro schema from the Schedule case class, run sbt schema. The schema will be written to avro/target/schemas/schedule.avsc.

How to run it

Start services

docker-compose pull && docker-compose up -d

Send messages

With the services running, you can send a message to the defined scheduler topic (scheduler in the example above). See the Schema section for details of generating the Avro schema to be used.

Monitoring

Metrics are exposed and reported using Kamon. By default, the Kamon Prometheus reporter is used for reporting and the scraping endpoint for Prometheus is exposed on port 9095 (this is configurable by setting the PROMETHEUS_SCRAPING_ENDPOINT_PORT environment variable).

Prometheus is included as part of the docker-compose and will expose a monitoring dashboard on port 9090.

Topic configuration

The schedule-topics must be configured to use log compaction. This is for two reasons:

  1. to allow the scheduler to delete the schedule after it has been written to its destination topic.
  2. because the scheduler uses the schedule-topics to reconstruct its state - in case of a restart of the KMS, this ensures that schedules are not lost.

Recommended configuration

It is advised that the log compaction configuration of the schedule-topics is quite aggressive to keep the restart times low, see below for recommended configuration:

cleanup.policy: compact
delete.retention.ms: 3600000
min.compaction.lag.ms: 0
min.cleanable.dirty.ratio: "0.1"
segment.ms: 86400000
segment.bytes: 100000000

Limitations

Until this issue is addressed the KMS does not fully support horizontal scaling. Multiple instances can be run, and Kafka will balance the partitions, however schedules are likely to be duplicated as when a rebalance happens the state for the rebalanced partition will not be removed from the original instance. If there is a desire to run multiple instances before that issue is addressed, it is best to not attempt dynamic scaling, but to start with your desired number of instances.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].