Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-12638

DefaultFluentProducerTemplate is not thread safe

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.20.2
    • Fix Version/s: 2.21.3, 2.22.1, 2.23.0
    • Component/s: camel-core
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      I think we have rediscovered the CAMEL-10820 bug. A body of one request gets replaced with a body of proceeding request, in our case we use request() method instead of asyncSend().

      We use camel together with spring-boot. Consider following code:

       

      @Service
      public class UseCamelService {
      
         private FluentProducerTemplate producer;
      
         @Autowired
         public UseCamelService(FluentProducerTemplate producer) {
            this.producer = producer;
         }
      
         public String getValueFromCamel(String body) {
            return producer.to("route").withBody(body).request(String.class);
         }
      
      }
      

      If UseCamelService.getValueFromCamel() gets called from two different threads it is possible for the latter one to override the body of the first one.

        Attachments

        1. image-2018-07-12-17-58-09-225.png
          146 kB
          Mario Papandrea

          Activity

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              lucas_ Lukasz
            • Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: