Tabnine Logo
BatchRetryTemplate.setRetryPolicy
Code IndexAdd Tabnine to your IDE (free)

How to use
setRetryPolicy
method
in
org.springframework.batch.core.step.item.BatchRetryTemplate

Best Java code snippets using org.springframework.batch.core.step.item.BatchRetryTemplate.setRetryPolicy (Showing top 13 results out of 315)

origin: spring-projects/spring-batch

  batchRetryTemplate.setBackOffPolicy(backOffPolicy);
batchRetryTemplate.setRetryPolicy(retryPolicyWrapper);
origin: spring-projects/spring-batch

@Test(expected = ExhaustedRetryException.class)
public void testExhaustedRetry() throws Exception {
  BatchRetryTemplate template = new BatchRetryTemplate();
  template.setRetryPolicy(new SimpleRetryPolicy(1, Collections
      .<Class<? extends Throwable>, Boolean> singletonMap(Exception.class, true)));
  RetryCallback<String[], Exception> retryCallback = new RetryCallback<String[], Exception>() {
    @Override
    public String[] doWithRetry(RetryContext context) throws Exception {
      if (count++ < 2) {
        throw new RecoverableException("Recoverable");
      }
      return outputs.toArray(new String[0]);
    }
  };
  outputs = Arrays.asList("a", "b");
  try {
    template.execute(retryCallback, BatchRetryTemplate.createState(outputs));
    fail("Expected RecoverableException");
  }
  catch (RecoverableException e) {
    assertEquals("Recoverable", e.getMessage());
  }
  outputs = Arrays.asList("a", "c");
  template.execute(retryCallback, BatchRetryTemplate.createState(outputs));
}
origin: spring-projects/spring-batch

template.setRetryPolicy(new SimpleRetryPolicy(1, Collections
    .<Class<? extends Throwable>, Boolean> singletonMap(Exception.class, true)));
origin: spring-projects/spring-batch

@Before
public void setUp() {
  batchRetryTemplate = new BatchRetryTemplate();
  processor = new FaultTolerantChunkProcessor<>(
      new PassThroughItemProcessor<>(),
      new ItemWriter<String>() {
        @Override
        public void write(List<? extends String> items)
            throws Exception {
          if (items.contains("fail")) {
            throw new RuntimeException("Planned failure!");
          }
          list.addAll(items);
        }
      }, batchRetryTemplate);
  batchRetryTemplate.setRetryPolicy(new NeverRetryPolicy());
}
origin: spring-projects/spring-batch

template.setRetryPolicy(new SimpleRetryPolicy(1, Collections
    .<Class<? extends Throwable>, Boolean> singletonMap(Exception.class, true)));
origin: spring-projects/spring-batch

@Test
// BATCH-2663
public void testFilterCountOnSkipInWriteWithRetry() throws Exception {
  SimpleRetryPolicy retryPolicy = new SimpleRetryPolicy();
  retryPolicy.setMaxAttempts(3);
  batchRetryTemplate.setRetryPolicy(retryPolicy);
  processor.setWriteSkipPolicy(new AlwaysSkipItemSkipPolicy());
  processor.setItemProcessor(new ItemProcessor<String, String>() {
    @Override
    public String process(String item) throws Exception {
      if (item.equals("1")) {
        return null;
      }
      return item;
    }
  });
  Chunk<String> inputs = new Chunk<>(Arrays.asList("fail", "1", "2"));
  processAndExpectPlannedRuntimeException(inputs); // (first attempt) Process fail, 1, 2
  // item 1 is filtered out so it is removed from the chunk => now inputs = [fail, 2]
  processAndExpectPlannedRuntimeException(inputs); // (first retry) Process fail, 2
  processAndExpectPlannedRuntimeException(inputs); // (second retry) Process fail, 2
  // retry exhausted (maxAttempts = 3) => now scanning
  processAndExpectPlannedRuntimeException(inputs); // (scanning) Process fail
  processor.process(contribution, inputs); // (scanning) Process 2
  assertEquals(1, list.size());
  assertEquals("[2]", list.toString());
  assertEquals(1, contribution.getWriteSkipCount());
  assertEquals(3, contribution.getFilterCount());
}
origin: spring-projects/spring-batch

SimpleRetryPolicy retryPolicy = new SimpleRetryPolicy();
retryPolicy.setMaxAttempts(2);
batchRetryTemplate.setRetryPolicy(retryPolicy);
processor.setWriteSkipPolicy(new LimitCheckingItemSkipPolicy(1,
    Collections.<Class<? extends Throwable>, Boolean> singletonMap(
origin: spring-projects/spring-batch

SimpleRetryPolicy retryPolicy = new SimpleRetryPolicy();
retryPolicy.setMaxAttempts(2);
batchRetryTemplate.setRetryPolicy(retryPolicy);
processor.setWriteSkipPolicy(new AlwaysSkipItemSkipPolicy());
processor.setItemWriter(new ItemWriter<String>() {
origin: spring-projects/spring-batch

SimpleRetryPolicy retryPolicy = new SimpleRetryPolicy();
retryPolicy.setMaxAttempts(2);
batchRetryTemplate.setRetryPolicy(retryPolicy);
processor.setWriteSkipPolicy(new AlwaysSkipItemSkipPolicy());
processor.setItemWriter(new ItemWriter<String>() {
origin: org.springframework.batch/spring-batch-core

  batchRetryTemplate.setBackOffPolicy(backOffPolicy);
batchRetryTemplate.setRetryPolicy(retryPolicyWrapper);
origin: org.springframework.batch.core/org.motechproject.org.springframework.batch.core

  batchRetryTemplate.setBackOffPolicy(backOffPolicy);
batchRetryTemplate.setRetryPolicy(retryPolicyWrapper);
origin: apache/servicemix-bundles

  batchRetryTemplate.setBackOffPolicy(backOffPolicy);
batchRetryTemplate.setRetryPolicy(retryPolicyWrapper);
origin: org.springframework.batch/org.springframework.batch.core

  batchRetryTemplate.setBackOffPolicy(backOffPolicy);
batchRetryTemplate.setRetryPolicy(retryPolicyWrapper);
org.springframework.batch.core.step.itemBatchRetryTemplatesetRetryPolicy

Popular methods of BatchRetryTemplate

  • <init>
  • createState
  • execute
  • setBackOffPolicy
  • setListeners
  • setRetryContextCache
  • canRetry

Popular in Java

  • Making http post requests using okhttp
  • scheduleAtFixedRate (Timer)
  • getResourceAsStream (ClassLoader)
  • requestLocationUpdates (LocationManager)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now