Distributed message queue with V3 reliability and Valkey support
Metalymph/relay does not have a README file
pub struct Message[T] {
id : String
payload : T
attempt_count : Int
}pub struct RedisBackend[T] {
client : Client
key : String
serialize : (T) -> String
deserialize : (String) -> T
next_id : Int
}fn[T] RedisBackend::new(client : Client, key : String, serialize~ : (T) -> String, deserialize~ : (String) -> T) -> RedisBackend[T]pub struct RedisStreamBackend[T] {
client : Client
stream : String
dlq_stream : String
group : String
consumer : String
serialize : (T) -> String
deserialize : (String) -> T
}async fn[T] RedisStreamBackend::nack_message(self : RedisStreamBackend[T], msg : Message[T]) -> Unitfn[T] RedisStreamBackend::new(client : Client, stream : String, group : String, consumer : String, serialize~ : (T) -> String, deserialize~ : (String) -> T) -> RedisStreamBackend[T]fn[T] RedisStreamBackend::new_with_dlq(client : Client, stream : String, dlq_stream : String, group : String, consumer : String, serialize~ : (T) -> String, deserialize~ : (String) -> T) -> RedisStreamBackend[T]async fn[T] RedisStreamBackend::pop_block(self : RedisStreamBackend[T], block_ms : Int) -> Message[T]async fn[T] RedisStreamBackend::recover_or_pop(self : RedisStreamBackend[T], min_idle_ms : Int, block_ms : Int) -> Message[T]async fn[T] RedisStreamBackend::recover_pending(self : RedisStreamBackend[T], min_idle_ms : Int) -> Message[T]?fn[T] RedisStreamBackend::to_relay_queue_with_recovery(self : RedisStreamBackend[T], min_idle_ms : Int, block_ms : Int) -> RelayQueue[T]pub struct RelayQueue[T] {
push_fn : async (T) -> Unit
pop_fn : async () -> Message[T]
ack_fn : async (String) -> Unit
nack_fn : async (String) -> Unit
size_fn : () -> Int
}fn[T] RelayQueue::new(push~ : async (T) -> Unit, pop~ : async () -> Message[T], ack~ : async (String) -> Unit, nack~ : async (String) -> Unit, size~ : () -> Int) -> RelayQueue[T]pub struct RetryPolicy {
max_attempts : Int
}