Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-5962

The CouchDbMethod header is not working with an instance of org.apache.camel.ProducerTemplate

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Critical Critical
    • fuse-7.0
    • jboss-fuse-6.3
    • Camel
    • % %
    • Hide

      described in the Description field.

      Show
      described in the Description field.

      I have created a test using the header CouchDbMethod to delete a register in CouchDb.

      I am using an instance of:

      org.apache.camel.ProducerTemplate like:

      ProducerTemplate producer = context.createProducerTemplate();

      and my test is:
      ...
      final Map<String, Object> headers = new HashMap<>();
      headers.put("CouchDbMethod", "DELETE");
      headers.put("CouchDbId", id);
      headers.put("CouchDbRev", rev);

      producer.requestBodyAndHeaders("direct:start", user, headers);
      ...

      'user' is an instance of a class:

      @Data
      public class LoginUser extends Document {
      private String username;
      private String password;
      }

      .. and my camel route:

      <route id="producer">
      <from uri="direct:start"/>
      <marshal ref="gson"/>
      <convertBodyTo type="java.lang.String"/>
      <to uri="couchdb:http://${couchdb.hostname}:${couchdb.port}/example?createDatabase=true"/>
      <unmarshal ref="gson"/>
      <to uri="mock:mockProducer"/>
      </route>

      .. but if i use an instance of

      import org.lightcouch.CouchDbClient

      is working with for example this method:

      client.remove(id,rev);

      It seems in the first case ignore the CouchDbMethod header so it is translating to a PUT couchdb sentence instead of DELETE sentence.

      I am using wireshark to sniff traffic in the http protocol.

        1. camel-context.xml
          1 kB
          Fernando FR
        2. CouchdbTest.java
          3 kB
          Fernando FR

              acosenti Andrea Cosentino
              fdelafue Fernando FR (Inactive)
              Fernando FR Fernando FR (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: