Producer
The Producer
trait defines the common interface of stream producers. Producer
implements Clone
, so you can use it like an mpsc::Sender
.
Implemented by:
ProducerOptions
β
Redis semanticsβ
You can assign custom sharders to Producers. Sharding simply means splitting a stream into multiple keys, in the format of STREAM_KEY:SHARD_ID
.
send
β
Send a message to the already anchored stream. This function is non-blocking. You donβt have to await
the future if you are not interested in the Receipt
.
If the producer is not anchored, this will return StreamErr::NotAnchored
error.
Receipt
β
If you await the future, you will get a receipt composed of (StreamKey, ShardId, SeqNo, Timestamp). This usually means that the message has been received by the server, but may not guarantee that the message is already persisted.
send_to
β
Like send
, but to the specified stream key.
flush
β
Flush all pending messages.
end
β
End this producer, only after flushing all it's pending messages.
anchor
β
Lock this producer to a particular stream. This function can only be called once. Subsequent calls should return StreamErr::AlreadyAnchored
error.
anchored
β
If the producer is already anchored, return a reference to the StreamKey. If the producer is not anchored, this will return StreamErr::NotAnchored
error.