camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (Assigned) (JIRA)" <j...@apache.org>
Subject [jira] [Assigned] (CAMEL-5021) camel-file: file is renamed but error handling continues.
Date Thu, 23 Feb 2012 08:21:49 GMT

     [ https://issues.apache.org/jira/browse/CAMEL-5021?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Claus Ibsen reassigned CAMEL-5021:
----------------------------------

    Assignee: Claus Ibsen
    
> camel-file: file is renamed but error handling continues.
> ---------------------------------------------------------
>
>                 Key: CAMEL-5021
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5021
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.8.1
>            Reporter: Sergey Zhemzhitsky
>            Assignee: Claus Ibsen
>              Labels: camel-file
>
> Symptoms: 
> # Exception is thrown from the child route with NoErrorHandler configured.
> # Parent and child routes are linked with async. endpoints (seda, vm, nmr, etc.), which
are configured to behave *synchronously* (attribute *waitForTaskToComplete=Always* in seda,
vm-endpoints and attribute *synchronous=true* in nmr-endpoint).
> The behavior with nmr endpoint is almost the same except for the next file is picked
up before the lock on the previous one is released.
> Here is a unit test to reproduce the issue:
> {code:java|title=org.foo.bar.FileRedeliveryWithoutErrorHandlerTest.java}
> package org.foo.bar;
> import org.apache.camel.LoggingLevel;
> import org.apache.camel.builder.RouteBuilder;
> import org.apache.camel.component.mock.MockEndpoint;
> import org.apache.camel.impl.JndiRegistry;
> import org.apache.camel.processor.RedeliveryPolicy;
> import org.apache.camel.test.junit4.CamelTestSupport;
> import org.junit.After;
> import org.junit.Before;
> import org.junit.Test;
> import java.io.File;
> import static org.hamcrest.CoreMatchers.equalTo;
> public class FileRedeliveryWithoutErrorHandlerTest extends CamelTestSupport {
>     private File newFile;
>     private File errorFile;
>     
>     @Before
>     @SuppressWarnings("ResultOfMethodCallIgnored")
>     public void createFile() throws Exception {
>         newFile = new File("target/files/in/newFile.txt");
>         newFile.createNewFile();
>         errorFile = new File("target/files/in/.error/newFile.txt");
>     }
>     
>     @After
>     @SuppressWarnings("ResultOfMethodCallIgnored")
>     public void deleteFile() throws Exception {
>         newFile.delete();
>         errorFile.delete();
>     }
>     
>     @Test
>     public void testFileRedeliveryWithoutErrorHandler() throws Exception {
>         MockEndpoint result = getMockEndpoint("mock:result");
>         result.setExpectedMessageCount(1);
>         result.assertIsNotSatisfied();
>         
>         // created file have to exist because redelivery attempts are not completed
>         assertThat(newFile.exists(), equalTo(true));
>         assertThat(errorFile.exists(), equalTo(false));
>     }
>     @Override
>     protected JndiRegistry createRegistry() throws Exception {
>         JndiRegistry registry = super.createRegistry();
>         RedeliveryPolicy policy = new RedeliveryPolicy();
>         policy.setAsyncDelayedRedelivery(false);
>         policy.setLogRetryStackTrace(true);
>         policy.setMaximumRedeliveries(100);
>         policy.setMaximumRedeliveryDelay(30000);
>         policy.setRedeliveryDelay(1000);
>         policy.setUseExponentialBackOff(false);
>         policy.setRetryAttemptedLogLevel(LoggingLevel.WARN);
>         registry.bind("redeliveryPolicy", policy);
>         return registry;
>     }
>     @Override
>     protected RouteBuilder createRouteBuilder() throws Exception {
>         return new RouteBuilder() {
>             @Override
>             public void configure() throws Exception {
>                 errorHandler(defaultErrorHandler())
>                     .onException(Exception.class)
>                     .redeliveryPolicyRef("redeliveryPolicy")
>                     .log(LoggingLevel.ERROR, "Error");
>                 from("file:target/files/in?initialDelay=100&delay=100&move=.backup&moveFailed=.error")
>                     .to("seda:async?waitForTaskToComplete=Always&size=1")
>                     .to("mock:result");
>                 from("seda:async")
>                     .errorHandler(noErrorHandler())
>                     .delay(1000)
>                     .throwException(new RuntimeException("Hello World!"));
>             }
>         };
>     }
> }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message