public class XAddArgs extends Object implements CompositeArgument
XAddArgs.Builder and call the methods: maxlen(…) .
XAddArgs is a mutable object and instances should be used only once to avoid shared mutable state.
| Modifier and Type | Class and Description |
|---|---|
static class |
XAddArgs.Builder
Builder entry points for
XAddArgs. |
| Constructor and Description |
|---|
XAddArgs() |
| Modifier and Type | Method and Description |
|---|---|
XAddArgs |
approximateTrimming()
Apply efficient trimming for capped streams using the
~ flag. |
XAddArgs |
approximateTrimming(boolean approximateTrimming)
Apply efficient trimming for capped streams using the
~ flag. |
<K,V> void |
build(CommandArgs<K,V> args)
Build command arguments and contribute arguments to
CommandArgs. |
XAddArgs |
exactTrimming()
Apply exact trimming for capped streams using the
= flag. |
XAddArgs |
exactTrimming(boolean exactTrimming)
Apply exact trimming for capped streams using the
= flag. |
XAddArgs |
id(String id)
Specify the message
id. |
XAddArgs |
idmp(byte[] producerId,
byte[] idempotentId)
Enable idempotent producer mode with explicit idempotent ID.
|
XAddArgs |
idmp(String producerId,
String idempotentId)
Enable idempotent producer mode with explicit idempotent ID.
|
XAddArgs |
idmpAuto(byte[] producerId)
Enable idempotent producer mode with auto-generated idempotent ID (content-based).
|
XAddArgs |
idmpAuto(String producerId)
Enable idempotent producer mode with auto-generated idempotent ID (content-based).
|
XAddArgs |
limit(long limit)
The maximum number of entries to trim.
|
XAddArgs |
maxlen(long maxlen)
Limit stream to
maxlen entries. |
XAddArgs |
minId(String minid)
Limit stream entries by message Id.
|
XAddArgs |
nomkstream()
Do add the message if the stream does not already exist.
|
XAddArgs |
nomkstream(boolean nomkstream)
Do add the message if the stream does not already exist.
|
XAddArgs |
trimmingMode(StreamDeletionPolicy trimmingMode)
When trimming, defines desired behaviour for handling consumer group references.
|
public XAddArgs id(String id)
id.id - must not be null.thispublic XAddArgs maxlen(long maxlen)
maxlen entries.maxlen - number greater 0.thispublic XAddArgs minId(String minid)
minid - the oldest ID in the stream will be exactly the minimum between its original oldest ID and the specified
threshold.thispublic XAddArgs limit(long limit)
limit - has meaning only if `~` was set.thispublic XAddArgs trimmingMode(StreamDeletionPolicy trimmingMode)
StreamDeletionPolicy for
details.trimmingMode - the deletion policy to apply during trimming.thispublic XAddArgs approximateTrimming()
~ flag.thispublic XAddArgs approximateTrimming(boolean approximateTrimming)
~ flag.approximateTrimming - true to apply efficient radix node trimming.thispublic XAddArgs exactTrimming()
= flag.thispublic XAddArgs exactTrimming(boolean exactTrimming)
= flag.exactTrimming - true to apply exact radix node trimming.thispublic XAddArgs nomkstream()
thispublic XAddArgs nomkstream(boolean nomkstream)
nomkstream - true to not create a stream if it does not already exist.thispublic XAddArgs idmp(byte[] producerId, byte[] idempotentId)
producerId - the producer ID (must be unique per producer and consistent across restarts).idempotentId - the idempotent ID (must be unique per message and consistent across resends).thispublic XAddArgs idmp(String producerId, String idempotentId)
producerId - the producer ID (must be unique per producer and consistent across restarts).idempotentId - the idempotent ID (must be unique per message and consistent across resends).thispublic XAddArgs idmpAuto(byte[] producerId)
producerId - the producer ID (must be unique per producer and consistent across restarts).thispublic XAddArgs idmpAuto(String producerId)
producerId - the producer ID (must be unique per producer and consistent across restarts).thispublic <K,V> void build(CommandArgs<K,V> args)
CompositeArgumentCommandArgs.
Implementing classes are required to implement this method. Depending on the command nature and configured arguments, this method may contribute arguments but is not required to add arguments if none are specified.
build in interface CompositeArgumentK - Key type.V - Value type.args - the command arguments, must not be null.Copyright © 2026 lettuce.io. All rights reserved.