Skip to content
/ memento Public

Kafka messages non-blocking reprocessor and delayed producer service

License

Notifications You must be signed in to change notification settings

reugn/memento

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

memento

Build

Using Apache Kafka, we can't keep on retrying a message without blocking the entire partition. But what if we would like to delay/reprocess the current message and move on. Kafka does not have a delayed message reception mechanism out of the box. What if we could hack Kafka Streams and turn the flow into a delayed Kafka producer...

Introduction

memento is a Kafka Streams application that could come in handy when you need to:

  • Reprocess particular Kafka messages without blocking the partition
  • Submit a delayed Kafka message

The message should contain the following headers:

  • origin - a target topic name
  • ts - a timestamp to emit the message

Delayed message submission over HTTP is also supported.

curl --location --request POST 'localhost:8080/store' \
--header 'Content-Type: application/json' \
--data-raw '{
"key": "key1",
"value": "abcd",
"origin": "test2",
"ts": 1588338000000
}'

The project utilizes the KeyValueStore as message storage. Inject your own implementation using the Guice module.
More persistent KeyValueStores:

Getting started

memento is a Scala sbt application.
Run locally:

sbt run -Dconfig.resource=application.conf

Build an application jar:

sbt assembly

Run from the jar:

java -jar assembly/memento-<version>.jar -Dconfig.resource=conf/application.conf

License

Licensed under the Apache 2.0 License.