Search in sources :

Example 6 with RetryState

use of org.springframework.retry.RetryState in project spring-integration by spring-projects.

the class SpelExpressionRetryStateGeneratorTests method testClassifier.

@Test
public void testClassifier() {
    SpelExpressionRetryStateGenerator generator = new SpelExpressionRetryStateGenerator("headers['foo']");
    generator.setClassifier(new ClassifierSupport<Throwable, Boolean>(false));
    RetryState state = generator.determineRetryState(message);
    assertEquals("bar", state.getKey());
    assertFalse(((DefaultRetryState) state).isForceRefresh());
    assertFalse(state.rollbackFor(new RuntimeException()));
}
Also used : DefaultRetryState(org.springframework.retry.support.DefaultRetryState) RetryState(org.springframework.retry.RetryState) Test(org.junit.Test)

Example 7 with RetryState

use of org.springframework.retry.RetryState in project spring-integration by spring-projects.

the class SpelExpressionRetryStateGeneratorTests method testBasicConfig.

@Test
public void testBasicConfig() {
    RetryState state = configGenerator.determineRetryState(message);
    assertEquals("bar", state.getKey());
    assertFalse(((DefaultRetryState) state).isForceRefresh());
    assertTrue(state.rollbackFor(new RuntimeException()));
}
Also used : DefaultRetryState(org.springframework.retry.support.DefaultRetryState) RetryState(org.springframework.retry.RetryState) Test(org.junit.Test)

Aggregations

RetryState (org.springframework.retry.RetryState)7 Test (org.junit.Test)6 DefaultRetryState (org.springframework.retry.support.DefaultRetryState)6 MessagingException (org.springframework.messaging.MessagingException)1