[
https://issues.apache.org/jira/browse/CAMEL-18476?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17607226#comment-17607226
]
Karen Lease commented on CAMEL-18476:
-------------------------------------
[~Ramarajan] I believe the bug is not in Camel JMS but in ActiveMQ itself. In
fact when the message is streamed and the compression flag is set, then the
input stream is not closed.
The offending code is
[here|[https://github.com/apache/activemq-artemis/blob/1974ec528975350a03eb7b254664edc338ac4328/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientProducerImpl.java#L479-L487]|https://github.com/apache/activemq-artemis/blob/1974ec528975350a03eb7b254664edc338ac4328/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientProducerImpl.java#L479-L487].]
In your test case, I changed this line in ConsumerBeanConfiguration.java to
disable compression of large messages:
{code:java}
coreConsumerConnectionFactory.setCompressLargeMessage(false);{code}
I don't have a windows system for testing but I observe that in this case, the
input stream in the message is closed so I assume that would solve your issue.
> when artemis streaming enabled then Camel-jms component is not closing
> inputstream for Bytes message, blocking deletion of file after its archived
> in windows
> -------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-18476
> URL: https://issues.apache.org/jira/browse/CAMEL-18476
> Project: Camel
> Issue Type: Bug
> Components: camel-jms
> Affects Versions: 3.14.3, 3.18.1
> Reporter: Ramarajan R
> Priority: Minor
> Fix For: 3.18.3, 3.19.0
>
> Attachments: artemis-large-messages-final.zip,
> artemis-large-messages.zip
>
>
> I have used
> [https://github.com/apache/camel-examples/tree/main/examples/artemis-large-messages]
> using AMQ 7.8.0 Broker
> Messages are getting processed but after processing the file is unable to
> delete from source location, tested in more than 1 windows systems facing the
> same
> I am using Camel 3.14.3 and Spring boot 2.6.6 using JAVA DSL,
> tested with Camel 3.18.1 and Spring boot 2.7.3 also
> when running with Camel XML routes are fine but we want to use Java DSL ,
> Kindly help.
> Raising the concern in Zulip chat earlier.
> {{[https://camel.zulipchat.com/#narrow/stream/257298-camel/topic/camel-file.20artemis.20large.20message.20example.20failing.20in.20windows]
> }}{{{}tion-poc/inbox0] o.a.c.c.file.GenericFileOnCompletion : Error during
> commit. Exchange[7D4CFE29E3F7515-0000000000000003]. Caused by:
> [org.apache.camel.component.file.GenericFileOperationFailedException - Error
> renaming file from C:\opt\file-transfer-solution-poc\inbox0\test.xlsx to
> C:\opt\file-transfer-solution-poc\inbox0\.camel\test.xlsx]{}}}{{{}org.apache.camel.component.file.GenericFileOperationFailedException:
> Error renaming file from C:\opt\file-transfer-solution-poc\inbox0\test.xlsx
> to C:\opt\file-transfer-solution-poc\inbox0\.camel\test.xlsx{}}}
> {{at
> org.apache.camel.component.file.FileOperations.renameFile(FileOperations.java:93)
> ~[camel-file-3.14.3.jar:3.14.3]}}
> {{at
> org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.renameFile(GenericFileProcessStrategySupport.java:145)
> ~[camel-file-3.14.3.jar:3.14.3]}}
> {{at
> org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.commit(GenericFileRenameProcessStrategy.java:121)
> ~[camel-file-3.14.3.jar:3.14.3]}}
> {{at
> org.apache.camel.component.file.GenericFileOnCompletion.processStrategyCommit(GenericFileOnCompletion.java:134)
> ~[camel-file-3.14.3.jar:3.14.3]}}
> {{at
> org.apache.camel.component.file.GenericFileOnCompletion.onCompletion(GenericFileOnCompletion.java:86)
> ~[camel-file-3.14.3.jar:3.14.3]}}
> {{at
> org.apache.camel.component.file.GenericFileOnCompletion.onComplete(GenericFileOnCompletion.java:60)
> ~[camel-file-3.14.3.jar:3.14.3]}}
> {{at
> org.apache.camel.support.UnitOfWorkHelper.doneSynchronization(UnitOfWorkHelper.java:104)
> ~[camel-support-3.14.3.jar:3.14.3]}}
> {{at
> org.apache.camel.support.UnitOfWorkHelper.doneSynchronizations(UnitOfWorkHelper.java:93)
> ~[camel-support-3.14.3.jar:3.14.3]}}
> {{at
> org.apache.camel.impl.engine.DefaultUnitOfWork.done(DefaultUnitOfWork.java:238)
> ~[camel-base-engine-3.14.3.jar:3.14.3]}}
> {{at
> org.apache.camel.support.UnitOfWorkHelper.doneUow(UnitOfWorkHelper.java:61)
> ~[camel-support-3.14.3.jar:3.14.3]}}
> {{at
> org.apache.camel.impl.engine.CamelInternalProcessor$UnitOfWorkProcessorAdvice.after(CamelInternalProcessor.java:777)
> ~[camel-base-engine-3.14.3.jar:3.14.3]}}
> {{at
> org.apache.camel.impl.engine.CamelInternalProcessor$UnitOfWorkProcessorAdvice.after(CamelInternalProcessor.java:712)
> ~[camel-base-engine-3.14.3.jar:3.14.3]}}
> {{at
> org.apache.camel.impl.engine.CamelInternalProcessor$AsyncAfterTask.done(CamelInternalProcessor.java:263)
> ~[camel-base-engine-3.14.3.jar:3.14.3]}}
> {{at org.apache.camel.AsyncCallback.run(AsyncCallback.java:44)
> ~[camel-api-3.14.3.jar:3.14.3]}}
> {{at
> org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:193)
> ~[camel-base-engine-3.14.3.jar:3.14.3]}}
> {{at
> org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:64)
> ~[camel-base-engine-3.14.3.jar:3.14.3]}}
> {{at org.apache.camel.processor.Pipeline.process(Pipeline.java:184)
> ~[camel-core-processor-3.14.3.jar:3.14.3]}}
> {{at
> org.apache.camel.impl.engine.CamelInternalProcessor.process(CamelInternalProcessor.java:398)
> ~[camel-base-engine-3.14.3.jar:3.14.3]}}
> {{at
> org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:492)
> ~[camel-file-3.14.3.jar:3.14.3]}}
> {{at
> org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:245)
> ~[camel-file-3.14.3.jar:3.14.3]}}
> {{at
> org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:206)
> ~[camel-file-3.14.3.jar:3.14.3]}}
> {{at
> org.apache.camel.support.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:202)
> ~[camel-support-3.14.3.jar:3.14.3]}}
> {{at
> org.apache.camel.support.ScheduledPollConsumer.run(ScheduledPollConsumer.java:116)
> ~[camel-support-3.14.3.jar:3.14.3]}}
> {{at
> java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
> ~[na:na]}}
> {{at
> java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
> ~[na:na]}}
> {{at
> java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
> ~[na:na]}}
> {{at
> java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
> ~[na:na]}}
> {{at
> java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
> ~[na:na]}}
> {{at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]}}
> {{Caused by: java.io.IOException: Renaming file from
> 'C:\opt\file-transfer-solution-poc\inbox0\test.xlsx' to
> 'C:\opt\file-transfer-solution-poc\inbox0\.camel\test.xlsx'}}
> {{failed: Cannot delete file
> 'C:\opt\file-transfer-solution-poc\inbox0\test.xlsx' after copy succeeded}}
> {{at org.apache.camel.util.FileUtil.renameFileUsingCopy(FileUtil.java:464)
> ~[camel-util-3.14.3.jar:3.14.3]}}
> {{at
> org.apache.camel.component.file.FileOperations.renameFile(FileOperations.java:88)
> ~[camel-file-3.14.3.jar:3.14.3]}}
> {{{}... 28 common frames omitted{}}}{{{}</code>{}}}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)