https://github.com/joduplessis/keg
Keg is a flexible PubSub messaging queue with middleware capabilities - powered by hops. 🍺
https://github.com/joduplessis/keg
javasript messaging queue syncronous typescript
Last synced: about 1 year ago
JSON representation
Keg is a flexible PubSub messaging queue with middleware capabilities - powered by hops. 🍺
- Host: GitHub
- URL: https://github.com/joduplessis/keg
- Owner: joduplessis
- License: mit
- Created: 2019-09-03T12:06:10.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-03-01T20:47:07.000Z (over 3 years ago)
- Last Synced: 2025-01-26T13:17:09.727Z (over 1 year ago)
- Topics: javasript, messaging, queue, syncronous, typescript
- Language: TypeScript
- Homepage:
- Size: 49.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README

# Keg
> Keg is a messaging queue. It's not suitable for production yet. Expect things to break & change without notice. It includes TypeScript support.
## Installation
```
npm i @joduplessis/keg
```
## Terminology
It's helpful to think in these terms:
- Keg: overall queue ID
- Tap: outlet of messages received, identified by an ID
- Spike: a reduce orientated middleware for messages
- Refill: adds a new message to a keg:tap
- pour(): something like a `next()` to move through the queue
## Some example usage:
```
Keg.keg('kegger').tap('demo', async (val, pour) => {
// 'val' is the current value for the demo queue
// We can process it here
// And then move onto the next item in the queue
// Equivalent to next()
pour()
}, () => {
// Tap is empty
})
// Add middleware to each message
Keg.keg('kegger').spike('demo', in => {
return window.btoa(in)
})
Keg.keg('kegger').refill('demo', 'Some text')
Keg.keg('kegger').refill('demo', { order: 'Object message types' })
Keg.keg('kegger').refill('demo', 42)
```
## Spiking your drink
Any middleware that gets added will act as a pipe. It take the value `in` & passes it onto the next `spike()`.
## Roadmap
- [x] Get base library set up
- [x] Choose a nifty logo
- [x] Add support for multiple kegs
- [ ] Add tests
- [x] Package for NPM
- [ ] Add support for external pub/subs