0
votes

While playing with the code from spring-integration-samples project and trying to implement following flow:

read_file->backup_file->transform_file->write_file

  • 'read_file' is file:inbound-channel-adapter
  • 'backup_file' is 'service-activator' calling java service (doing copy file)
  • 'transform_file' are 2 transformers
  • 'write_file' is file:outbound-channel-adapter that is writing the processed file

Everything is working good until the moment when I did try to implement 'backup_file' step as a file:outbound-gateway
I got the error:

Error while loading fileCopyDemo-file due to No qualifying bean of type 'org.springframework.integration.file.FileWritingMessageHandler' available: expected single matching bean but found 2: org.springframework.integration.file.config.FileWritingMessageHandlerFactoryBean#0,org.springframework.integration.file.config.FileWritingMessageHandlerFactoryBean#1


Here is my config:

<!--read_file-->
<int-file:inbound-channel-adapter auto-startup="true" id="filesIn" channel="filesBackup"
        directory="${int.uvrp.original}" 
        filter="compositeFileFilter" >
        <int:poller id="poller" max-messages-per-poll="10" cron="*/10 * * * * *" default="true" />
</int-file:inbound-channel-adapter>

<!--backup_file-->
<int-file:outbound-gateway id="backupGate" request-channel="filesBackup" reply-channel="filesProcessing" directory="file:${int.archive}" />

<!--transform_file-->
<int-file:file-to-bytes-transformer input-channel="filesProcessing" output-channel="bytes" />
<int:transformer input-channel="bytes" output-channel="filesStore" ref="myTransformer1" method="transform" />

<!--write_file-->
<int-file:outbound-channel-adapter id="filesOut" channel="filesStore" directory="${int.processed}" delete-source-files="true"/>


Any ideas?

1
May you show more stack trace? Looks like there is a FileWritingMessageHandler injection by type, but since now you have more than one , it failsArtem Bilan

1 Answers

0
votes

Thanks for the hint. I have created the project from scratch, copied the configuration file and everything is working as expected.