smallrye-reactive-messaging icon indicating copy to clipboard operation
smallrye-reactive-messaging copied to clipboard

NoSuchFileException exception when using Apache Camel connector and Camel file component

Open bgoetzmann opened this issue 1 year ago • 3 comments

Hello,

I have a strange behavior with my Quarkus application (v. 2.16.7.Final) using Smallrye Reactive Messaging with Apache Camel connector and Camel file component. The application is very simple, with this ApplicationScoped component :

@ApplicationScoped
public class CamelReactive {

    @Incoming("camel")
    @Outgoing("stream-text")
    public Multi<String> consume(GenericFile<File> genfile) throws IOException {
        File file = genfile.getFile();
        List<String> content = Files.readAllLines(file.toPath());
        return Multi.createFrom().iterable(content);
    }

    @Incoming("stream-text")
    public void handle(String text) {
        System.out.println(text);
    }
}

The content of the application.properties is as follow:

mp.messaging.incoming.camel.connector=smallrye-camel
mp.messaging.incoming.camel.endpoint-uri=file:///temp/camel1?fileName=input.txt&delete=true

When I put a file input.txt the first time in C:\temp\camel1 (I'm under Windows 11), each line of the content is displayed in the console, but the second time, I get this exception :

2023-05-23 22:05:14,187 ERROR [io.sma.rea.mes.provider] (pool-1-thread-1) SRMSG00201: Error caught while processing a message in method com.odelia.mp.reactive.messaging.CamelReactive#handle: java.nio.file.NoSuchFileException: C:\temp\camel1\input.txt
        at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:85)
        at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
...

Is there something obvious that I missed?

Thanks!

Here the source code of the project: mp-reactive-messaging1.zip

bgoetzmann avatar May 23 '23 20:05 bgoetzmann