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

camel-mongodb - Batch insert does not work

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.6.0
    • camel-mongodb
    • None
    • Unknown

    Description

      Can somebody help to create a jira for this because I don't have the permission?
      Please use below codes to reproduce.

      @Named("ConvertType")
      @Log4j2
      public class ConvertType implements Processor { private static final Logger logger = LoggerFactory.getLogger(ConvertType.class); @Override
      public void process(Exchange exchange)

      { Document a = new Document(MongoDbConstants.MONGO_ID, "testInsert1"); a.append("MyId", 1).toJson(); Document b = new Document(MongoDbConstants.MONGO_ID, "testInsert2"); b.append("MyId", 2).toJson(); Document c = new Document(MongoDbConstants.MONGO_ID, "testInsert3"); c.append("MyId", 3).toJson(); List<Document> taxGroupList = new ArrayList<Document>(); taxGroupList.add(a); taxGroupList.add(b); taxGroupList.add(c); exchange.getIn().setBody(taxGroupList); // From MongoDbProducer.java#L428 // https://github.com/apache/camel/blob/af7e383e9fc1d25ce9665f74d33672cc5b507952/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbProducer.java#L428 Object insert = exchange.getContext().getTypeConverter().tryConvertTo(Document.class, exchange, exchange.getIn().getBody()); if (insert == null) logger.info(Document.class.getTypeName() + " mismatched with " + exchange.getIn().getBody().getClass().getTypeName()); else logger.info(Document.class.getTypeName() + " matched with " + exchange.getIn().getBody().getClass().getTypeName()); }

      }

      from(fromKafka) .process("ConvertType");

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: