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

FluentProducerTemplate.withExchange() does not seem to send exchange

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.19.2, 2.19.3, 2.19.4, 2.19.5, 2.20.0, 2.20.1, 2.20.2, 2.20.3, 2.21.0
    • 2.23.0
    • camel-core
    • None
    • Linux and Java 8 or Java 9

    • Unknown

    Description

      When I use the following simple but complete code example:

      public static void main(String[] args) throws Exception {
          CamelContext camelContext = new DefaultCamelContext();
          camelContext.start();
          camelContext.addRoutes(new RouteBuilder() {
              @Override
              public void configure() {
                  from("direct-vm:start").process(exchange -> {
                      String incoming = exchange.getIn().getBody(String.class);
                      exchange.getIn().setBody("Message received: " + incoming, String.class);
                  });
              }
          });
          Exchange exchange = ExchangeBuilder.anExchange(camelContext)
                  .withBody("Hello!")
                  .withPattern(ExchangePattern.InOut)
                  .build();
          System.out.println(
                  camelContext.createFluentProducerTemplate()
                  .withExchange(exchange)
                  .to("direct-vm:start")
                  .request(String.class)
          );
      }

      The message body appears to be missing, as indicated in the program output:

      Message received: null

      I have tried this with java 1.8 and 1.9, and with camel 2.19.2 and 2.21.1, and both camel versions exhibit the same behavior when run with both java versions.

      Attachments

        1. MessageApplication.java
          1 kB
          Steve Storck

        Activity

          People

            davsclaus Claus Ibsen
            Steve973 Steve Storck
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: