我正在使用MultipartityBuilder向服务器发送一个文件,当服务器没有响应或发生任何其他异常时,文件应该转到deadLetterChennal端点并保存为文件。一切正常,但deadLetterChennal显示转换问题。
from("direct:sendFileExchange")
.errorHandler(deadLetterChannel("file:/home/r2/Desktop/ofBizFile/errorFinalServer")
.asyncDelayedRedelivery()
.maximumRedeliveries(3)
.redeliveryDelay(1000)
.retryAttemptedLogLevel(LoggingLevel.WARN))
.startupOrder(3)
.process(new ProcessorSetFileRequest())
.setHeader(Exchange.HTTP_METHOD, constant("POST"))
.setHeader(Exchange.HTTP_QUERY,constant("USERNAME=__&PASSWORD=_"))
.to("https4://someAddress/uploadAndImportFileFromCSVFile?throwExceptionOnFailure=false")
.to("stream:out");
字符串
deadLetter文件不在目录中。我可以在路由中设置类型转换器吗?
我得到的错误:
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot store file: /home/r2/Desktop/ofBizFile/errorFinalServer/orders-02-01-2018.csv
Caused by: [org.apache.camel.NoTypeConversionAvailableException - No type converter available to convert from type:
org.apache.http.entity.mime.MultipartFormEntity to the required type: java.io.InputStream with value org.apache.http.entity.mime.MultipartFormEntity@ddf0916]
型
2条答案
按热度按时间vngu2lb81#
你可以这样做
字符串
5anewei62#
从org.apache.hc.client5.http.entity.mime导入MultipartFormEntity