Announcement Announcement Module
No announcement yet.
Outbound Channel Adaptor is not responding Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Outbound Channel Adaptor is not responding


    I am trying to print all lines of input file & then copy the input file to ouput directory. For that I am using the below configuration:

     <channel id="message.inbound" />
    	<channel id="message.outbound" />
    	<context:property-placeholder location="classpath:/" />
       <file:inbound-channel-adapter id="mfInputFileProcessor"
    		directory="file:${}" filename-pattern="message*">
    		<poller id="mfInputPoller" fixed-delay="10" time-unit="SECONDS"/>
    		output-channel="mfInputFileParser" charset="UTF-8"
    		delete-files="false" />
    	<splitter input-channel="mfInputFileParser" ref="mFileHandler"
    		method="extractLines" output-channel="message.inbound" />
    	<beans:bean id="mFileHandler"
    		class="com.test.project.brokerage.fileAdaptor.Utilities.FileHandler" />
    	 <beans:bean id="printBudeMessage"
    		class="com.test.project.brokerage.fileAdaptor.FileTransformerTest" />
    	<splitter input-channel="message.inbound" ref="printBudeMessage"
    		method="printLine" output-channel="message.outbound" />
    	<file:outbound-channel-adapter id="filesOut"
    Its printing all the lines but not copying the input file to output directory.

    Please advise.

    Mahendra Singh

  • #2
    I am assuming your printLine method does that.

    Can you post here the implementation of your class com.test.project.brokerage.fileAdaptor.FileTransfo rmerTest ?

    Also explain us in brief if possible your use case, what you are expecting to happen if the above thing works successfully.


    • #3
      public class BUDeTransformerTest {
      	private static Logger log = Logger.getLogger(BUDeTransformerTest.class);
      	public void printLine(String payload) {;
      I am expecting the above code should print each line of all the input files and copy them to the output directory.


      • #4
        Ok, let your printLine return a String and have
        return payload;
        at the end.

        This is however, not what a splitter is intended for.

        Also, how are you expecting the files to be written?

        First try changing the signature of the method and return the string. Then see if the files are being written, what is the content of the files and what are the names of the files.
        Let us know whats the result and what was your expectation.


        • #5
          Thanks Amol for this suggestion.

          Its printing all the lines, however unfortunately its not copying all the lines to the output directory.

          also I can see some strange behavior, in the output directory, as explained below:

          I have provided input file message.csv, which has 4 lines. But in the output directory I get 2 files:

          message.csv and message.csvnull

          and both having 1 line, i.e. line no.1 and line no.4 respectively.

          Please have a look at the attached files.(Please remove .txt extension from both the files. I have added it to upload these files)

          Please advise.


          • #6
            The above files are the output files. The input file is attached below.(Please remove .txt extension):


            • #7
              Can you explain your use case?


              • #8
                In my Case:

                I would like to read files from input directory, print all the lines and copy the files to the output directory.


                • #9
                  Copy them as they are in the source folder in the output directory?
                  What do you plan to do with the splitter, is there some processing you'll be doing with each line?


                  • #10
                    I just want to print all the lines, So for that purpose i have used splitter.

                    Did I do something wrong ?

                    Please suggest the best way to do it. I am new to spring, so don't know much.


                    • #11
                      If you use a splitter, you will have multiple messages created, one per line of the file in your case.

                      If you want to have all these lines to be written to the same file in the destination (you haven't answered that yet, but i am assuming this is the case), you will need an aggregator downstream to aggregate these lines before these are being written.

                      So typically the sequence would be

                      inbound-file-adapter --> splitter (read the lines, process them if required and print them here) --> aggregator --> outbound-file adapter

                      also get rid of the second splitter you have.

                      Let us know if that makes sense and addresses your doubt.


                      • #12
                        I will try this and let you know the results.