Results 1 to 5 of 5

Thread: file inbound channel adapter/sftp channel adapter

  1. #1
    Join Date
    Feb 2012
    Posts
    101

    Default file inbound channel adapter/sftp channel adapter

    Hi,

    I have an inbound channel adapter which has a poller configured at 5 am daily with cron expression.

    The files on the inbound channel are read from a directory and sent to a channel which is then sftp'ed to a remote directory.

    The question I have here is, can I have another xml configuration file with an inbound channel that has the same id as the first one
    which also has a poller configured with a fixed delay at every 15 minute interval.the files will be read from a different directory and sftp'ed to a remote directory.Can I have multiple configuration on the same channel id.

    [HTML]
    <int:inbound-channel-adapter id="inboundAdapter"
    expression="new java.io.File('${xxx.localDir}').listFiles()">
    <intoller fixed-delay="900000">
    </intoller>
    </int:inbound-channel-adapter>

    <int:inbound-channel-adapter id="inboundAdapter"
    expression="new java.io.File('${yyy.localDir}').listFiles()">
    <intoller cron="0 0 5 0 0 0">
    </intoller>
    </int:inbound-channel-adapter>
    {/HTML]


    Not sure if this is clear.Please help with this one.

    Thanks

  2. #2
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,017

    Default

    If you want to have multiple adapters feed into the same flow, give each adapter a different ID, but set their "channel" attribute to the same channel.

    Don't use implicit channel naming for this case.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  3. #3
    Join Date
    Feb 2012
    Posts
    101

    Default

    Please correct me if wrong.From what I understand..In both the cases we will be referring to the same method in the same bean which constructs the message and sends it in the sftpchannel.


    HTML Code:
            <int:inbound-channel-adapter id="[B][I][U]inboundAdapter1"[/U][/I][/B]
    		expression="new java.io.File('${xxx.localDir}').listFiles()">
    		<int:poller fixed-delay="900000">
    		</int:poller>
    	</int:inbound-channel-adapter>
    
           <int:channel id="[B][U]sendChannel[/U][/B]" />
    	<int:service-activator input-channel=[B][I][U]"inboundAdapter1[/U][/I][/B]"
    		ref="XXX" method="sendFile" />
    
    	<bean id="XXX" class="<classpath.">
    	</bean>
    
        	<sftp:outbound-channel-adapter channel="[B][I][U]sendChannel[/U][/I][/B]"
    		session-factory="sftpSessionFactory" id="[I][U][B]sftpInboundAdapter1[/B][/U][/I]"
    		auto-create-directory="true" temporary-file-suffix="temp"
    		remote-directory-expression="headers['remote-directory']" />
    In the second case, its going to be..

    HTML Code:
     <int:inbound-channel-adapter id=[B][I][U]"inboundAdapter2"[/U][/I][/B]
    		expression="new java.io.File('${yyy.localDir}').listFiles()">
    		<int:poller cron="0 0 5 0 0 0">
    		</int:poller>
    	</int:inbound-channel-adapter>
    
           <int:channel id="[B][U]sendChannel[/U][/B]" />
    	<int:service-activator input-channel=[B][I][U]"inboundAdapter2[/U][/I][/B]"
    		ref="XXX" method="sendFile" />
    
    	<bean id="XXX" class="<classpath.">
    	</bean>
    
    <sftp:outbound-channel-adapter channel="[B][I][U]sendChannel[/U][/I][/B]"
    		session-factory="sftpSessionFactory" id="[I][U][B]sftpInboundAdapter2[/B][/U][/I]"
    		auto-create-directory="true" temporary-file-suffix="temp"
    		remote-directory-expression="headers['remote-directory']" />

    Thanks

  4. #4
    Join Date
    Feb 2012
    Posts
    101

    Default

    In the above thread the bold ,italic and the underline tags doesn't seem to work.Sorry for the confusion.Wherever it is [B],[I],[u] ,I wanted to highlight it.
    looks like it did not work.

  5. #5
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,017

    Default

    You should use <int:inbound-channel-adapter id="inboundAdapter1" channel="sendChannel" ... />

    You should NOT give the outbound channel adapters the same names as their inbound adapters.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

Tags for this Thread

Posting Permissions

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