Re: Reading the incoming flowfile "twice"

2020-03-31 Thread Mark Payne
Russ, As far as I can tell, this is working exactly as expected. To verify, I created a simple Integration test, as well, which I attached below. Let me outline what I *think* you’re trying to do here and please correct me if I’m wrong: 1. Read the content of the FlowFile. (Via session.read)

Re: Reading the incoming flowfile "twice"

2020-03-31 Thread Russell Bateman
Yes, I though of that, but there's no way to insert completing XML structure into the input stream ahead of (). SAX will choke if I just start feeding it the flowfile where I left off from copying up to . On 3/30/20 8:25 PM, Otto Fowler wrote: Can I ask why you would consume the whole stream

Re: Reading the incoming flowfile "twice"

2020-03-31 Thread Otto Fowler
Oh, sorry I did not understand that you needed to do that On March 31, 2020 at 11:22:20, Russell Bateman (r...@windofkeltia.com) wrote: Yes, I though of that, but there's no way to insert completing XML structure into the input stream ahead of (). SAX will choke if I just start feeding it the

Re: Reading the incoming flowfile "twice"

2020-03-31 Thread Russell Bateman
Mark, Thanks for getting back. My steps are: 1. Read the "first half" of the input stream copying it to the output stream. This is because I need to preserve the exact form of it (spacing, indentation, lines, etc.) without change whatsoever. If I 2. Reopen the stream from the beginning with

Re: Reading the incoming flowfile "twice"

2020-03-31 Thread Russell Bateman
And, also *out*? On 3/31/20 12:35 PM, Russell Bateman wrote: Wait, where is *modified*from? Thanks On 3/31/20 12:24 PM, Mark Payne wrote: Russ, OK, so then I think the pattern you’d want to follow would be something like this: FlowFile original = session.get(); if (flowFile == null) {

Re: Reading the incoming flowfile "twice"

2020-03-31 Thread Mark Payne
Russ, OK, so then I think the pattern you’d want to follow would be something like this: FlowFile original = session.get(); if (flowFile == null) { return; } FlowFile output = session.create(original); // Begin writing to ‘output flowfile' output = session.write(modified, new

Re: Reading the incoming flowfile "twice"

2020-03-31 Thread Mark Payne
Sorry, typo. ‘modified’ should have been ‘output’. > On Mar 31, 2020, at 2:44 PM, Russell Bateman wrote: > > (Oh, I see where *out*comes from, but not *modified*.) > > On 3/31/20 12:35 PM, Russell Bateman wrote: >> Wait, where is *modified*from? >> >> Thanks >> >> On 3/31/20 12:24 PM, Mark

Re: Reading the incoming flowfile "twice"

2020-03-31 Thread Russell Bateman
Let's see... Does this fix the typos the way you intended? public void onTrigger( final ProcessContext context, final ProcessSession session ) throws ProcessException {   FlowFile original = session.get(); if( original == null ) { context.yield(); return; }   FlowFile output   =

Re: Reading the incoming flowfile "twice"

2020-03-31 Thread Russell Bateman
Wait, where is *modified*from? Thanks On 3/31/20 12:24 PM, Mark Payne wrote: Russ, OK, so then I think the pattern you’d want to follow would be something like this: FlowFile original = session.get(); if (flowFile == null) { return; } FlowFile output = session.create(original); //

Re: Reading the incoming flowfile "twice"

2020-03-31 Thread Russell Bateman
(Oh, I see where *out*comes from, but not *modified*.) On 3/31/20 12:35 PM, Russell Bateman wrote: Wait, where is *modified*from? Thanks On 3/31/20 12:24 PM, Mark Payne wrote: Russ, OK, so then I think the pattern you’d want to follow would be something like this: FlowFile original =