Skip to content
This repository has been archived by the owner on Nov 17, 2017. It is now read-only.

Support for InputStreams in input #207

Open
zregvart opened this issue Oct 2, 2017 · 4 comments
Open

Support for InputStreams in input #207

zregvart opened this issue Oct 2, 2017 · 4 comments

Comments

@zregvart
Copy link
Contributor

zregvart commented Oct 2, 2017

Currently there is only support for String in the input of JSON and XML modules, we should support InputStream as input.

See XmlModule.java#L167-L171 and JsonModule.java#L145-L150.

When `InputStream` is specified in the input the following exception is thrown: ``` io.atlasmap.api.AtlasException: Unsupported input object type=io.atlasmap.json.v2.JsonComplexType at org.apache.camel.component.atlasmap.AtlasEndpoint.onExchange(AtlasEndpoint.java:209) at org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:71) at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:148) at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548) at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) at org.apache.camel.processor.Pipeline.process(Pipeline.java:120) at org.apache.camel.processor.Pipeline.process(Pipeline.java:83) at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:110) at org.apache.camel.component.connector.ConnectorConsumerProcessor.process(ConnectorConsumerProcessor.java:66) at org.apache.camel.component.salesforce.SalesforceConsumer.processMessage(SalesforceConsumer.java:194) ... 35 common frames omitted ```
@igarashitm
Copy link
Contributor

Easy short term fix would be to rely on camel converters, so in camel-atlasmap do getBody(String.class) to make sure always putting String into atlasmap. If we really need stream for huge content handling, then we'll need to rewrite the JsonModule and XmlModule using stream based parser, JsonParser and SAX, instead of ObjectMapper and DOM currently using.

@igarashitm
Copy link
Contributor

Hmm that requires camel-atlasmap to look into source type and see if it's json/xml, which is dirty. So JsonModule/XmlModule should handle some type conversion anyway, which means we need to propagate the encoding of the stream as well.

@igarashitm
Copy link
Contributor

Changed my mind, right now it looks better to deserialize into String in camel-atlasmap if source is JSON/XML.

@igarashitm
Copy link
Contributor

Reserve this as a big enhancement to rewrite JsonModule and XmlModule to stream based. atlasmap-attic/camel-atlasmap#26 will address a short term fix.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants