Results 1 to 10 of 26

Thread: Inbound channel adapter issue

Hybrid View

  1. #1
    Join Date
    Sep 2006
    Posts
    100

    Default Inbound channel adapter issue

    Here is my inbound channel adapter config:

    Code:
    <int-file:inbound-channel-adapter directory="DecryptedFiles" channel="decryptedFilesChannel" prevent-duplicates="true">
    		<int:poller cron="* * 6-23 * * SUN-SAT" />
    	</int-file:inbound-channel-adapter>
    However, when my application runs, I see that multiple threads are processing the same file. How do I ensure that the file is picked up only once?

    Any help is greatly appreciated.

  2. #2
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    Bobby

    From your configuration i can't see how is it possible.
    Could you please provide more detail
    All I see is that new file will be picked up by the poller's thread in intervals governed by the cron expression. And your poller is single-threaded

  3. #3
    Join Date
    Sep 2006
    Posts
    100

    Default

    I totally understand and that was my expectation too as I did not assign any task executor. According to my application log, two task scheduler threads (10 and 8) were spanned to access the same file at the same time.

    Please see below:

    Code:
    2011-05-03 15:33:02,006  DEBUG FileReadingMessageSource [task-scheduler-10] (FileReadingMessageSource.java:272) - Added to queue: [DecryptedFiles\DECRYPTED_YwHsP9Evt5BY$gAA]
    2011-05-03 15:33:02,006  INFO  FileReadingMessageSource [task-scheduler-10] (FileReadingMessageSource.java:260) - Created message: [[Payload=DecryptedFiles\DECRYPTED_YwHsP9Evt5BY$gAA][Headers={timestamp=1304454782006, id=7ac20ada-c13f-460e-b05d-1291eb49a144}]]
    2011-05-03 15:33:02,006  DEBUG FileReadingMessageSource [task-scheduler-8] (FileReadingMessageSource.java:272) - Added to queue: [DecryptedFiles\DECRYPTED_YwHsP9Evt5BY$gAA]
    2011-05-03 15:33:02,006  INFO  FileReadingMessageSource [task-scheduler-8] (FileReadingMessageSource.java:260) - Created message: [[Payload=DecryptedFiles\DECRYPTED_YwHsP9Evt5BY$gAA][Headers={timestamp=1304454782006, id=4c422df2-dfb9-453e-91ac-1cda56a6683d}]]

  4. #4
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    Bobby

    I was just trying to reproduce and I don't see any duplication. The only way I was able to reproduce it is by starting the ApplicationContext (AC) twice or by configuring two adapter instances in the same AC.
    Can you look at your config and make sure you don't have a second instance of the adapter?

  5. #5
    Join Date
    Sep 2006
    Posts
    100

    Default

    I do not have multiple inbound channel adapters polling the same folder; however, I do have inbound channel adapters polling different folders (within the same applicationContext). Could this be an issue?

    This is what is happening in my application:
    1. I poll an FTP site, pick an encrypted file when present.
    2. There is a command line utility used to decrypt the file and is stored in DecryptedFiles folder.
    3. I use inbound channel adapter to process the decrypted file.

    There is other inbound-channel-adapter polling to FTP an encrypted file (outbound processing). The same behavior is seen there as well and is consistent even between Tomcat recycles.

  6. #6
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    Not sure I understand that. Could you clarify?
    I do not have multiple inbound channel adapters polling the same folder; however, I do have inbound channel adapters polling different folders

Posting Permissions

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