Camel PollEnrich EIP always fails first time when polling from camel file resource due to short timeout

Solution Verified - Updated -

Issue

  • The following code results a FileNotFoundException with error message "Input XML file not found" the very first time but successful for all subsequent attempts on the same file:

    from("direct:input") 
    .routeId("test-route")
    .pollEnrich()
    .simple("file://"+"{{path.prefix}}" + "${body[filePath]}" + "?noop=true&idempotent=false&fileName=" + "${body[fileName]}"")
    .timeout(10)
    .choice()
    .when(body().isNotNull())
        .process(new Processor() {
            @SuppressWarnings("unchecked")
            @Override
            public void process(Exchange exchange) throws Exception {
                System.out.println("exchange IN: " + exchange.getIn().toString());
            }
        })
    .otherwise().throwException(new FileNotFoundException("Input XML file not found"));
    

Environment

  • Red Hat Fuse (Fuse)
    • 6.3

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content