You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2020/10/14 08:59:00 UTC

[jira] [Assigned] (CAMEL-15646) camel-mongodb - Batch insert does not work

     [ https://issues.apache.org/jira/browse/CAMEL-15646?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen reassigned CAMEL-15646:
-----------------------------------

    Assignee: Claus Ibsen

> camel-mongodb - Batch insert does not work
> ------------------------------------------
>
>                 Key: CAMEL-15646
>                 URL: https://issues.apache.org/jira/browse/CAMEL-15646
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-mongodb
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Major
>             Fix For: 3.6.0
>
>
> 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");



--
This message was sent by Atlassian Jira
(v8.3.4#803005)