1

The basis is that our clients will be able to register their own endpoints. At the first time, I implemented a treatment for only one client who like to download files from his ftp server and processing files line per line then calling HTTP WS...etc The processing is like this:

ftp-inbound-channel-adapter --> file-inbound-channel-adapter --> int-file:splitter -->int-http:outbound-gateway -->servie activator -->mail-outbound-channel-adaper

The problem is that new clients like to register their own files and processing the same treatment separately because , if one client files is interrupted, it shouldn't interrupt another client. So each download source should be treated separately and can be processed in parallel with another source.

Each client should specify his ftp server details, http web services and email details.

Is there any simple/complex way that would allow us to essentially do runtime instantiations for the chain of endpoints...

thanks

NAZEHA
  • 455
  • 9
  • 24

1 Answers1

0

Please, take a look into the answer of the question how dynamic create ftp adapter in spring integration?.

Generally speaking we have there a sample which let you "put each adapter in a child context that send messages to a channel in the main context".

Please, follow with all the instructions there and you dynamic logic should be fine.

Community
  • 1
  • 1
Artem Bilan
  • 113,505
  • 11
  • 91
  • 118
  • Each client should be processed in a separate thread , the chain above will be instanciated for each new client. So i understand that i will create a context for each one without a main context because there isn't a common channel for all this client . They only go through the same processing and each one with his own prameters. Is that possible ? – NAZEHA Jun 20 '16 at 21:09
  • Right, you can live without that "common channel", but the principle is still the same: you build child ctx and provide a desired `Environment` and bootstrap the flow based on that one. Of course, each such a child instance will live in its own thread. Also you can take a look into Spring Integration Flow project: https://github.com/spring-projects/spring-integration-flow – Artem Bilan Jun 20 '16 at 21:14
  • I think that the spring integration Flow project is the suitable solution for my case. But i note in this flow project that each flow is invoked via an outbound-gateway which should have an input channel . For my case the flow contains the processing as described above and it starts with an ftp-inbound-channel-adapter, so the input-channel will be useless, it will make a problem if i declare it without using it into the flow ? – NAZEHA Jun 21 '16 at 21:23
  • Well, I understand your point there. And you are right, `spring-integration-flow` doesn't fit to your requirements. So, let's comeback to the original answer regarding ` child context` for each client. – Artem Bilan Jun 21 '16 at 21:36
  • Sorry but i didn't understand how to create child context for my flow which begin by ftp-inbound- adapter, is there an example to explain it. Because the dynamic-ftp-adapter sample is used for outbound-adapter . Is it the same logic ? – NAZEHA Jun 21 '16 at 23:08
  • Exactly! The logic is fully similar to have some config and initiate the applicationContext creation. The parent-child semantics you can find in the Spring reference manual – Artem Bilan Jun 21 '16 at 23:11