-
-
Notifications
You must be signed in to change notification settings - Fork 9
tutorial debugging a flow
In this tutorial you learn how to debug a flow. We start with the flow we created with the Quick Start.
- On the flows page click the 'clone' icon to clone the 'TestFlow'.
- The cloned flow is completely configured, but the name of the flow is still empty. Give it the name: "DebugFlow".
We also change the 'SINK' step to force an error:
- Set the path to "C:\messages\out2". (this directory must not exist).
- Set the options "Directory Must Exist" to "true" and "Auto Create" to "false".
- Save the flow.
- On the flows page stop the TestFlow if it's still running.
- Put a new file
test.txt
into theC:\messages\in
directory. - Now start the DebugFlow flow.
You'll notice that an alert appears. When hovering the alert you get more information on the alert. This box shows the total number of alerts of this day and show the last three alerts on mouse hover.
- Now you can check your logs (either in the terminal or in the log file):
2024-09-16T16:07:41.980+02:00 ERROR 25080 --- [gateway] [5Cmessages%5Cin] org.assimbly.errorhandler.1400 : Failed delivery for (MessageId: 44280264BDC71B3-0000000000000005 on ExchangeId: 44280264BDC71B3-0000000000000005). Exhausted after delivery attempt: 1 caught: org.apache.camel.component.file.GenericFileOperationFailedException: Cannot store file: C:\messages\out2\test.txt. Handled by DeadLetterChannel: [file://C:\messages\error]
Message History
---------------------------------------------------------------------------------------------------------------------------------------
Source ID Processor Elapsed (ms)
generic-source.kamelet:43 1400-1450/1400-1450 from[file://C:%5Cmessages%5Cin] 81
generic-source.kamelet:45 1400-1450/to2 {{out}} 0
generic-sink.kamelet:45 1400-1500/toD2 {{uri}} 0
Exchange
---------------------------------------------------------------------------------------------------------------------------------------
Exchange[
Id 44280264BDC71B3-0000000000000005
Headers {breadcrumbId=44280264BDC71B3-0000000000000005, CamelFileAbsolute=true, CamelFileAbsolutePath=C:\messages\in\test.txt, CamelFileInitialOffset=org.apache.camel.support.resume.Resumables$AnonymousResumable@352d0b7f, CamelFileLastModified=1677600171873, CamelFileLength=4, CamelFileName=test.txt, CamelFileNameConsumed=test.txt, CamelFileNameOnly=test.txt, CamelFileNameProduced=C:\messages\error\test.txt, CamelFileParent=C:\messages\in, CamelFilePath=C:\messages\in\test.txt, CamelFileRelativePath=test.txt, CamelMessageTimestamp=1677600171873}
BodyType org.apache.camel.component.file.GenericFile
Body [Body is file based: GenericFile[C:\messages\in\test.txt]]
]
Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot store file: C:\messages\out2\test.txt
at org.apache.camel.component.file.FileOperations.storeFile(FileOperations.java:325)
at org.apache.camel.component.file.GenericFileProducer.writeFile(GenericFileProducer.java:342)
at org.apache.camel.component.file.GenericFileProducer.processExchange(GenericFileProducer.java:154)
at org.apache.camel.component.file.GenericFileProducer.process(GenericFileProducer.java:80)
at org.apache.camel.support.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:65)
at org.apache.camel.processor.SendDynamicProcessor.lambda$process$1(SendDynamicProcessor.java:225)
at org.apache.camel.support.cache.DefaultProducerCache.doInAsyncProducer(DefaultProducerCache.java:281)
at org.apache.camel.processor.SendDynamicProcessor.process(SendDynamicProcessor.java:205)
at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.doRun(RedeliveryErrorHandler.java:808)
at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.run(RedeliveryErrorHandler.java:714)
at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.doRun(DefaultReactiveExecutor.java:199)
at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.executeReactiveWork(DefaultReactiveExecutor.java:189)
at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.tryExecuteReactiveWork(DefaultReactiveExecutor.java:166)
at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:148)
at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:59)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:163)
at org.apache.camel.impl.engine.CamelInternalProcessor.processNonTransacted(CamelInternalProcessor.java:347)
at org.apache.camel.impl.engine.CamelInternalProcessor.process(CamelInternalProcessor.java:323)
at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:457)
at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:243)
at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:204)
at org.apache.camel.support.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:205)
at org.apache.camel.support.ScheduledPollConsumer.run(ScheduledPollConsumer.java:119)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:358)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.nio.file.NoSuchFileException: C:\messages\in\test.txt -> C:\messages\out2\test.txt
at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:85)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
at java.base/sun.nio.fs.WindowsFileCopy.copy(WindowsFileCopy.java:220)
at java.base/sun.nio.fs.WindowsFileSystemProvider.copy(WindowsFileSystemProvider.java:282)
at java.base/java.nio.file.Files.copy(Files.java:1304)
at org.apache.camel.component.file.FileOperations.writeFileByFile(FileOperations.java:483)
at org.apache.camel.component.file.FileOperations.handleFileAsFileSource(FileOperations.java:377)
at org.apache.camel.component.file.FileOperations.storeFile(FileOperations.java:301)
... 28 common frames omitted
Tip: The last lines of the log file can also be seen from Administration --> Log viewer
In the last step of this tutorial we will force an error on startup.
- Stop the 'DebugFlow' flow and start the 'TestFlow'
- Now start the 'DebugFlow' flow again.
You'll notice that the 'DebugFlow' flow doesn't start (at least on Windows, some other operatings systems allow this). This is because the other flow already listens to the same directory and this is not allowed. Click on the flow name to see a detailed error message.
Now you completed this tutorial. You can continue to the next tutorial with an example of a request/reply flow.