|
20 | 20 | import redis.clients.jedis.MultiKeyPipelineBase;
|
21 | 21 | import redis.clients.jedis.StreamConsumersInfo;
|
22 | 22 | import redis.clients.jedis.StreamGroupInfo;
|
| 23 | +import redis.clients.jedis.params.XAddParams; |
23 | 24 |
|
24 | 25 | import java.util.ArrayList;
|
25 | 26 | import java.util.Arrays;
|
@@ -78,14 +79,18 @@ public RecordId xAdd(MapRecord<byte[], byte[], byte[]> record, XAddOptions optio
|
78 | 79 | Assert.notNull(record, "Record must not be null!");
|
79 | 80 | Assert.notNull(record.getStream(), "Stream must not be null!");
|
80 | 81 |
|
81 |
| - byte[] id = JedisConverters.toBytes(record.getId().getValue()); |
82 |
| - long maxLength = Long.MAX_VALUE; |
| 82 | + XAddParams xAddParams = new XAddParams(); |
| 83 | + xAddParams.id(record.getId().getValue()); |
83 | 84 | if (options.hasMaxlen()) {
|
84 |
| - maxLength = options.getMaxlen(); |
| 85 | + xAddParams.maxLen(options.getMaxlen()); |
| 86 | + } |
| 87 | + if (options.isNoMkStream()) { |
| 88 | + xAddParams.noMkStream(); |
85 | 89 | }
|
86 | 90 |
|
87 |
| - return connection.invoke().from(BinaryJedis::xadd, MultiKeyPipelineBase::xadd, record.getStream(), id, |
88 |
| - record.getValue(), maxLength, false).get(it -> RecordId.of(JedisConverters.toString(it))); |
| 91 | + return connection.invoke() |
| 92 | + .from(BinaryJedis::xadd, MultiKeyPipelineBase::xadd, record.getStream(), record.getValue(), xAddParams) |
| 93 | + .get(it -> RecordId.of(JedisConverters.toString(it))); |
89 | 94 | }
|
90 | 95 |
|
91 | 96 | /*
|
|
0 commit comments