Reputation: 11212
I'm using the file and ftp features of Spring Integration to implement a flow which sees all files written to directory encrypted and then ftp'ed to a target directory. The payload of the message is a file
File Inbound Poller -> Custom Encryption -> Outbound FTP -> Handle Original File
The 'Custom Encryption' service takes in a file name, and then returns the name of the encrypted file. The Outbound FTP service works and on success or failure of the transfer, the encrypted file name is moved to a specific folder.
The new requirement is i need to move the original file name rather than the encrypted one. I'm unsure what is the correct way implement this or what options i have?
File Inbound Poller -> Custom Encryption -> Outbound FTP
| |
> > -> Handle Original File
The first idea I've considered using the Splitter/Aggregator pattern to generate a second message which is re-aggreated after the outbound ftp stage but this seems incorrect since the splitter is not generating two distinct messages, rather duplicating the original.
Upvotes: 1
Views: 838
Reputation: 174739
There are a number of ways to do it, including...
Make the first channel a <publish-subscribe-channel/>
subscribe the encrypter with order="1"
and the handler order="2"
. The handler will only be called after the other flow completes normally.
Add a <header-enricher/>
before the encryption service, to copy the original file to a header <header name="orig" expression="payload"/>
and then use the header in the downstream code.
The first is like your "splitter" comment - effectively allowing 2 flows to process the same message.
Upvotes: 3