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

ExchangeBuilder to create messages using fluent builder style

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.11.0
    • camel-core
    • None

    Description

      So you from the Java API using a fluent builder style, can create an Exchange to send, for example with the ProducerTemplate.

      Currently you can use a inlined Processor to do that but its a bit ugly and verbose.

      Exchange exchange = ExchangeBuilder("activemq:queue:foo").withBody("Hello World").andHeader("JMSReplyTo", "bar").andHeader("foo", 123).create();
      template.send(exchange);
      

      The trick is the Exchange has to be created by the producer and hence we need to know the endpoint uri where to send it.

      Attachments

        1. ExchangeBuilder.diff
          5 kB
          Bilgin Ismet Ibryam

        Issue Links

          Activity

            People

              njiang Willem Jiang
              davsclaus Claus Ibsen
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: