All Projects → softwaremill → Kmq

softwaremill / Kmq

Licence: apache-2.0
Kafka-based message queue

Programming Languages

java
68154 projects - #9 most used programming language
scala
5932 projects

Projects that are alternatives of or similar to Kmq

Alpakka Kafka
Alpakka Kafka connector - Alpakka is a Reactive Enterprise Integration library for Java and Scala, based on Reactive Streams and Akka.
Stars: ✭ 1,295 (+441.84%)
Mutual labels:  reactive-streams, kafka, akka
Es Cqrs Shopping Cart
A resilient and scalable shopping cart system designed using Event Sourcing (ES) and Command Query Responsibility Segregation (CQRS)
Stars: ✭ 19 (-92.05%)
Mutual labels:  kafka, akka
Jafka
a fast and simple distributed publish-subscribe messaging system (mq)
Stars: ✭ 697 (+191.63%)
Mutual labels:  kafka, message-queue
Thingsboard
Open-source IoT Platform - Device management, data collection, processing and visualization.
Stars: ✭ 10,526 (+4304.18%)
Mutual labels:  kafka, akka
Scala Kafka Client
Scala helper modules for operating the Apache Kafka client library (0.9.x - 2.1.0)
Stars: ✭ 348 (+45.61%)
Mutual labels:  kafka, akka
Akka Grpc
Akka gRPC
Stars: ✭ 361 (+51.05%)
Mutual labels:  reactive-streams, akka
Toketi Iothubreact
Akka Stream library for Azure IoT Hub
Stars: ✭ 36 (-84.94%)
Mutual labels:  reactive-streams, akka
akka-stream-mon
Throughput and latency monitoring for Akka Streams
Stars: ✭ 23 (-90.38%)
Mutual labels:  akka, reactive-streams
Hydra
A real-time data replication platform that "unbundles" the receiving, transforming, and transport of data streams.
Stars: ✭ 68 (-71.55%)
Mutual labels:  kafka, akka
Clickhouse Scala Client
Clickhouse Scala Client with Reactive Streams support
Stars: ✭ 84 (-64.85%)
Mutual labels:  reactive-streams, akka
Benthos
Fancy stream processing made operationally mundane
Stars: ✭ 3,705 (+1450.21%)
Mutual labels:  kafka, message-queue
Qmq
QMQ是去哪儿网内部广泛使用的消息中间件,自2012年诞生以来在去哪儿网所有业务场景中广泛的应用,包括跟交易息息相关的订单场景; 也包括报价搜索等高吞吐量场景。
Stars: ✭ 2,420 (+912.55%)
Mutual labels:  kafka, message-queue
alpakka-samples
Example projects building Reactive Integrations using Alpakka
Stars: ✭ 61 (-74.48%)
Mutual labels:  akka, reactive-streams
Plumber
A swiss army knife CLI tool for interacting with Kafka, RabbitMQ and other messaging systems.
Stars: ✭ 514 (+115.06%)
Mutual labels:  kafka, message-queue
akka-cookbook
提供清晰、实用的Akka应用指导
Stars: ✭ 30 (-87.45%)
Mutual labels:  akka, reactive-streams
Reactive Serial
Reactive Streams API for Serial Communication
Stars: ✭ 24 (-89.96%)
Mutual labels:  reactive-streams, akka
Every Single Day I Tldr
A daily digest of the articles or videos I've found interesting, that I want to share with you.
Stars: ✭ 249 (+4.18%)
Mutual labels:  kafka, akka
Alpakka
Alpakka is a Reactive Enterprise Integration library for Java and Scala, based on Reactive Streams and Akka.
Stars: ✭ 1,154 (+382.85%)
Mutual labels:  reactive-streams, akka
Enqueue Dev
Message Queue, Job Queue, Broadcasting, WebSockets packages for PHP, Symfony, Laravel, Magento. DEVELOPMENT REPOSITORY - provided by Forma-Pro
Stars: ✭ 1,977 (+727.2%)
Mutual labels:  kafka, message-queue
Akka Rabbitmq
RabbitMq client in Scala and Akka actors
Stars: ✭ 228 (-4.6%)
Mutual labels:  akka, message-queue

Kafka Message Queue

Join the chat at https://gitter.im/softwaremill/kmq Maven Central

Using kmq you can acknowledge processing of individual messages in Kafka, and have unacknowledged messages re-delivered after a timeout.

This is in contrast to the usual Kafka offset-committing mechanism, using which you can acknowledge all messages up to a given offset only.

If you are familiar with Amazon SQS, kmq implements a similar message processing model.

How does this work?

For a more in-depth overview see the blog: Using Kafka as a message queue, and for performance benchmarks: Kafka with selective acknowledgments (kmq) performance & latency benchmark

The acknowledgment mechanism uses a marker topic, which should have the same number of partitions as the "main" data topic (called the queue topic). The marker topic is used to track which messages have been processed, by writing start/end markers for every message.

message flow diagram

Using kmq

An application using kmq should consist of the following components:

  • a number of RedeliveryTrackers. This components consumes the marker topic and redelivers messages if appropriate. Multiple copies should be started in a cluster for fail-over. Uses automatic partition assignment.
  • components which send data to the queue topic to be processed
  • queue clients, either custom or using the KmqClient

Maven/SBT dependency

SBT:

"com.softwaremill.kmq" %% "core" % "0.2"

Maven:

<dependency>
    <groupId>com.softwaremill.kmq</groupId>
    <artifactId>core_2.12</artifactId>
    <version>0.2</version>
</dependency>

(Use core_2.11 if you are using other components depending on Scala 2.11.)

Client flow

The flow of processing a message is as follow:

  1. read messages from the queue topic, in batches
  2. write a start marker to the markers topic for each message, wait until the markers are written
  3. commit the biggest message offset to the queue topic
  4. process messages
  5. for each message, write an end marker. No need to wait until the markers are written.

This ensures at-least-once processing of each message. Note that the acknowledgment of each message (writing the end marker) can be done for each message separately, out-of-order, from a different thread, server or application.

Example code

There are three example applications:

  • example-java/embedded: a single java application that starts all three components (sender, client, redelivery tracker)
  • example-java/standalone: three separate runnable classes to start the different components
  • example-scala: an implementation of the client using reactive-kafka

Time & timestamps

How time is handled is crucial for message redelivery, as messages are redelivered after a given amount of time passes since the start marker was sent.

To track what was sent when, kmq uses Kafka's message timestamp. By default this is messages create time (message.timestamp.type=CreateTime), but for the markers topic, it is advisable to switch this to LogAppendTime. That way, the timestamps more closely reflect when the markers are really written to the log, and are guaranteed to be monotonic in each partition (which is important for redelivery - see below).

To calculate which messages should be redelivered, we need to know the value of "now", to check which start markers have been sent later than the configured timeout. When a marker has been received from a partition recently, the maximum such timestamp is used as the value of "now" - as it indicates exactly how far we are in processing the partition. What "recently" means depends on the useNowForRedeliverDespiteNoMarkerSeenForMs config setting. Otherwise, the current system time is used, as we assume that all markers from the partition have been processed.

Project status

Version 0.2.1 (5 Sep 2017)

  • Kafka & dependency updates

Version 0.2 (19 Jun 2017)

  • redelivery component optimizations
  • bug fixes

Version 0.1 (24 Apr 2017)

  • initial release
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].