Giter Club home page Giter Club logo

tape's Introduction

tape

cljdoc badge Clojars Project

Simple Chronicle Queue 5 helpers for clojure.

Micro second messaging that stores everything to disk

In short for when Kafka is too much and durable-queue not enough.

Chronicle Queue is similar to a low latency broker-less durable/persisted JVM topic. Tape focuses on embedded usage (we do not support topic distribution). It's essentially a disk-backed queue, allowing for queues that can survive processes dying, and whose size is bounded by available disk rather than memory.

Conceptually the api is somewhat similar to kafka, you can replay queues, set tailer's index etc... It stores everything on flat-files, you can control how rollup/purge of these happens via queue options.

I'd encourage you read about Chronicle Queue if you want to use this lib, Chronicle Queue comes with its set of tradeoffs you want to know first.

Started with a fork of https://github.com/malesch/croque and ended up rewriting/dropping most of it, hence the rename.

Installation

tape is available on Clojars.

Usage

(ns foo
  (:require [qbits.tape.tailer :as tailer]
            [qbits.tape.appender :as appender]
            [qbits.tape.queue :as queue]))

;; create a queue instance
(def q (queue/make "/tmp/q1"))

;; create a tailer bound to that queue
(def t (tailer/make q))

;; nothing in queue yet, so nil
(tailer/read! t) => nil

;; to add to queue you need an appender
(def appender (appender/make q))

;; add stuff to queue, returns index
(appender/write! appender {:foo [:bar {:baz 0}]}) => 76759655514210
(appender/write! appender {:another :thing}) => 76759655514211

(tailer/read! t) => {:foo [:bar {:baz 0}]}
(tailer/read! t) => {:another :thing}
(tailer/read! t) => nil ;; empty now


;; back to some existing index, essentially rewinding to it
(tailer/to-index! t 76759655514210)

;; Tailers are also Sequential/Seqable/Reducible and behave as such.

(run! (fn [msg] (println msg)) t)

(doseq [msg t]
  (println msg))

[...]

There's also a core.async facade for appenders/tailers on qbits.tape.async and other utilities to cleanup queues files you don't care about anymore. Anything created with a make function can be inspected with clojure.datafy/datafy.

We serialize data with fressian as a default, but you can supply your own qbits.tape/ICodec when you make/bind to a queue if you need to use something else.

License

Copyright © 2019 Max Penet

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

tape's People

Contributors

mpenet avatar axel-angel avatar trevorbernard avatar mcorbin avatar

Stargazers

Tuan Duc Tran avatar Sergey Toropenko avatar Henrik Eneroth avatar Zi JunJie avatar Dustin Getz avatar Matheus Marsiglio avatar Avelino avatar  avatar Kyle Burton avatar Erich Ocean avatar Ngoc Truong avatar Tobias Burger avatar Yiorgos Michokostas avatar Dave Newton avatar Lachlan avatar Cora Sutton avatar Taurus Olson avatar Alberto Fernández avatar Andrew Foltz-Morrison avatar Terje Sten Bjerkseth avatar ebigram avatar Dan Jay avatar Sakibur Rahman avatar Ngoc Truong avatar Jochen Bedersdorfer avatar Paul Legato avatar David Pham avatar Simon Gray avatar James Conroy-Finn avatar Avi Flax avatar Aleš Najmann avatar Dave Dixon avatar  avatar Kirill Salykin avatar Roman Dronov avatar Daniel Kraus avatar Jake avatar  avatar  avatar Ahmed Hassan avatar Eike Spang avatar Lyn Headley avatar Adam Feldman avatar Petrus Theron avatar Ben Sless avatar Martin Mareš avatar Muhammad Ridho avatar Carlos Garcia avatar el arbaoui oussama avatar  avatar Andrejs Agejevs avatar Stathis Sideris avatar Mike Larsen avatar Ilshat Sultanov avatar Patrik avatar Christopher Small avatar Kris Leech avatar Dominik Bylica avatar Simon Skorokhodov avatar Olim Saidov avatar Gert Goet avatar Vitaly Kornilov avatar Zola Zhou avatar Fabrizio Ferrai avatar Jens C. J. avatar Oliver Martell Núñez avatar Stanislav Yakushev avatar Anton Chikin avatar Tomáš Bílek avatar Maciej Łotysz avatar Rafael de F. Ferreira avatar Pablo Berganza avatar JC avatar Alan avatar Vic avatar Gerasimos avatar zhangzhihong avatar  avatar Veha Suwatphisankij avatar  avatar majnu avatar  avatar Justin Tirrell avatar Juan Macias avatar RJ Sheperd avatar  avatar mzajac avatar Jesse Eisses avatar Ikuru K avatar Nick Stares avatar Łukasz Korecki avatar Rod Gaither avatar Andy Fingerhut avatar Jesse Sherlock avatar Suraj Sharma avatar Arun Vickram avatar Thomas avatar Dave Roberts avatar Witoslaw Koczewski avatar Shayne Studdard avatar

Watchers

Łukasz Korecki avatar  avatar  avatar  avatar

tape's Issues

s3 builtin appender?

Can imagine it would be nice to have such a queue shared between several services?
(or it is too much to ask?)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.