-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Support fileExistModeExpression() in Ftp.outboundGateway #9988
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Sounds reasonable. |
While implementing this feature, I noticed a logic inconsistency between
private String send(Message<?> message, String subDirectory, FileExistsMode mode) {
Assert.notNull(this.directoryExpressionProcessor, "'remoteDirectoryExpression' is required");
Assert.isTrue(!FileExistsMode.APPEND.equals(mode) || !this.useTemporaryFileName,
"Cannot append when using a temporary file name"); However, public void setFileExistsMode(FileExistsMode fileExistsMode) {
this.fileExistsMode = fileExistsMode;
if (FileExistsMode.APPEND.equals(fileExistsMode)) {
this.remoteFileTemplate.setUseTemporaryFileName(false);
}
} This seems problematic as it creates a structure where proper assertion validation becomes impossible. I think it would be more appropriate to remove this automatic configuration from However, I'm not sure about the best approach given backward compatibility concerns. What do you think? |
I'm not sure what mean. I might be OK to remove that assumption, but that indeed would be a breaking change for the next |
I meant that the assertion in The reason I'm asking is that I've implemented I thought it might be worth considering removing the automatic If this change is too significant for the current release cycle, are there better alternatives to maintain consistency while adding this feature? I'm looking for ways to safely handle dynamically changing modes at runtime while maintaining API consistency.. I'll go ahead and create a PR with my current implementation so you can review the approach and we can discuss further options! |
Right, I see your point now. I wonder if something like totally ignore |
Let me know what do you think about my last suggestion! |
I agree that ignoring |
Fixes: spring-projects#9988 Issue link: spring-projects#9988 This change allows dynamic determination of FileExistsMode using SpEL expressions, making the component more flexible when handling file existence conflicts. * Add fileExistsModeExpression field and setter methods * Use resolveFileExistsMode in put and get operations * Add changes to the docs Signed-off-by: Jooyoung Pyoung <[email protected]>
Fixes: spring-projects#9988 Issue link: spring-projects#9988 This change allows dynamic determination of FileExistsMode using SpEL expressions, making the component more flexible when handling file existence conflicts. * Add fileExistsModeExpression field and setter methods * Use resolveFileExistsMode in put and get operations * Add changes to the docs Signed-off-by: Jooyoung Pyoung <[email protected]>
Expected Behavior
The
Ftp.outboundGateway
should support afileExistModeExpression()
method that accepts a SpEL expression to dynamically determine the FileExistsMode at runtime. This would allow users to conditionally choose betweenREPLACE
,APPEND
,FAIL
, or other file exist modes based on message content or context variables.Current Behavior
Currently, the
Ftp.outboundGateway
only supportsfileExistMode()
which accepts a static FileExistsMode value. This mode is fixed at configuration time and cannot be changed dynamically during message processing.Context
I'd be willing to implement this feature if the team agrees it would be valuable to the Spring Integration community.
The text was updated successfully, but these errors were encountered: