use of nl.nn.adapterframework.stream.document.IDocumentBuilder in project iaf by ibissource.
the class MongoDbSender method renderResult.
protected void renderResult(Document findResult, MessageOutputStream target) throws StreamingException {
try (IDocumentBuilder builder = DocumentBuilderFactory.startDocument(getOutputFormat(), "FindOneResult", target)) {
JsonWriterSettings writerSettings = JsonWriterSettings.builder().outputMode(JsonMode.RELAXED).build();
Encoder<Document> encoder = new DocumentCodec();
JsonDocumentWriter jsonWriter = new JsonDocumentWriter(builder, writerSettings);
encoder.encode(jsonWriter, findResult, EncoderContext.builder().build());
} catch (Exception e) {
throw new StreamingException("Could not render collection", e);
}
}
Aggregations