This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 6daa5ce4e147 CAMEL-27067: camel-stream - a consumer with 
scanStream=true and readLine=false never routes the data it reads (#30251)
6daa5ce4e147 is described below

commit 6daa5ce4e1479512f3b415ab9f4703ead05fef48
Author: allthingssecurity <[email protected]>
AuthorDate: Tue Nov 17 14:30:24 2026 +0530

    CAMEL-27067: camel-stream - a consumer with scanStream=true and 
readLine=false never routes the data it reads (#30251)
    
    …ine=false never routes the data it reads
    
    With readLine=false the stream consumer reads the stream in raw mode. In
    the scan loop (scanStream=true) it read the stream with readAllBytes() on
    each scan, but never passed the bytes to processRaw: no exchange was
    created and the data that was read was dropped, both the data in the
    stream when the consumer starts and the data appended later.
    
    Two more problems in the same loop:
    - it reopened the stream after every read when retry=true and slept only
      when nothing was read, so a non-empty file was read again (or the URL
      requested again) in a tight loop with no pause;
    - a file that did not exist at start gave a null stream, and the first
      read threw a NullPointerException that ended the consumer thread, even
      with retry=true.
    
    The scan loop now routes the bytes it read and keeps the index. As in the
    line mode, it reopens the stream for retry only at the end of the stream,
    which removes the busy loop, and a null stream counts as the end of the
    stream, so with retry the file is opened once it exists. Without retry a
    file that is missing at start is never picked up, as in the line mode.
    With retry a reopened stream is read again from the beginning, as in the
    line mode: without fileWatcher the whole file is routed again at every
    end of stream, so use retry with fileWatcher, as the docs of retry say.
    
    A scanned stream is never complete, so the raw scan exchanges have
    CamelStreamComplete=false, as in the line mode. The protected
    processRaw(byte[], long) keeps its behaviour and delegates to a private
    overload that takes the flag. The non-scan raw mode keeps the index
    returned by processRaw, and declares the read buffer inside its loop so
    a failed read does not route the previous bytes again. The readLine
    option and the consumer body type say what a raw scan exchange holds
    (the generated metadata, catalog and endpoint DSL are updated).
    
    Tests: ScanStreamFileRawModeTest routes the data in the file at start and
    the data appended after, with CamelStreamComplete=false.
    ScanStreamFileRawModeRetryTest starts with no file and retry=true, then
    creates the file and expects its content. Both fail on main.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 .../apache/camel/catalog/components/stream.json    |  4 +-
 .../org/apache/camel/component/stream/stream.json  |  4 +-
 .../camel/component/stream/StreamConsumer.java     | 29 +++++--
 .../camel/component/stream/StreamEndpoint.java     |  5 +-
 .../stream/ScanStreamFileRawModeRetryTest.java     | 80 +++++++++++++++++++
 .../stream/ScanStreamFileRawModeTest.java          | 89 ++++++++++++++++++++++
 .../endpoint/dsl/StreamEndpointBuilderFactory.java | 10 ++-
 7 files changed, 203 insertions(+), 18 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/stream.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/stream.json
index d440d68834a5..93da0a8c74ff 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/stream.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/stream.json
@@ -33,7 +33,7 @@
     "CamelStreamComplete": { "index": 1, "kind": "header", "displayName": "", 
"group": "consumer", "label": "consumer", "required": false, "javaType": 
"boolean", "deprecated": false, "autowired": false, "secret": false, 
"description": "Is complete", "constantName": 
"org.apache.camel.component.stream.StreamConstants#STREAM_COMPLETE" }
   },
   "bodyTypes": {
-    "consumerOut": { "carriers": [ "text" ], "javaType": "java.lang.String", 
"dependsOn": [ "groupLines" ], "byOption": [ { "option": "readLine", "value": 
"false", "carriers": [ "bytes" ], "javaType": "byte[]" } ], "description": 
"Each line of the stream as text. With groupLines, a List of the lines; with 
readLine=false, all the bytes of the stream" },
+    "consumerOut": { "carriers": [ "text" ], "javaType": "java.lang.String", 
"dependsOn": [ "groupLines" ], "byOption": [ { "option": "readLine", "value": 
"false", "carriers": [ "bytes" ], "javaType": "byte[]" } ], "description": 
"Each line of the stream as text. With groupLines, a List of the lines; with 
readLine=false, all the bytes of the stream (with scanStream, the bytes read in 
one scan)" },
     "producerIn": { "carriers": [ "null", "text", "bytes", "stream", "file" ], 
"description": "Text in the encoding, or bytes, a stream or a file as bytes, 
followed by a new line; no body writes nothing. A Map or a POJO is written as 
its toString() and a List fails: marshal it first" },
     "producerOut": { "carriers": [ "unchanged" ] }
   },
@@ -49,7 +49,7 @@
     "initialPromptDelay": { "index": 8, "kind": "parameter", "displayName": 
"Initial Prompt Delay", "group": "consumer", "label": "consumer", "required": 
false, "type": "integer", "javaType": "long", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": 2000, "description": "Initial delay in 
milliseconds before showing the message prompt. This delay occurs only once. 
Can be used during system startup to avoid message prompts being written while 
other logging is done t [...]
     "promptDelay": { "index": 9, "kind": "parameter", "displayName": "Prompt 
Delay", "group": "consumer", "label": "consumer", "required": false, "type": 
"integer", "javaType": "long", "deprecated": false, "autowired": false, 
"secret": false, "description": "Optional delay in milliseconds before showing 
the message prompt." },
     "promptMessage": { "index": 10, "kind": "parameter", "displayName": 
"Prompt Message", "group": "consumer", "label": "consumer", "required": false, 
"type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "Message prompt to use when 
reading from stream:in; for example, you could set this to Enter a command:" },
-    "readLine": { "index": 11, "kind": "parameter", "displayName": "Read 
Line", "group": "consumer", "label": "consumer", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": true, "description": "Whether to read the 
input stream in line mode (terminate by line breaks). Setting this to false, 
will instead read the entire stream until EOL." },
+    "readLine": { "index": 11, "kind": "parameter", "displayName": "Read 
Line", "group": "consumer", "label": "consumer", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": true, "description": "Whether to read the 
input stream in line mode (terminate by line breaks). Setting this to false, 
will instead read until the end of the stream. With scanStream, each exchange 
holds the bytes read in one scan." },
     "retry": { "index": 12, "kind": "parameter", "displayName": "Retry", 
"group": "consumer", "label": "consumer", "required": false, "type": "boolean", 
"javaType": "boolean", "deprecated": false, "autowired": false, "secret": 
false, "defaultValue": false, "description": "Will retry opening the stream if 
it's overwritten, somewhat like tail --retry If reading from files then you 
should also enable the fileWatcher option, to make it work reliable." },
     "scanStream": { "index": 13, "kind": "parameter", "displayName": "Scan 
Stream", "group": "consumer", "label": "consumer", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": false, "description": "To be used for 
continuously reading a stream such as the unix tail command." },
     "scanStreamDelay": { "index": 14, "kind": "parameter", "displayName": 
"Scan Stream Delay", "group": "consumer", "label": "consumer", "required": 
false, "type": "integer", "javaType": "long", "deprecated": false, "autowired": 
false, "secret": false, "description": "Delay in milliseconds between read 
attempts when using scanStream." },
diff --git 
a/components/camel-stream/src/generated/resources/META-INF/org/apache/camel/component/stream/stream.json
 
b/components/camel-stream/src/generated/resources/META-INF/org/apache/camel/component/stream/stream.json
index d440d68834a5..93da0a8c74ff 100644
--- 
a/components/camel-stream/src/generated/resources/META-INF/org/apache/camel/component/stream/stream.json
+++ 
b/components/camel-stream/src/generated/resources/META-INF/org/apache/camel/component/stream/stream.json
@@ -33,7 +33,7 @@
     "CamelStreamComplete": { "index": 1, "kind": "header", "displayName": "", 
"group": "consumer", "label": "consumer", "required": false, "javaType": 
"boolean", "deprecated": false, "autowired": false, "secret": false, 
"description": "Is complete", "constantName": 
"org.apache.camel.component.stream.StreamConstants#STREAM_COMPLETE" }
   },
   "bodyTypes": {
-    "consumerOut": { "carriers": [ "text" ], "javaType": "java.lang.String", 
"dependsOn": [ "groupLines" ], "byOption": [ { "option": "readLine", "value": 
"false", "carriers": [ "bytes" ], "javaType": "byte[]" } ], "description": 
"Each line of the stream as text. With groupLines, a List of the lines; with 
readLine=false, all the bytes of the stream" },
+    "consumerOut": { "carriers": [ "text" ], "javaType": "java.lang.String", 
"dependsOn": [ "groupLines" ], "byOption": [ { "option": "readLine", "value": 
"false", "carriers": [ "bytes" ], "javaType": "byte[]" } ], "description": 
"Each line of the stream as text. With groupLines, a List of the lines; with 
readLine=false, all the bytes of the stream (with scanStream, the bytes read in 
one scan)" },
     "producerIn": { "carriers": [ "null", "text", "bytes", "stream", "file" ], 
"description": "Text in the encoding, or bytes, a stream or a file as bytes, 
followed by a new line; no body writes nothing. A Map or a POJO is written as 
its toString() and a List fails: marshal it first" },
     "producerOut": { "carriers": [ "unchanged" ] }
   },
@@ -49,7 +49,7 @@
     "initialPromptDelay": { "index": 8, "kind": "parameter", "displayName": 
"Initial Prompt Delay", "group": "consumer", "label": "consumer", "required": 
false, "type": "integer", "javaType": "long", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": 2000, "description": "Initial delay in 
milliseconds before showing the message prompt. This delay occurs only once. 
Can be used during system startup to avoid message prompts being written while 
other logging is done t [...]
     "promptDelay": { "index": 9, "kind": "parameter", "displayName": "Prompt 
Delay", "group": "consumer", "label": "consumer", "required": false, "type": 
"integer", "javaType": "long", "deprecated": false, "autowired": false, 
"secret": false, "description": "Optional delay in milliseconds before showing 
the message prompt." },
     "promptMessage": { "index": 10, "kind": "parameter", "displayName": 
"Prompt Message", "group": "consumer", "label": "consumer", "required": false, 
"type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "Message prompt to use when 
reading from stream:in; for example, you could set this to Enter a command:" },
-    "readLine": { "index": 11, "kind": "parameter", "displayName": "Read 
Line", "group": "consumer", "label": "consumer", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": true, "description": "Whether to read the 
input stream in line mode (terminate by line breaks). Setting this to false, 
will instead read the entire stream until EOL." },
+    "readLine": { "index": 11, "kind": "parameter", "displayName": "Read 
Line", "group": "consumer", "label": "consumer", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": true, "description": "Whether to read the 
input stream in line mode (terminate by line breaks). Setting this to false, 
will instead read until the end of the stream. With scanStream, each exchange 
holds the bytes read in one scan." },
     "retry": { "index": 12, "kind": "parameter", "displayName": "Retry", 
"group": "consumer", "label": "consumer", "required": false, "type": "boolean", 
"javaType": "boolean", "deprecated": false, "autowired": false, "secret": 
false, "defaultValue": false, "description": "Will retry opening the stream if 
it's overwritten, somewhat like tail --retry If reading from files then you 
should also enable the fileWatcher option, to make it work reliable." },
     "scanStream": { "index": 13, "kind": "parameter", "displayName": "Scan 
Stream", "group": "consumer", "label": "consumer", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": false, "description": "To be used for 
continuously reading a stream such as the unix tail command." },
     "scanStreamDelay": { "index": 14, "kind": "parameter", "displayName": 
"Scan Stream Delay", "group": "consumer", "label": "consumer", "required": 
false, "type": "integer", "javaType": "long", "deprecated": false, "autowired": 
false, "secret": false, "description": "Delay in milliseconds between read 
attempts when using scanStream." },
diff --git 
a/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamConsumer.java
 
b/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamConsumer.java
index e636dbb99cbe..683c668ba7bf 100644
--- 
a/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamConsumer.java
+++ 
b/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamConsumer.java
@@ -200,14 +200,19 @@ public class StreamConsumer extends DefaultConsumer 
implements Runnable {
             while (isRunAllowed()) {
 
                 byte[] data = null;
-                try {
-                    data = is.readAllBytes();
-                } catch (IOException e) {
-                    // ignore
+                if (is != null) {
+                    try {
+                        data = is.readAllBytes();
+                    } catch (IOException e) {
+                        // ignore
+                    }
                 }
                 boolean eos = data == null || data.length == 0;
 
-                if (isRunAllowed() && endpoint.isRetry()) {
+                if (!eos && isRunAllowed()) {
+                    // a scanned stream is never complete
+                    index = processRaw(data, index, false);
+                } else if (eos && isRunAllowed() && endpoint.isRetry()) {
                     boolean reOpen = true;
                     if (endpoint.isFileWatcher()) {
                         reOpen = watchFileChanged;
@@ -237,12 +242,12 @@ public class StreamConsumer extends DefaultConsumer 
implements Runnable {
         } else {
             // regular read stream once until end of stream
             boolean eos = false;
-            byte[] data = null;
             while (!eos && isRunAllowed()) {
                 if (endpoint.getPromptMessage() != null) {
                     doPromptMessage();
                 }
 
+                byte[] data = null;
                 try {
                     data = is.readAllBytes();
                 } catch (IOException e) {
@@ -250,7 +255,7 @@ public class StreamConsumer extends DefaultConsumer 
implements Runnable {
                 }
                 eos = data == null || data.length == 0;
                 if (!eos) {
-                    processRaw(data, index);
+                    index = processRaw(data, index);
                 }
             }
         }
@@ -372,9 +377,17 @@ public class StreamConsumer extends DefaultConsumer 
implements Runnable {
      * Strategy method for processing the data
      */
     protected long processRaw(byte[] body, long index) throws Exception {
+        return processRaw(body, index, true);
+    }
+
+    /**
+     * Strategy method for processing the data. last tells whether this is the 
last exchange of the stream; it is false
+     * for each scan of a scanned stream, which is never complete.
+     */
+    protected long processRaw(byte[] body, long index, boolean last) throws 
Exception {
         lock.lock();
         try {
-            Exchange exchange = createExchange(body, index++, true);
+            Exchange exchange = createExchange(body, index++, last);
             getProcessor().process(exchange);
             return index;
         } finally {
diff --git 
a/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamEndpoint.java
 
b/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamEndpoint.java
index 487599c62672..8b86e3cb92ce 100644
--- 
a/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamEndpoint.java
+++ 
b/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamEndpoint.java
@@ -43,7 +43,8 @@ import org.slf4j.LoggerFactory;
                                    byOption = @BodyType.When(option = 
"readLine", value = "false", carriers = Carrier.BYTES,
                                                              javaType = 
"byte[]"),
                                    description = "Each line of the stream as 
text. With groupLines, a List of the lines; with"
-                                                 + " readLine=false, all the 
bytes of the stream"),
+                                                 + " readLine=false, all the 
bytes of the stream (with scanStream,"
+                                                 + " the bytes read in one 
scan)"),
            producerIn = @BodyType(value = { Carrier.NULL, Carrier.TEXT, 
Carrier.BYTES, Carrier.STREAM, Carrier.FILE },
                                   description = "Text in the encoding, or 
bytes, a stream or a file as bytes, followed by a new"
                                                 + " line; no body writes 
nothing. A Map or a POJO is written as its toString()"
@@ -311,7 +312,7 @@ public class StreamEndpoint extends DefaultEndpoint {
 
     /**
      * Whether to read the input stream in line mode (terminate by line 
breaks). Setting this to false, will instead
-     * read the entire stream until EOL.
+     * read until the end of the stream. With scanStream, each exchange holds 
the bytes read in one scan.
      */
     public void setReadLine(boolean readLine) {
         this.readLine = readLine;
diff --git 
a/components/camel-stream/src/test/java/org/apache/camel/component/stream/ScanStreamFileRawModeRetryTest.java
 
b/components/camel-stream/src/test/java/org/apache/camel/component/stream/ScanStreamFileRawModeRetryTest.java
new file mode 100644
index 000000000000..9feb8babef89
--- /dev/null
+++ 
b/components/camel-stream/src/test/java/org/apache/camel/component/stream/ScanStreamFileRawModeRetryTest.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.stream;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.nio.charset.StandardCharsets;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit6.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit6.TestSupport.createDirectory;
+import static org.apache.camel.test.junit6.TestSupport.deleteDirectory;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * A stream consumer with scanStream=true, retry=true and readLine=false on a 
file that does not exist when it starts
+ * must keep scanning, and route the file once it exists.
+ */
+public class ScanStreamFileRawModeRetryTest extends CamelTestSupport {
+
+    private File file;
+
+    @Override
+    public void doPreSetup() throws Exception {
+        deleteDirectory("target/stream-raw-retry");
+        createDirectory("target/stream-raw-retry");
+
+        file = new File("target/stream-raw-retry/scanstreamraw.txt");
+    }
+
+    @Test
+    public void testScanMissingFileRawMode() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        // retry without fileWatcher reads the file again from the start at 
the end of the stream
+        mock.expectedMinimumMessageCount(1);
+        mock.message(0).body().isEqualTo("Hello\nWorld\n");
+
+        context.getRouteController().startAllRoutes();
+
+        // the file is created after the consumer started
+        File tmp = new File("target/stream-raw-retry/scanstreamraw.tmp");
+        try (FileOutputStream fos = new FileOutputStream(tmp)) {
+            fos.write("Hello\nWorld\n".getBytes(StandardCharsets.UTF_8));
+        }
+        assertTrue(tmp.renameTo(file), "rename of " + tmp + " to " + file);
+
+        MockEndpoint.assertIsSatisfied(context, 10, TimeUnit.SECONDS);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            public void configure() {
+                
from("stream:file?fileName=target/stream-raw-retry/scanstreamraw.txt&scanStream=true&scanStreamDelay=100&retry=true&readLine=false")
+                        .routeId("raw").autoStartup(false)
+                        .convertBodyTo(String.class)
+                        .to("mock:result");
+            }
+        };
+    }
+
+}
diff --git 
a/components/camel-stream/src/test/java/org/apache/camel/component/stream/ScanStreamFileRawModeTest.java
 
b/components/camel-stream/src/test/java/org/apache/camel/component/stream/ScanStreamFileRawModeTest.java
new file mode 100644
index 000000000000..ca3707ebe334
--- /dev/null
+++ 
b/components/camel-stream/src/test/java/org/apache/camel/component/stream/ScanStreamFileRawModeTest.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.stream;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.nio.charset.StandardCharsets;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit6.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit6.TestSupport.createDirectory;
+import static org.apache.camel.test.junit6.TestSupport.deleteDirectory;
+import static org.awaitility.Awaitility.await;
+
+/**
+ * A stream consumer with scanStream=true and readLine=false must route the 
data it reads, both the data that is in the
+ * file when it starts and the data appended later.
+ */
+public class ScanStreamFileRawModeTest extends CamelTestSupport {
+
+    private File file;
+
+    @Override
+    public void doPreSetup() throws Exception {
+        deleteDirectory("target/stream-raw");
+        createDirectory("target/stream-raw");
+
+        file = new File("target/stream-raw/scanstreamraw.txt");
+        file.createNewFile();
+    }
+
+    @Test
+    public void testScanFileRawMode() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedBodiesReceived("Hello\nWorld\n", "Bye\n");
+        mock.message(0).header(StreamConstants.STREAM_INDEX).isEqualTo(0);
+        mock.message(1).header(StreamConstants.STREAM_INDEX).isEqualTo(1);
+        // a scanStream=true is never finished
+        
mock.message(0).header(StreamConstants.STREAM_COMPLETE).isEqualTo(false);
+        
mock.message(1).header(StreamConstants.STREAM_COMPLETE).isEqualTo(false);
+
+        try (FileOutputStream fos = new FileOutputStream(file)) {
+            fos.write("Hello\nWorld\n".getBytes(StandardCharsets.UTF_8));
+            fos.flush();
+
+            context.getRouteController().startAllRoutes();
+
+            // the data in the file when the consumer starts
+            await().atMost(10, TimeUnit.SECONDS).until(() -> 
mock.getReceivedCounter() >= 1);
+
+            // data appended to the file is picked up by a later scan
+            fos.write("Bye\n".getBytes(StandardCharsets.UTF_8));
+            fos.flush();
+        }
+
+        MockEndpoint.assertIsSatisfied(context, 10, TimeUnit.SECONDS);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            public void configure() {
+                
from("stream:file?fileName=target/stream-raw/scanstreamraw.txt&scanStream=true&scanStreamDelay=100&readLine=false")
+                        .routeId("raw").autoStartup(false)
+                        .convertBodyTo(String.class)
+                        .to("mock:result");
+            }
+        };
+    }
+
+}
diff --git 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/StreamEndpointBuilderFactory.java
 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/StreamEndpointBuilderFactory.java
index 5b090b97df22..9ed39472dc9b 100644
--- 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/StreamEndpointBuilderFactory.java
+++ 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/StreamEndpointBuilderFactory.java
@@ -282,8 +282,9 @@ public interface StreamEndpointBuilderFactory {
         }
         /**
          * Whether to read the input stream in line mode (terminate by line
-         * breaks). Setting this to false, will instead read the entire stream
-         * until EOL.
+         * breaks). Setting this to false, will instead read until the end of
+         * the stream. With scanStream, each exchange holds the bytes read in
+         * one scan.
          * 
          * The option is a: <code>boolean</code> type.
          * 
@@ -299,8 +300,9 @@ public interface StreamEndpointBuilderFactory {
         }
         /**
          * Whether to read the input stream in line mode (terminate by line
-         * breaks). Setting this to false, will instead read the entire stream
-         * until EOL.
+         * breaks). Setting this to false, will instead read until the end of
+         * the stream. With scanStream, each exchange holds the bytes read in
+         * one scan.
          * 
          * The option will be converted to a <code>boolean</code> type.
          * 

Reply via email to