0
votes

I am trying send message from int-file:inbound-channel-adapter to int-ftp:outbound-channel-adapter for moving file to remote directory and int-ftp:outbound-gateway to delete file in remote directory.

Now int-file:inbound-channel-adapter polls and sends message to int-ftp:outbound-channel-adapter and when it polls second time sends message to int-ftp:outbound-gateway.

By using int:splitter i am still able to receive single message for single file and only one channel is getting invoke. I want to send every poll message to both channels.

Example follows:

Now working as:

  1. First time polls sends message to int-ftp:outbound-channel-adapter
  2. Second time polls sends message to int-ftp:outbound-gateway
  3. Third time polls sends message to int-ftp:outbound-channel-adapter
  4. Fourth time polls sends message to int-ftp:outbound-gateway

Want to achieve as:

1.First time polls sends message to int-ftp:outbound-channel-adapter and int-ftp:outbound-gateway 2.Second time polls sends message to int-ftp:outbound-channel-adapter and int-ftp:outbound-gateway

Thanks in advance

<int-file:inbound-channel-adapter id="inErrorINPRm"
                                channel="errorRm" 
                                directory="in/error"
                                >
    <int:poller fixed-rate="5000" />
</int-file:inbound-channel-adapter>

<int:channel id="errorRm"></int:channel>
<int:channel id="ErrorRmMv"></int:channel>
<int:channel id="ftpINPfromError"></int:channel>

<int:splitter id="splitter" input-channel="errorRm" output-channel="ErrorRmMv"/>

<int-ftp:outbound-channel-adapter id="ftpError"
                                channel="ErrorRmMv" 
                                session-factory="ClientFactory"
                                auto-create-directory="true"
                                remote-directory="in/error"
                                >
</int-ftp:outbound-channel-adapter>

<int:header-enricher id="header-enricher-error" input-channel="ErrorRmMv" output-channel="ftpINPfromError">
    <int:header name="file_remoteDirectory" value="in/working"/>

</int:header-enricher>

<int-ftp:outbound-gateway id="gatewayRmfromError"
                          session-factory="ClientFactory"
                          expression="file_remoteDirectory"
                          request-channel="ftpINPfromError" 
                          command="rm" 
                          >
</int-ftp:outbound-gateway>
1

1 Answers

0
votes

The splitter has nothing to split - the payload is already a single File.

Splitters are for splitting, say, a list to a message for each list element.

You need to make the input channel for the adapter, and header enricher a <int:publish-subscribe-channel/> - you can add order="1" to the adapter and order="2" to the enricher, to make it clear the order in which they are called.