The philosophy behind XCC is that the insertion work should be restartable. That's because there might be a deadlock detected during the insert (i.e. a conflict on URIs) and in that case your update statement may be restarted to free its locks and resolve the deadlock. So with XCC you don't stream the data to the server, but rather have the XCC code pull the data from you, and you should design the client so it's OK if it pulls more than once (XCC calls it rewinding).
You can create a content source that's in memory (byte array output stream), if you'd like, streaming a serialization to memory and then wrapping the memory as an input stream. Or use a temp file, like David suggested, which will be good if your data size is large or of unknown size. -jh- On Jun 1, 2011, at 1:01 PM, Gary Larsen wrote: > Hi David, > > Thanks for your advice. I wish I didn’t need content handlers but much of > our data is sourced through the serialization of Java beans. I’ll give the > temp file method a go. > > gary > > > From: [email protected] > [mailto:[email protected]] On Behalf Of Lee, David > Sent: Wednesday, June 01, 2011 3:38 PM > To: General MarkLogic Developer Discussion > Subject: Re: [MarkLogic Dev General] Storing with a ContenHandler > > This is a bit tricky as ContentHandler is a callback (push) API while > InputStream is a pull API. > Marrying the 2 is quite difficult. > > I suggest serializing the data to a temporary file then using the File as the > input to newContent() > This has the additional advantage of allowing XCC to intelligently retry as > needed. > > > > ---------------------------------------- > David A. Lee > Senior Principal Software Engineer > Epocrates, Inc. > [email protected] > 812-482-5224 > > From: [email protected] > [mailto:[email protected]] On Behalf Of Gary Larsen > Sent: Wednesday, June 01, 2011 2:41 PM > To: 'General MarkLogic Developer Discussion' > Subject: [MarkLogic Dev General] Storing with a ContenHandler > > Sorry if this is a bit off topic. > > The XML data I’m storing to MarkLogic (Java XCC) is being processed through > one or more ContentHandlers. With eXist I would create a resource that would > accept the ContentHandler stream. > > I’m trying to figure out how to convert the ContentHandler stream to in > InputStream for use with one of the ContentFactory.newContent() methods. > > From looking at the samples it appears that eventually I should use the > DynamicContentStream class but I need to figure out the conversion problem > first. > > I’d really appreciate any pointers in this area. > > Thanks, > gary > > > _______________________________________________ > General mailing list > [email protected] > http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
