I have a basic flow:
gateway
3x ftp outbound gateway (ls, get, rm)
a service activator (unzip's each file downloaded)
transformer (exception handling)
as a test, I put 2 zip files on my ftp server, and a text file with a zip extension (to simulate a corrupt zip)
without the "corrupt zip", my process behaves as expected, downloads each file, and puts them on a channel, which the service activator then unzips.
however, if I return the "corrupt zip" to the ftp server, and name it so it gets downloaded first, when it gets unzip in the service activator, the exception is thrown, and (as I assume) "caught" by the transformer.
I would then expect the remaining zip files to be downloaded, but they are not, I have to reexecute the gateway.
here are my contexts
default-context.xml
ftp-context.xmlCode:<channel id="exceptionChannel" /> <transformer id="defaultExceptionTransformer" input-channel="exceptionChannel" output-channel="nullChannel"> <beans:bean class="com.fetcha.server.integration.DefaultExceptionTransformer" /> </transformer>
unzip-context.xmlCode:<channel id="inboundChannel"> <dispatcher task-executor="inboundChannelTaskExecutor"/> </channel> <beans:bean id="inboundChannelTaskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"> <beans:property name="corePoolSize" value="2"/> <beans:property name="daemon" value="false"/> </beans:bean> <gateway id="integrationGateway" service-interface="com.foo.integration.IntegrationGateway" default-request-channel="inboundChannel" /> <beans:bean id="ftpSessionFactory" class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory"> <beans:property name="host" value="${ftp.inbound.host}" /> <beans:property name="port" value="${ftp.inbound.port}" /> <beans:property name="username" value="${ftp.inbound.user}" /> <beans:property name="password" value="${ftp.inbound.password}" /> </beans:bean> <int-ftp:outbound-gateway id="gatewayLS" cache-sessions="false" session-factory="ftpSessionFactory" request-channel="inboundChannel" command="ls" command-options="" expression="'${ftp.inbound.remote.directory}'" reply-channel="toSplitter" /> <channel id="toSplitter"> <interceptors> <wire-tap channel="logger" /> </interceptors> </channel> <logging-channel-adapter id="logger" log-full-message="true" level="DEBUG" /> <splitter id="splitter" input-channel="toSplitter" output-channel="toGet" /> <int-ftp:outbound-gateway id="gatewayGET" filename-pattern="*.zip" cache-sessions="false" local-directory="${ftp.inbound.local.directory}" session-factory="ftpSessionFactory" request-channel="toGet" reply-channel="newFileChannel" command="get" command-options="-P" expression="payload.remoteDirectory + '/' + payload.filename" /> <publish-subscribe-channel id="newFileChannel"> <interceptors> <wire-tap channel="logger2"/> </interceptors> </publish-subscribe-channel> <logging-channel-adapter id="logger2" log-full-message="true" /> <int-ftp:outbound-gateway id="gatewayRM" session-factory="ftpSessionFactory" cache-sessions="false" expression="headers['file_remoteDirectory'] + '/' + headers['file_remoteFile']" request-channel="newFileChannel" command="rm" reply-channel="nullChannel" />
DefaultExceptionTransformer.javaCode:<chain input-channel="newFileChannel" output-channel="nullChannel"> <header-enricher> <error-channel ref="exceptionChannel" /> </header-enricher> <service-activator method="unzip" > <beans:bean class="com.foo.Zip" /> </service-activator> </chain>
I basically want the FTPing to be completely decoupled from the unzipping.Code:public class DefaultExceptionTransformer { public boolean transform(final Exception exception) { System.out.println("Transforming exception: " + exception.getMessage()); return true; } }
what am I doing wrong?
Thanks in advance
Shaine


Reply With Quote