Announcement Announcement Module
Collapse
No announcement yet.
Multiple FTPSources added dynamically Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multiple FTPSources added dynamically

    Hello

    I have the following scenario:

    In a database I have FTP-Servers (about 60), which I want to use as FTP-Sources. On every FTP-Server 4 different file types should be polled and handled by the application. Additional FTP-Sources can be added while the application is running.

    Are these to much FTP-Sources for spring integration?

    Is it possible to add new FTP-Sources dynamically or have these to be configured before starting the application?

    Is filtering by suffix possible in FTP-Sources? (It is possible in FileSources, but I can't see it in FTP-Sources).

    Best regards,
    Maarten Donders

  • #2
    Hi Maarten,

    In principle you can have as many sources as you want.

    For now, this kind of filtering is not possible, but you could retrieve all files with an FtpSource and then use a Router (or a MessageSelector) to send them to different handlers for processing. Of course, this currently has the major inconvenience that will still retrive *all* files, regardless whether the intent is to process them or not.

    Please follow on http://jira.springframework.org/browse/INT-294 as we intend to improve the functionality in this respect.

    Regards,
    Marius

    Comment


    • #3
      Hi Marius,

      Thank you for answering!

      Is it possible to add (and remove) the FTPSources dynamically instead of by configuration?

      I'll follow the jira request.

      Regards,
      Maarten

      Comment


      • #4
        Just to answer my own question, it is straightforward. E.G. to register a file-source with 1.0M4:

        MessageBus messageBus = (MessageBus) applicationContext.getBean(MessageBusParser.MESSAG E_BUS_BEAN_NAME);
        FileSource fileSource = new FileSource(dir, messageCreator);
        Schedule schedule = new PollingSchedule(pollingIntervalInMS);
        MessageChannel channel = messageBus.lookupChannel(channelName);
        SourceEndpoint fileSourceEndpoint = new SourceEndpoint(fileSource, channel, schedule);
        messageBus.registerEndpoint(fileSourceId, fileSourceEndpoint);

        Unregister:
        messageBus.unregisterEndpoint(fileSourceId);

        Regards,
        Maarten

        Comment

        Working...
        X