Uploaded image for project: 'Red Hat build of Apache Camel for Spring Boot'
  1. Red Hat build of Apache Camel for Spring Boot
  2. CSB-8155

RemoteFileProduces ignores the result of Noop

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • CSB-4.14.2
    • CSB-4.10.3
    • Camel
    • None
    • False
    • Hide

      None

      Show
      None
    • False
    • Important
    • Very Likely
    • 0

      Here is the simplified version of
      org.apache.camel.component.file.remote.RemoteFileProducer.preWriteCheck

      @Override
      public void preWriteCheck(Exchange exchange) {
          boolean noop = false;
          if (loggedIn) {
              try {
                  noop = getOperations().sendNoop();
              } catch (Exception e) {
                  noop = false;
              }
          }
      
          if (!noop) {
              connectIfNecessary(exchange);
          }
      } 

      The problem is, that the method connectIfNecessary checks the connection once again:

      protected void connectIfNecessary(Exchange exchange) {
          if (!loggedIn || !getOperations().isConnected()) {
              RemoteFileConfiguration config = getEndpoint().getConfiguration();
              loggedIn = getOperations().connect(config, exchange);
          }
      } 

      It is wrong! If Noop returns false, the connection recreation must be forced. The second check getOperations().isConnected() is much less strong and must be omitted.

      I cause the system to remain the broken connection and reuse it again and again. It makes Retry-Configuration useless.


      P.S. The class RemoteFileConsumer behaves correctly. It forces the connect, if Noop was not successful.

              Unassigned Unassigned
              rodion.alukhanov@dguv.de Rodion Alukhanov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: