Description
Expected Behavior
When using SmbStreamingMessageSource
, in the doReceive() function, should be able to retry remoteFileToMessage() call with a RetryTemplate
that can be set via SmbStreamingInboundChannelAdapterSpec
.
Current Behavior
AbstractRemoteFileStreamingMessageSource#remoteFileToMessage
is only called once. Network errors can cause the call to fail when resolving SmbFileInfo
and drop the file from being processed.
Context
I wrote an integration flow that streams/processes zip files from a shared folder in a defined order. Occasionally, the process hits a network error when resolving the SmbFileInfo
for the remote file and gets dropped from processing. Handling the messageException in the errorChannel will cause the zip files to be processed out of order.
Could not simply extend SmbStreamingMessageSource
and add a RetryTemplate
because the class properties used by the doReceive() function are private. I had to copy/paste AbstractRemoteFileStreamingMessageSource
into my project, add a RetryTemplate
and modify the call to remoteFileToMessage (line 214).
return remoteFileToMessage(file);
->
var processFile = file;
return retry.execute(ctx -> {
if (ctx.getRetryCount() > 0)
logger.info(ctx::toString);
return remoteFileToMessage(processFile);
});