Skip to content

Conversation

garyrussell
Copy link
Contributor

JIRA: https://jira.spring.io/browse/INT-3491

Select the session factory at runtime.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a bad name 😄
How about SessionFactoryLocator because it doesn't produce new instances, but return them by their key.
So, Selector is another candidate.
Holder...
Your ideas?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SessionFactoryLocator 👍

@garyrussell garyrussell force-pushed the INT-3491 branch 2 times, most recently from 5b5202b to b8ccfed Compare July 27, 2015 21:38
@garyrussell
Copy link
Contributor Author

Rebased, pushed.

@garyrussell garyrussell changed the title INT-3491: (S)FTP Delegation Session Factory INT-3491: (S)FTP Delegating Session Factory Jul 28, 2015
Also add/remove factories.
@artembilan
Copy link
Member

I think, I'm fine with the polishing.
Will be merged on its time soon

@artembilan
Copy link
Member

Merged as 13b4fac

@artembilan artembilan closed this Jul 30, 2015
@garyrussell garyrussell deleted the INT-3491 branch November 19, 2015 19:23
@vayalaivadivel
Copy link

Hi Team,
Can we have a snapshot/sample code to transfer message dynamically in sftp inbound adapter through using spring with polling frequency, host, port, user, password, path and archiveDirectory?

Thanks and Regards,
VADIVEL P M

@garyrussell
Copy link
Contributor Author

Can you explain your use case in more detail?

@vayalaivadivel
Copy link

Hi Gary Russell,
Thanks for your quick reply. My requirement is very simple. I need to create/cofingure one SFTP Inbound Adaptor with all require properties. We are using only mule based tomcat server.
Please let me know any more details.

Thanks and Regards,
VADIVEL PM.

@garyrussell
Copy link
Contributor Author

But that is a simple configuration using property placeholders - it's the "dynamic" piece that I don't understand.

@vayalaivadivel
Copy link

Below is the way we are going to configure SFTPInboundAdapter using xml,

<int-sftp:inbound-channel-adapter id="sftpAdapterAutoCreate"
              session-factory="sftpSessionFactory"
            channel="requestChannel"
            filename-pattern="*.txt"
            remote-directory="/foo/bar"
            preserve-timestamp="true"
            local-directory="file:target/foo"
            auto-create-local-directory="true"
            local-filename-generator-expression="#this.toUpperCase() + '.a'"
            local-filter="myFilter"
            temporary-file-suffix=".writing"
            delete-remote-files="false">
        <int:poller fixed-rate="1000"/>
</int-sftp:inbound-channel-adapter>

Please let me know any other way to do this using annotations.

@garyrussell
Copy link
Contributor Author

Any of those properties can be replaced with a property placeholder, e.g.

filename-pattern="${my.filename.pattern}"

See the Spring Reference about property placeholders.

For annotated java configuration, consider using the java dsl...

    @Bean
    public IntegrationFlow sftpInboundFlow() {
        return IntegrationFlows
                .from(Sftp.inboundAdapter(sftpSessionFactory())
                                .preserveTimestamp(true)
                                .remoteDirectory("sftpSource")
                                .regexFilter(".*\\.txt$")
                                .localFilenameExpression("#this.toUpperCase() + '.a'")
                                .localDirectory(this.sftpServer.getTargetLocalDirectory()),
                        e -> e.id("sftpInboundAdapter"))
                .channel(MessageChannels.queue("sftpInboundResultChannel"))
                .get();
    }

@vayalaivadivel
Copy link

Thanks a lot Gary. I have done this. I have to write JUnit or Groovy test case to test my changes. Can you please guide me with some sample code to test this?

@garyrussell
Copy link
Contributor Author

There are lots of tests in the framework itself.

In future, please don't ask questions like this on an old Pull Request, use Stack Overflow (tag spring-integration) or a github issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants