Get ahead
VMware offers training and certification to turbo-charge your progress.
Learn moreOn behalf of the Spring Integration team I’d like to announce release of one more Spring Integration Extension. This time it is Spring Integration for Server Message Block and its artifact is spring-integration-smb.0.5.0.RELEASE
, which is available in the Release Repository and Maven Central.
The project has been around for some time but only recently gained enough community traction to warrant a release. So, first of all, big thanks to you, the community, for your contributions!
The Java CIFS Client Library has been chosen as a Java implementation for the CIFS/SMB networking protocol. Its SmbFile
abstraction is simply wrapped to the Spring Integration "Remote File" foundations like SmbSession
, SmbRemoteFileTemplate
etc.
The SMB Channel Adapters and support classes implementations are fully similar to existing components for (S)FTP or AWS S3 protocols. So, if you familiar with those components, it is pretty straightforward to use this extension. But any way here are several words about existing components:
To download SMB files locally the SmbInboundFileSynchronizingMessageSource
is provided. It is simple extension of the AbstractInboundFileSynchronizingMessageSource
which requires SmbInboundFileSynchronizer
injection. For filtering remote files you still can use any existing FileListFilter
implementations, but particular SmbRegexPatternFileListFilter
and SmbSimplePatternFileListFilter
are provided. For XML configuration the <int-smb:inbound-channel-adapter>
component is provided.
There is no (yet) some SMB specific requirements for files transferring to SMB, so for XML <int-smb:outbound-channel-adapter>
component we simply reuse an existing FileTransferringMessageHandler
. In case of Java configuration that FileTransferringMessageHandler
should be supplied with the SmbSessionFactory
(or SmbRemoteFileTemplate
) and that all!
@ServiceActivator(inputChannel = "storeToSmb")
@Bean
public MessageHandler smbMessageHandler(SmbSessionFactory smbSessionFactory) {
FileTransferringMessageHandler<SmbFile> handler =
new FileTransferringMessageHandler<>(smbSessionFactory);
handler.setRemoteDirectoryExpression(
new LiteralExpression("remote-target-dir"));
handler.setFileNameGenerator(m ->
m.getHeaders().get(FileHeaders.FILENAME, String.class) + ".test");
handler.setAutoCreateDirectory(true);
return handler;
}
We would like to hear any feedback from the Community before we go straight forward to the 1.0.0.RELEASE
, so, do not hesitate to contact with us via any available communication channel!
Project Page | Help | Chat