Java Code Examples for org.springframework.data.redis.connection.ReactiveRedisConnection#NumericResponse

The following examples show how to use org.springframework.data.redis.connection.ReactiveRedisConnection#NumericResponse . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RedissonReactiveStreamCommands.java    From redisson with Apache License 2.0 6 votes vote down vote up
@Override
public Flux<ReactiveRedisConnection.NumericResponse<AcknowledgeCommand, Long>> xAck(Publisher<AcknowledgeCommand> publisher) {
    return execute(publisher, command -> {

        Assert.notNull(command.getKey(), "Key must not be null!");
        Assert.notNull(command.getGroup(), "Group must not be null!");
        Assert.notNull(command.getRecordIds(), "recordIds must not be null!");

        List<Object> params = new ArrayList<>();
        byte[] k = toByteArray(command.getKey());
        params.add(k);
        params.add(command.getGroup());
        params.addAll(toStringList(command.getRecordIds()));

        Mono<Long> m = write(k, StringCodec.INSTANCE, RedisCommands.XACK, params.toArray());
        return m.map(v -> new ReactiveRedisConnection.NumericResponse<>(command, v));
    });
}
 
Example 2
Source File: RedissonReactiveStreamCommands.java    From redisson with Apache License 2.0 6 votes vote down vote up
@Override
public Flux<ReactiveRedisConnection.NumericResponse<AcknowledgeCommand, Long>> xAck(Publisher<AcknowledgeCommand> publisher) {
    return execute(publisher, command -> {

        Assert.notNull(command.getKey(), "Key must not be null!");
        Assert.notNull(command.getGroup(), "Group must not be null!");
        Assert.notNull(command.getRecordIds(), "recordIds must not be null!");

        List<Object> params = new ArrayList<>();
        byte[] k = toByteArray(command.getKey());
        params.add(k);
        params.add(command.getGroup());
        params.addAll(toStringList(command.getRecordIds()));

        Mono<Long> m = write(k, StringCodec.INSTANCE, RedisCommands.XACK, params.toArray());
        return m.map(v -> new ReactiveRedisConnection.NumericResponse<>(command, v));
    });
}
 
Example 3
Source File: RedissonReactiveStreamCommands.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public Flux<ReactiveRedisConnection.NumericResponse<ReactiveRedisConnection.KeyCommand, Long>> xLen(Publisher<ReactiveRedisConnection.KeyCommand> publisher) {
    return execute(publisher, command -> {

        Assert.notNull(command.getKey(), "Key must not be null!");

        byte[] k = toByteArray(command.getKey());

        Mono<Long> m = write(k, StringCodec.INSTANCE, RedisCommands.XLEN, k);
        return m.map(v -> new ReactiveRedisConnection.NumericResponse<>(command, v));
    });
}
 
Example 4
Source File: RedissonReactiveStreamCommands.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public Flux<ReactiveRedisConnection.NumericResponse<ReactiveRedisConnection.KeyCommand, Long>> xTrim(Publisher<TrimCommand> publisher) {
    return execute(publisher, command -> {

        Assert.notNull(command.getKey(), "Key must not be null!");
        Assert.notNull(command.getCount(), "Count must not be null!");

        byte[] k = toByteArray(command.getKey());

        Mono<Long> m = write(k, StringCodec.INSTANCE, RedisCommands.XTRIM, k, "MAXLEN", command.getCount());
        return m.map(v -> new ReactiveRedisConnection.NumericResponse<>(command, v));
    });
}
 
Example 5
Source File: RedissonReactiveStreamCommands.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public Flux<ReactiveRedisConnection.NumericResponse<ReactiveRedisConnection.KeyCommand, Long>> xLen(Publisher<ReactiveRedisConnection.KeyCommand> publisher) {
    return execute(publisher, command -> {

        Assert.notNull(command.getKey(), "Key must not be null!");

        byte[] k = toByteArray(command.getKey());

        Mono<Long> m = write(k, StringCodec.INSTANCE, RedisCommands.XLEN, k);
        return m.map(v -> new ReactiveRedisConnection.NumericResponse<>(command, v));
    });
}
 
Example 6
Source File: RedissonReactiveStreamCommands.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public Flux<ReactiveRedisConnection.NumericResponse<ReactiveRedisConnection.KeyCommand, Long>> xTrim(Publisher<TrimCommand> publisher) {
    return execute(publisher, command -> {

        Assert.notNull(command.getKey(), "Key must not be null!");
        Assert.notNull(command.getCount(), "Count must not be null!");

        byte[] k = toByteArray(command.getKey());

        Mono<Long> m = write(k, StringCodec.INSTANCE, RedisCommands.XTRIM, k, "MAXLEN", command.getCount());
        return m.map(v -> new ReactiveRedisConnection.NumericResponse<>(command, v));
    });
}