org.springframework.data.redis.RedisSystemException Java Examples

The following examples show how to use org.springframework.data.redis.RedisSystemException. 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: RedissonConnection.java    From redisson with Apache License 2.0 5 votes vote down vote up
protected RuntimeException transform(Exception ex) {
    DataAccessException exception = RedissonConnectionFactory.EXCEPTION_TRANSLATION.translate(ex);
    if (exception != null) {
        return exception;
    }
    return new RedisSystemException(ex.getMessage(), ex);
}
 
Example #2
Source File: RedissonConnection.java    From redisson with Apache License 2.0 5 votes vote down vote up
protected RuntimeException transform(Exception ex) {
    DataAccessException exception = RedissonConnectionFactory.EXCEPTION_TRANSLATION.translate(ex);
    if (exception != null) {
        return exception;
    }
    return new RedisSystemException(ex.getMessage(), ex);
}
 
Example #3
Source File: RedissonConnection.java    From redisson with Apache License 2.0 5 votes vote down vote up
protected RuntimeException transform(Exception ex) {
    DataAccessException exception = RedissonConnectionFactory.EXCEPTION_TRANSLATION.translate(ex);
    if (exception != null) {
        return exception;
    }
    return new RedisSystemException(ex.getMessage(), ex);
}
 
Example #4
Source File: RedissonConnection.java    From redisson with Apache License 2.0 5 votes vote down vote up
protected RuntimeException transform(Exception ex) {
    DataAccessException exception = RedissonConnectionFactory.EXCEPTION_TRANSLATION.translate(ex);
    if (exception != null) {
        return exception;
    }
    return new RedisSystemException(ex.getMessage(), ex);
}
 
Example #5
Source File: RedissonConnection.java    From redisson with Apache License 2.0 5 votes vote down vote up
protected RuntimeException transform(Exception ex) {
    DataAccessException exception = RedissonConnectionFactory.EXCEPTION_TRANSLATION.translate(ex);
    if (exception != null) {
        return exception;
    }
    return new RedisSystemException(ex.getMessage(), ex);
}
 
Example #6
Source File: RedisAspect.java    From dk-foundation with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Around("execution(* com.dk.foundation.engine.redis.RedisUtils.*(..))")
public Object around(ProceedingJoinPoint point) throws Throwable {
    Object result = null;
    try{
        result = point.proceed();
    }catch (Exception e) {
        logger.error("redis error", e);
        throw new RedisSystemException("Redis服务异常", e);
    }
    return result;
}
 
Example #7
Source File: RedissonConnection.java    From redisson with Apache License 2.0 5 votes vote down vote up
protected RuntimeException transform(Exception ex) {
    DataAccessException exception = RedissonConnectionFactory.EXCEPTION_TRANSLATION.translate(ex);
    if (exception != null) {
        return exception;
    }
    return new RedisSystemException(ex.getMessage(), ex);
}
 
Example #8
Source File: RedissonConnection.java    From redisson with Apache License 2.0 5 votes vote down vote up
protected RuntimeException transform(Exception ex) {
    DataAccessException exception = RedissonConnectionFactory.EXCEPTION_TRANSLATION.translate(ex);
    if (exception != null) {
        return exception;
    }
    return new RedisSystemException(ex.getMessage(), ex);
}
 
Example #9
Source File: SyncStreamApiTests.java    From spring-data-examples with Apache License 2.0 5 votes vote down vote up
@Test
public void basics() {

	// XADD with fixed id
	RecordId fixedId1 = streamOps.add(SensorData.RECORD_1234_0);
	assertThat(fixedId1).isEqualTo(SensorData.RECORD_1234_0.getId());

	RecordId fixedId2 = streamOps.add(SensorData.RECORD_1234_1);
	assertThat(fixedId2).isEqualTo(SensorData.RECORD_1234_1.getId());

	// XLEN
	assertThat(streamOps.size(SensorData.KEY)).isEqualTo(2L);

	// XADD errors when timestamp is less then last inserted
	assertThatExceptionOfType(RedisSystemException.class).isThrownBy(() -> {
		streamOps.add(SensorData.create("1234", "19.8", "invalid").withId(RecordId.of("0-0")));
	}).withMessageContaining("ID specified");

	// XADD with autogenerated id
	RecordId autogeneratedId = streamOps.add(SensorData.create("1234", "19.8", null));

	assertThat(autogeneratedId.getValue()).endsWith("-0");
	assertThat(streamOps.size(SensorData.KEY)).isEqualTo(3L);

	// XREAD from start
	List<MapRecord<String, String, String>> fromStart = streamOps.read(fromStart(SensorData.KEY));
	assertThat(fromStart).hasSize(3).extracting(MapRecord::getId).containsExactly(fixedId1, fixedId2, autogeneratedId);

	// XREAD resume after
	List<MapRecord<String, String, String>> fromOffset = streamOps.read(StreamOffset.create(SensorData.KEY, ReadOffset.from(fixedId2)));
	assertThat(fromOffset).hasSize(1).extracting(MapRecord::getId).containsExactly(autogeneratedId);
}
 
