Results 1 to 4 of 4

Thread: Multiple FTPSources added dynamically

  1. #1
    Join Date
    Jul 2008
    Posts
    15

    Default 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. #2
    Join Date
    Oct 2007
    Location
    Toronto, ON
    Posts
    90

    Default

    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
    Marius Bogoevici,
    Spring Integration Committer

  3. #3
    Join Date
    Jul 2008
    Posts
    15

    Default

    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

  4. #4
    Join Date
    Jul 2008
    Posts
    15

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •