Spring Integration
  1. Spring Integration
  2. INT-3089

IGNORE mode outbound-channel-adapter should also check for '.writing' files

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Complete
    • Affects Version/s: 2.2.3
    • Fix Version/s: 2.2.5, 3.0 M3
    • Component/s: File Support
    • Labels:
    • Environment:
      Linux

      Description

      I have configured the following outbound-channel-adapter:

      <int-file:outbound-channel-adapter auto-create-directory="false" directory="${stagingDirectory}" id="stagingFileId" mode="IGNORE"/>
      

      We always run two instances of the same application at the same time for failover purposes. It can happen that both processes try to write a file with the same name at the same time (cron expression) to the same directory. I've added the "IGNORE" flag so that basicially the first one to do the write wins. I've been noticing lately that we are getting some weird exceptions that I can't explain (see forum for logfile).

      I took a look at the code for the outbound-channel-adapter (FileWritingMessageHandler) and saw the following code to determine if it should ignore a file or not when writing:

      final boolean ignore = FileExistsMode.IGNORE.equals(this.fileExistsMode) && resultFile.exists();
      

      but..I had expected the following (that it also checks for the temp '.writing' version of this file):

      final boolean ignore = FileExistsMode.IGNORE.equals(this.fileExistsMode) && ( resultFile.exists() || tempFile.exists());
      

      Issue?

        Issue Links

          Activity

          Hide
          Noel O'Shea added a comment -

          Thanks for the quick reaction Gary. Any idea when 2.2.5 will be available?

          Show
          Noel O'Shea added a comment - Thanks for the quick reaction Gary. Any idea when 2.2.5 will be available?
          Hide
          Gary Russell added a comment - - edited

          PR: https://github.com/SpringSource/spring-integration/pull/832

          Noel,

          We have a number of issues we need to resolve for 2.2.5 - we could maybe try to schedule it for the end of the month.

          If you need a work around sooner than that, you could fix it locally (or pull the fix from my branch, but my fix is not much different to yours) and configure it using <bean/>s.

          <bean id="adapter" class="org.springframework.integration.config.ConsumerEndpointFactoryBean">
          	<property name="inputChannel" ref="filesOut"/>
          	<property name="handler">
          		<bean class="foo.fixed.FileWritingMessageHandler">
          			<property name="expectReply" value="false"/>
          			...
          		</bean>
          	</property>
          	...
          </bean>
          
          Show
          Gary Russell added a comment - - edited PR: https://github.com/SpringSource/spring-integration/pull/832 Noel, We have a number of issues we need to resolve for 2.2.5 - we could maybe try to schedule it for the end of the month. If you need a work around sooner than that, you could fix it locally (or pull the fix from my branch, but my fix is not much different to yours) and configure it using <bean/>s. <bean id= "adapter" class= "org.springframework.integration.config.ConsumerEndpointFactoryBean" > <property name= "inputChannel" ref= "filesOut" /> <property name= "handler" > <bean class= "foo.fixed.FileWritingMessageHandler" > <property name= "expectReply" value= "false" /> ... </bean> </property> ... </bean>
          Hide
          Gunnar Hillert added a comment -

          Merged PR. Cherry-picked to 2.2.x

          Show
          Gunnar Hillert added a comment - Merged PR. Cherry-picked to 2.2.x
          Hide
          Noel O'Shea added a comment -

          Hi Gary/Gunnar,

          I was wondering when the 2.2.5 release is planned for? You mentioned earlier that it might be released at the end of July...

          Of course I can fix it according to your suggestion but I'd rather do it with an upgrade to 2.2.5 if possible.

          Thoughts?

          Rgds,
          Noel.

          Show
          Noel O'Shea added a comment - Hi Gary/Gunnar, I was wondering when the 2.2.5 release is planned for? You mentioned earlier that it might be released at the end of July... Of course I can fix it according to your suggestion but I'd rather do it with an upgrade to 2.2.5 if possible. Thoughts? Rgds, Noel.
          Hide
          Gary Russell added a comment -

          I am planning on releasing milestone 3 for SI 3.0.0 this week, in time for SpringOne - I'll do a 2.2.5 release at the same time.

          Show
          Gary Russell added a comment - I am planning on releasing milestone 3 for SI 3.0.0 this week, in time for SpringOne - I'll do a 2.2.5 release at the same time.
          Hide
          Gary Russell added a comment -

          It's available in the SpringSource repo now and should be in maven central in a few hours...

          http://www.springsource.org/node/22685

          Show
          Gary Russell added a comment - It's available in the SpringSource repo now and should be in maven central in a few hours... http://www.springsource.org/node/22685

            People

            • Assignee:
              Gary Russell
              Reporter:
              Noel O'Shea
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: