robinjoseph08 / redisqueue Goto Github PK
View Code? Open in Web Editor NEWredisqueue provides a producer and consumer of a queue that uses Redis streams
Home Page: https://godoc.org/github.com/robinjoseph08/redisqueue
License: MIT License
redisqueue provides a producer and consumer of a queue that uses Redis streams
Home Page: https://godoc.org/github.com/robinjoseph08/redisqueue
License: MIT License
This issue is some kind of a feature request. Redisqueue has a great ability to limit a stream size by evaluating StreamMaxLength field of the ProducerOptions:
// StreamMaxLength sets the MAXLEN option when calling XADD. This creates a
// capped stream to prevent the stream from taking up memory indefinitely.
// It's important to note though that this isn't the maximum number of
// completed messages, but the maximum number of total messages. This
// means that if all consumers are down, but producers are still enqueuing,
// and the maximum is reached, unprocessed message will start to be dropped.
// So ideally, you'll set this number to be as high as you can makee it.
// More info here: https://redis.io/commands/xadd#capped-streams.
StreamMaxLength int64
It works great but does not give proper flexibility in the problem of limiting streams by time which leads to hard stream size limits which could lead to huge stream size if it has big messages and big size in order to offer a huge capacity for lots of consumers or load.
Redis Streams message can not have TTY with expire command https://redis.io/commands/expire but there is a tread with another feature request for the Redis. redis/redis#4450 (comment) So we could emulate a TTY for a Redis Streams messages by this logic:
Soon, we will need to develop such functionality to our services but I think that it would be great to not reinvent the wheel but have this code inside the Redisqueue.
Can we have cli entrance as bin by building to be used in python?
Because the message ID we're specifying when creating the group is always 0
, consumers will need to process all messages in the stream before getting to the latest message. For a system I'm building, I'm looking to have the semantics be more lossy when a new consumer comes to life.
Would it be possible to extend the API to include a way to specify whether we want all messages, or only new messages.
Here is the relevant line of code:
Line 156 in d95817e
I'd like to continually health check the Redis client by doing a simple SET / GET transaction every n
seconds, and if it fails trigger a process restart.
Unfortunately, I have no way to use the same Redis pool as the publisher/consumer which puts extra load on the Redis cluster and doesn't fully test the ability to use Redis.
I was wondering if there'd be a strong objection to adding a *redis.Client
to both ConsumerOptions
and ProducerOptions
. I'm thinking of retaining the *redis.Options
for now, and to only use that if *redis.Client
is nil
.
// .....
queue.Register(global.OrderEvent, event.OrderHandle)
queue.Register(global.ImMessageEvent, event.ImMessageHandle)
queue.Register(global.PlayListEvent, event.PlaylistHandle)
go func() {
for err := range queue.Errors {
log.Println("Error occurred:", err)
}
}()
go queue.Run()
...................
Code as above, sometimes there will be errors
error reading redis stream: ERR Invalid stream ID specified as stream command argument
Go to the redis client to listen and you can see: xreadgroup group redisqueue DESKTOP-TMASQJ5 count 100 block 5000 streams im_message_event_queue order_event_queue playlist_event_queue order_event_queue > > > im_message_event_queue playlist_event_queue > > >
The correct one should be: xreadgroup group redisqueue DESKTOP-TMASQJ5 count 200 block 5000 streams order_event_queue im_message_event_queue playlist_event_queue > > >
hey, this project idea look likes so cool,do you want to continue it?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.