-
Notifications
You must be signed in to change notification settings - Fork 274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create abstraction for SMTP queue storage #262
Comments
It would be great is the storage can be integrated into the golang code and for it to be HA. This does it. And many devs use it to make KV stores in golang to be HA. So it is mature. |
Things to be abstracted out from queue code are:
Determines when message delivery should be attempted. Interface is roughly this: Schedule(time time.Time, attemptId string)
Wait() (attemptId string) This part is already mostly separated - in current implementation that's TimeWheel struct (funny name, should have named it TimerBucket or something :) ). Such scheduler should be able to preserve information across server restarts and so on. In current implementation queue timers
Message queue needs to keep 3 pieces of data: Meta-data (serialized module.MsgMetaData structure), message header and message body. This part of queue code is hard-wired with the rest of queue logic so some refactoring is required here. StoreMessage(attemptId string, metadata QueueMeta, hdr textproto.Header, body io.Reader)
LoadMetadata(attemptId string) QueueMeta
LoadHeader(attemptId string) textproto.Header
LoadBody(attemptId string) io.Reader Can take a step forward and use a dumb key-value store interface and let queue itself handle necessary serialization |
Frankly, I am not familiar with consensus protocols like Raft. So I was hoping for feedback on what kind of interface would be appropriate between queue code and storage. I wrote a detailed description above. |
I have an idea to achieve this using NATS Jetstream. |
That would enable writing alternative queue storage implementations. Discussion needed to figure out if there is need and what considerations are.
The text was updated successfully, but these errors were encountered: