/** * Writes to the given FlowFile all content from the given content path. * * @param source the file from which content will be obtained * @param flowFile the FlowFile whose content will be updated * @return the updated destination FlowFile (new size) * @throws IllegalStateException if detected that this method is being called from within a callback of another method in this session and for the given FlowFile(s) * @throws FlowFileHandlingException if the given FlowFile is already transferred or removed or doesn't belong to this session. Automatic rollback will occur. * @throws MissingFlowFileException if the given FlowFile content cannot be found. The FlowFile should no longer be reference, will be internally destroyed, and the session is automatically * rolled back and what is left of the FlowFile is destroyed. * @throws FlowFileAccessException if some IO problem occurs accessing FlowFile content */ @Override public SessionFile importFrom(InputStream source, FlowFile flowFile) { SessionFile sf = wrap(flowFile); sf.flowFile = onMod(s.importFrom(source, sf.flowFile)); return sf; }
/** * Writes to the given FlowFile all content from the given content path. * * @param source the file from which content will be obtained * @param keepSourceFile if true the content is simply copied; if false the original content might be used in a destructive way for efficiency such that the repository will have the data but the * original data will be gone. If false the source object will be removed or gone once imported. It will not be restored if the session is rolled back * so this must be used with caution. In some cases it can result in tremendous efficiency gains but is also dangerous. * @param flowFile the FlowFile whose content will be updated * @return the updated destination FlowFile (new size) * @throws IllegalStateException if detected that this method is being called from within a callback of another method in this session and for the given FlowFile(s) * @throws FlowFileHandlingException if the given FlowFile is already transferred or removed or doesn't belong to this session. Automatic rollback will occur. * @throws MissingFlowFileException if the given FlowFile content cannot be found. The FlowFile should no longer be reference, will be internally destroyed, and the session is automatically * rolled back and what is left of the FlowFile is destroyed. * @throws FlowFileAccessException if some IO problem occurs accessing FlowFile content */ @Override public SessionFile importFrom(Path source, boolean keepSourceFile, FlowFile flowFile) { SessionFile sf = wrap(flowFile); sf.flowFile = onMod(s.importFrom(source, keepSourceFile, sf.flowFile)); return sf; }
flowFile = session.importFrom(filePath, keepingSourceFile, flowFile); final long importNanos = System.nanoTime() - importStart; final long importMillis = TimeUnit.MILLISECONDS.convert(importNanos, TimeUnit.NANOSECONDS);
protected void writeBatch(String payload, FlowFile parent, ProcessContext context, ProcessSession session, Map<String, String> extraAttributes, Relationship rel) throws UnsupportedEncodingException { String charset = context.getProperty(CHARSET).evaluateAttributeExpressions(parent).getValue(); FlowFile flowFile = parent != null ? session.create(parent) : session.create(); flowFile = session.importFrom(new ByteArrayInputStream(payload.getBytes(charset)), flowFile); flowFile = session.putAllAttributes(flowFile, extraAttributes); session.getProvenanceReporter().receive(flowFile, getURI(context)); session.transfer(flowFile, rel); }
session.importFrom(bais, flowFile);
flowFile = session.importFrom(file.toPath(), true, flowFile); if (flowFile.getSize() == 0L) { session.remove(flowFile);
flowFile = session.importFrom(in, flowFile); if (flowFile.getSize() == 0L) { session.remove(flowFile);
flowFile = session.importFrom(dataPacket.getData(), flowFile); flowFile = session.putAllAttributes(flowFile, dataPacket.getAttributes());
session.importFrom(bais, flowFile); final long endTimeMillis = System.currentTimeMillis();
flowFile = session.importFrom(dataPacket.getData(), flowFile); final long receiveNanos = System.nanoTime() - start; flowFilesReceived.add(flowFile);
flowFile = session.importFrom(s3Object.getObjectContent(), flowFile); attributes.put("s3.bucket", s3Object.getBucketName());
flowFile = session.importFrom(fis, flowFile); } catch (final IOException ioe) { getLogger().error("Could not fetch file {} from file system for {} due to {}; routing to failure", new Object[] {file, flowFile, ioe.toString()}, ioe);
flowFile = session.importFrom(stream, finalFlowFile); flowFile = session.putAttribute(flowFile, CoreAttributes.FILENAME.key(), outputFilename);
flowFile = session.importFrom(Channels.newInputStream(reader), flowFile);
responseFlowFile = session.importFrom(teeInputStream, responseFlowFile); } else { responseFlowFile = session.importFrom(responseBodyStream, responseFlowFile);
flowFile = session.importFrom(stream, flowFile); stopWatch.stop(); final String dataRate = stopWatch.calculateDataRate(flowFile.getSize());
flowFile = session.importFrom(bais, flowFile);
session.importFrom(bais, outgoingFlowFile); bais.close();
try (final InputStream in = transfer.getInputStream(file.getFullPathFileName())) { stopWatch.start(); flowFile = session.importFrom(in, flowFile); stopWatch.stop();
} else { ByteArrayInputStream bais = new ByteArrayInputStream(value); flowFile = session.importFrom(bais, flowFile); session.transfer(flowFile,REL_SUCCESS);