This is really weird, when I add the logging-channel-adapter there is no more exception thrown but the message is not consumed and not delivered.
Below the log with and without the logging-channel-adapter.
The ONLY thing that I have changed in the config
Code:
<int:logging-channel-adapter channel="fileToStringChannel" level="DEBUG"/>
Stacktrace without the logging-channel-adapter
Code:
INFO : org.springframework.integration.endpoint.SourcePollingChannelAdapter - started org.springframework.integration.config.SourcePollingChannelAdapterFactoryBean#0
INFO : org.apache.activemq.transport.failover.FailoverTransport - Successfully connected to tcp://localhost:61616
DEBUG: org.springframework.integration.file.FileReadingMessageSource - Added to queue: [c:\temp\scm\messageA2.xml]
INFO : org.springframework.integration.file.FileReadingMessageSource - Created message: [[Payload=c:\temp\scm\messageA2.xml][Headers={timestamp=1336397994640, id=1537f333-895c-437e-92a8-c8d20cb5c693}]]
DEBUG: org.springframework.integration.endpoint.SourcePollingChannelAdapter - Poll resulted in Message: [Payload=c:\temp\scm\messageA2.xml][Headers={timestamp=1336397994640, id=1537f333-895c-437e-92a8-c8d20cb5c693}]
DEBUG: org.springframework.integration.channel.DirectChannel - preSend on channel 'fileToStringChannel', message: [Payload=c:\temp\scm\messageA2.xml][Headers={timestamp=1336397994640, id=1537f333-895c-437e-92a8-c8d20cb5c693}]
DEBUG: org.springframework.integration.transformer.MessageTransformingHandler - org.springframework.integration.transformer.MessageTransformingHandler#0 received message: [Payload=c:\temp\scm\messageA2.xml][Headers={timestamp=1336397994640, id=1537f333-895c-437e-92a8-c8d20cb5c693}]
DEBUG: org.springframework.integration.channel.PublishSubscribeChannel - preSend on channel 'errorChannel', message: [Payload=org.springframework.integration.transformer.MessageTransformationException: org.springframework.integration.MessagingException: failed to transform File Message][Headers={timestamp=1336397994835, id=53d30828-4635-4fac-9612-e361801460ae}]
DEBUG: org.springframework.integration.handler.LoggingHandler - (inner bean)#4 received message: [Payload=org.springframework.integration.transformer.MessageTransformationException: org.springframework.integration.MessagingException: failed to transform File Message][Headers={timestamp=1336397994835, id=53d30828-4635-4fac-9612-e361801460ae}]
ERROR: org.springframework.integration.handler.LoggingHandler - org.springframework.integration.transformer.MessageTransformationException: org.springframework.integration.MessagingException: failed to transform File Message
at org.springframework.integration.transformer.MessageTransformingHandler.handleRequestMessage(MessageTransformingHandler.java:73)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:97)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73)
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:115)
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:102)
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:157)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:128)
at org.springframework.integration.core.MessagingTemplate.doSend(MessagingTemplate.java:288)
at org.springframework.integration.core.MessagingTemplate.send(MessagingTemplate.java:149)
at org.springframework.integration.endpoint.SourcePollingChannelAdapter.doPoll(SourcePollingChannelAdapter.java:97)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:146)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:144)
...
at $Proxy9.call(Unknown Source)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1.run(AbstractPollingEndpoint.java:207)
at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:52)
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:48)
at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:49)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:202)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:53)
at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)
...
at java.lang.Thread.run(Thread.java:662)
Caused by: org.springframework.integration.MessagingException: failed to transform File Message
at org.springframework.integration.file.transformer.AbstractFilePayloadTransformer.transform(AbstractFilePayloadTransformer.java:71)
at org.springframework.integration.transformer.MessageTransformingHandler.handleRequestMessage(MessageTransformingHandler.java:67)
... 38 more
Caused by: java.io.IOException: Le processus ne peut pas accéder au fichier car un autre processus en a verrouillé une partie
at java.io.FileInputStream.readBytes(Native Method)
at java.io.FileInputStream.read(FileInputStream.java:220)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)
at java.io.InputStreamReader.read(InputStreamReader.java:167)
at java.io.Reader.read(Reader.java:123)
at org.springframework.util.FileCopyUtils.copy(FileCopyUtils.java:188)
at org.springframework.util.FileCopyUtils.copyToString(FileCopyUtils.java:240)
at org.springframework.integration.file.transformer.FileToStringTransformer.transformFile(FileToStringTransformer.java:49)
at org.springframework.integration.file.transformer.FileToStringTransformer.transformFile(FileToStringTransformer.java:32)
at org.springframework.integration.file.transformer.AbstractFilePayloadTransformer.transform(AbstractFilePayloadTransformer.java:58)
... 39 more
DEBUG: org.springframework.integration.channel.PublishSubscribeChannel - postSend (sent=true) on channel 'errorChannel', message: [Payload=org.springframework.integration.transformer.MessageTransformationException: org.springframework.integration.MessagingException: failed to transform File Message][Headers={timestamp=1336397994835, id=53d30828-4635-4fac-9612-e361801460ae}]
Stacktrace with the logging-channel-adapter
Code:
INFO : org.springframework.integration.endpoint.SourcePollingChannelAdapter - started org.springframework.integration.config.SourcePollingChannelAdapterFactoryBean#0
INFO : org.apache.activemq.transport.failover.FailoverTransport - Successfully connected to tcp://localhost:61616
DEBUG: org.springframework.integration.file.FileReadingMessageSource - Added to queue: [c:\temp\scm\messageA2.xml]
INFO : org.springframework.integration.file.FileReadingMessageSource - Created message: [[Payload=c:\temp\scm\messageA2.xml][Headers={timestamp=1336397894635, id=4c487c7c-0932-4a03-86c6-02b25403a071}]]
DEBUG: org.springframework.integration.endpoint.SourcePollingChannelAdapter - Poll resulted in Message: [Payload=c:\temp\scm\messageA2.xml][Headers={timestamp=1336397894635, id=4c487c7c-0932-4a03-86c6-02b25403a071}]
DEBUG: org.springframework.integration.channel.DirectChannel - preSend on channel 'fileToStringChannel', message: [Payload=c:\temp\scm\messageA2.xml][Headers={timestamp=1336397894635, id=4c487c7c-0932-4a03-86c6-02b25403a071}]
DEBUG: org.springframework.integration.transformer.MessageTransformingHandler - org.springframework.integration.transformer.MessageTransformingHandler#0 received message: [Payload=c:\temp\scm\messageA2.xml][Headers={timestamp=1336397894635, id=4c487c7c-0932-4a03-86c6-02b25403a071}]
DEBUG: org.springframework.integration.handler.LoggingHandler - org.springframework.integration.handler.LoggingHandler#0 received message: [Payload=c:\temp\scm\messageA2.xml][Headers={timestamp=1336397894635, id=4c487c7c-0932-4a03-86c6-02b25403a071}]
INFO : org.springframework.integration.handler.LoggingHandler - c:\temp\scm\messageA2.xml
DEBUG: org.springframework.integration.channel.DirectChannel - postSend (sent=true) on channel 'fileToStringChannel', message: [Payload=c:\temp\scm\messageA2.xml][Headers={timestamp=1336397894635, id=4c487c7c-0932-4a03-86c6-02b25403a071}]
INFO : org.apache.activemq.transport.failover.FailoverTransport - Successfully connected to tcp://localhost:61616
DEBUG: org.springframework.integration.endpoint.SourcePollingChannelAdapter - Poll resulted in Message: null
DEBUG: org.springframework.integration.endpoint.SourcePollingChannelAdapter - Received no Message during the poll, returning 'false'