-
-
Notifications
You must be signed in to change notification settings - Fork 10
tutorial debugging a flow
In this tutorial you learn how to debug a flow. We start with the flow created in the Quick Start.
Assimbly will let you reuse the flow configuration by cloning a flow. When cloning a flow the complete configuration is taken over.
- On the flows page click the 'clone' icon to clone the 'TestFlow'.
- The flow is completely configured but the name of the cloned flow is empty. We give it the name 'tutorial1'.
- To print more logging we change the log level from "OFF" to "INFO".
We also change the 'to' endpoint to force an error:
- Set the directory to C:\messages\out2 (this directory must not exist).
- Set the options 'directoryMustExist to true and 'autocreate' to false.
After the changes you can save the flow
- On the flows page start the flow
- Put a file (can be any file, for example sample.txt) in the "C:\messages\in" directory
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). There you find:
- The logged incoming message including headers.
- The flow route
- The stack trace
2020-04-24 18:54:40.523 DEBUG 5508 --- [ XNIO-1 task-3] o.a.gateway.web.rest.util.ResponseUtil : REST request with path /connector/{connectorId}/flow/failedlogentries/{id} for gateway with id 1
2020-04-24 18:56:02.312 DEBUG 5508 --- [ XNIO-1 task-2] o.a.gateway.web.rest.util.ResponseUtil : REST request with path /connector/{connectorId}/flow/failedlog/{id} for gateway with id 1
2020-04-24 19:04:27.739 INFO 5508 --- [5Cmessages%5Cin] RouteName.Tutorial1 : Exchange[
Id ID-win81-1587738992721-0-4
ExchangePattern InOnly
Properties {CamelBatchComplete=true, CamelBatchIndex=0, CamelBatchSize=1, CamelFileExchangeFile=GenericFile[C:\messages\in\sample.txt], CamelMessageHistory=[MetricsMessageHistory[routeId=2, node=setHeader6], MetricsMessageHistory[routeId=2, node=setHeader7], MetricsMessageHistory[routeId=2, node=setHeader8], MetricsMessageHistory[routeId=2, node=to7]], CamelToEndpoint=log://RouteName.Tutorial1?level=INFO&showAll=true&multiline=true&style=Fixed, MetricsRoutePolicy-2=com.codahale.metrics.Timer$Context@2e15f7e2}
Headers {AssimblyFlowID=2, AssimblyFrom=file://C:\messages\in, AssimblyHeaderId=null, CamelFileAbsolute=true, CamelFileAbsolutePath=C:\messages\in\sample.txt, CamelFileLastModified=1587747277588, CamelFileLength=0, CamelFileName=sample.txt, CamelFileNameConsumed=sample.txt, CamelFileNameOnly=sample.txt, CamelFileParent=C:\messages\in, CamelFilePath=C:\messages\in\sample.txt, CamelFileRelativePath=sample.txt}
BodyType org.apache.camel.component.file.GenericFile
Body [Body is file based: GenericFile[C:\messages\in\sample.txt]]
]
2020-04-24 19:04:27.763 ERROR 5508 --- [ #7 - Multicast] o.a.connector.routes.DefaultRoute : Failed delivery for (MessageId: ID-win81-1587738992721-0-5 on ExchangeId: ID-win81-1587738992721-0-5). Exhausted after delivery attempt: 1 caught: org.apache.camel.component.file.GenericFileOperationFailedException: Cannot store file: C:\messages\out2\sample.txt. Handled by DeadLetterChannel: [file://C:%5Cmessages%5Cerror]
Message History
---------------------------------------------------------------------------------------------------------------------------------------
RouteId ProcessorId Processor Elapsed (ms)
[2 ] [2 ] [from[file://C:%5Cmessages%5Cin] ] [ 24]
[2 ] [setHeader6 ] [setHeader[AssimblyFlowID] ] [ 0]
[2 ] [setHeader7 ] [setHeader[AssimblyHeaderId] ] [ 0]
[2 ] [setHeader8 ] [setHeader[AssimblyFrom] ] [ 0]
[2 ] [to7 ] [log:RouteName.Tutorial1?level=INFO&showAll=true&multiline=true&style=Fixed ] [ 0]
[2 ] [headerProcessor2 ] [Processor@0x65139872 ] [ 0]
[2 ] [multicast2 ] [multicast ] [ 0]
[2 ] [to8 ] [direct:flow=2endpoint=2 ] [ 0]
[2-2 ] [setHeader9 ] [setHeader[AssimblyHeaderId] ] [ 0]
[2-2 ] [setHeader10 ] [setHeader[AssimblyTo] ] [ 0]
[2-2 ] [headerProcessor2-2] [Processor@0x65139872 ] [ 0]
[2-2 ] [convertProcessor2-] [Processor@0x88625d ] [ 0]
[2-2 ] [choice2 ] [choice[when[{header(ReplyTo) contains :}],when[{header(ReplyTo) is not null}],] [ 0]
[2-2 ] [to11 ] [file://C:\messages\out2?directoryMustExist=true&autoCreate=false ] [ 0]
Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot store file: C:\messages\out2\sample.txt
at org.apache.camel.component.file.FileOperations.storeFile(FileOperations.java:389)
at org.apache.camel.component.file.GenericFileProducer.writeFile(GenericFileProducer.java:318)
at org.apache.camel.component.file.GenericFileProducer.processExchange(GenericFileProducer.java:172)
at org.apache.camel.component.file.GenericFileProducer.process(GenericFileProducer.java:78)
at org.apache.camel.support.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:67)
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:166)
at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.doRun(RedeliveryErrorHandler.java:702)
at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.run(RedeliveryErrorHandler.java:616)
at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:148)
at org.apache.camel.impl.engine.DefaultReactiveExecutor.schedule(DefaultReactiveExecutor.java:55)
at org.apache.camel.processor.MulticastProcessor.lambda$schedule$1(MulticastProcessor.java:284)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.nio.file.NoSuchFileException: C:\messages\in\sample.txt -> C:\messages\out2\sample.txt
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsFileCopy.copy(WindowsFileCopy.java:205)
at sun.nio.fs.WindowsFileSystemProvider.copy(WindowsFileSystemProvider.java:278)
at java.nio.file.Files.copy(Files.java:1274)
at org.apache.camel.component.file.FileOperations.writeFileByFile(FileOperations.java:432)
at org.apache.camel.component.file.FileOperations.storeFile(FileOperations.java:337)
... 15 common frames omitted
Note: 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 'tutorial1' flow and start the 'TestFlow'
- Now start the 'tutorial1' flow again.
You'll notice that the flow 'tutorial1' doesn't start. 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.