Example #10
Source File: RedissonBaseReactive.java    From redisson with Apache License 2.0 4 votes vote down vote up
<T> Mono<T> write(byte[] key, Codec codec, RedisCommand<?> command, Object... params) {
    Mono<T> f = executorService.reactive(() -> {
        return executorService.writeAsync(key, codec, command, params);
    });
    return f.onErrorMap(e -> new RedisSystemException(e.getMessage(), e));
}
 
Example #11
Source File: RedissonBaseReactive.java    From redisson with Apache License 2.0 4 votes vote down vote up
<T> Mono<T> read(byte[] key, Codec codec, RedisCommand<?> command, Object... params) {
    Mono<T> f = executorService.reactive(() -> {
        return executorService.readAsync(key, codec, command, params);
    });
    return f.onErrorMap(e -> new RedisSystemException(e.getMessage(), e));
}
 
Example #12
Source File: RedissonBaseReactive.java    From redisson with Apache License 2.0 4 votes vote down vote up
<T> Mono<T> read(byte[] key, Codec codec, RedisCommand<?> command, Object... params) {
    Mono<T> f = executorService.reactive(() -> {
        return executorService.readAsync(key, codec, command, params);
    });
    return f.onErrorMap(e -> new RedisSystemException(e.getMessage(), e));
}
 
Example #13
Source File: RedissonBaseReactive.java    From redisson with Apache License 2.0 4 votes vote down vote up
<T> Mono<T> write(byte[] key, Codec codec, RedisCommand<?> command, Object... params) {
    Mono<T> f = executorService.reactive(() -> {
        return executorService.writeAsync(key, codec, command, params);
    });
    return f.onErrorMap(e -> new RedisSystemException(e.getMessage(), e));
}
 
Example #14
Source File: RedissonBaseReactive.java    From redisson with Apache License 2.0 4 votes vote down vote up
<T> Mono<T> read(byte[] key, Codec codec, RedisCommand<?> command, Object... params) {
    Mono<T> f = executorService.reactive(() -> {
        return executorService.readAsync(key, codec, command, params);
    });
    return f.onErrorMap(e -> new RedisSystemException(e.getMessage(), e));
}
 
Example #15
Source File: RedissonBaseReactive.java    From redisson with Apache License 2.0 4 votes vote down vote up
<T> Mono<T> write(byte[] key, Codec codec, RedisCommand<?> command, Object... params) {
    Mono<T> f = executorService.reactive(() -> {
        return executorService.writeAsync(key, codec, command, params);
    });
    return f.onErrorMap(e -> new RedisSystemException(e.getMessage(), e));
}
 
Example #16
Source File: RedissonBaseReactive.java    From redisson with Apache License 2.0 4 votes vote down vote up
<T> Mono<T> write(byte[] key, Codec codec, RedisCommand<?> command, Object... params) {
    Mono<T> f = executorService.reactive(() -> {
        return executorService.writeAsync(key, codec, command, params);
    });
    return f.onErrorMap(e -> new RedisSystemException(e.getMessage(), e));
}
 
Example #17
Source File: RedissonBaseReactive.java    From redisson with Apache License 2.0 4 votes vote down vote up
<T> Mono<T> read(byte[] key, Codec codec, RedisCommand<?> command, Object... params) {
    Mono<T> f = executorService.reactive(() -> {
        return executorService.readAsync(key, codec, command, params);
    });
    return f.onErrorMap(e -> new RedisSystemException(e.getMessage(), e));
}
 
Example #18
Source File: ReactiveStreamApiTests.java    From spring-data-examples with Apache License 2.0 4 votes vote down vote up
@Test
public void basics() {

	// XADD with fixed id
	streamOps.add(SensorData.RECORD_1234_0)
			.as(StepVerifier::create)
			.expectNext(SensorData.RECORD_1234_0.getId()).verifyComplete();

	streamOps.add(SensorData.RECORD_1234_1)
			.as(StepVerifier::create)
			.expectNext(SensorData.RECORD_1234_1.getId()).verifyComplete();

	// XLEN
	streamOps.size(SensorData.KEY)
			.as(StepVerifier::create)
			.expectNext(2L).verifyComplete();

	// XADD errors when timestamp is less then last inserted
	streamOps.add(SensorData.create("1234", "19.8", "invalid").withId(RecordId.of("0-0")))
			.as(StepVerifier::create)
			.verifyError(RedisSystemException.class);

	// XADD with autogenerated id
	streamOps.add(SensorData.create("1234", "19.8", null))
			.as(StepVerifier::create)
			.consumeNextWith(autogeneratedId -> autogeneratedId.getValue().endsWith("-0")).verifyComplete();

	streamOps.size(SensorData.KEY)
			.as(StepVerifier::create)
			.expectNext(3L).verifyComplete();

	// XREAD from start
	streamOps.read(fromStart(SensorData.KEY))
			.map(MapRecord::getId)
			.as(StepVerifier::create)
			.expectNext(SensorData.RECORD_1234_0.getId(), SensorData.RECORD_1234_1.getId())
			.expectNextCount(1).verifyComplete();

	// XREAD resume after
	streamOps.read(StreamOffset.create(SensorData.KEY, ReadOffset.from(SensorData.RECORD_1234_1.getId())))
			.as(StepVerifier::create)
			.expectNextCount(1).verifyComplete();
}