FC - Class of context instance which is passed to each partial functions.
Lifetime of an function context should be limited for a single onTrigger method.C - Class of connection to a data storage that this pattern puts data into.public class Put<FC,C extends AutoCloseable> extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
Put.PutFlowFile<FC,C> |
| Modifier and Type | Field and Description |
|---|---|
protected PartialFunctions.AdjustRoute<FC> |
adjustRoute |
protected PartialFunctions.Cleanup<FC,C> |
cleanup |
protected PartialFunctions.FetchFlowFiles<FC> |
fetchFlowFiles |
protected PartialFunctions.InitConnection<FC,C> |
initConnection |
protected ComponentLog |
logger |
protected PartialFunctions.OnCompleted<FC,C> |
onCompleted |
protected PartialFunctions.OnFailed<FC,C> |
onFailed |
protected Put.PutFlowFile<FC,C> |
putFlowFile |
protected PartialFunctions.TransferFlowFiles<FC> |
transferFlowFiles |
| Constructor and Description |
|---|
Put() |
| Modifier and Type | Method and Description |
|---|---|
void |
adjustRoute(PartialFunctions.AdjustRoute<FC> f)
Specify an optional function that adjust routed FlowFiles before transfer it.
|
void |
cleanup(PartialFunctions.Cleanup<FC,C> f)
Specify an optional function which will be called in a finally block.
|
void |
fetchFlowFiles(PartialFunctions.FetchFlowFiles<FC> f)
Specify an optional function that fetches incoming FlowFIles.
|
void |
initConnection(PartialFunctions.InitConnection<FC,C> f)
Specify a function that establishes a connection to target data storage.
|
void |
onCompleted(PartialFunctions.OnCompleted<FC,C> f)
Specify an optional function which will be called if input FlowFiles were successfully put to a target storage.
|
void |
onFailed(PartialFunctions.OnFailed<FC,C> f)
Specify an optional function which will be called if input FlowFiles failed being put to a target storage.
|
void |
onTrigger(ProcessContext context,
ProcessSession session,
FC functionContext)
Processor using this pattern is expected to call this method from its onTrigger.
|
void |
putFlowFile(Put.PutFlowFile<FC,C> f)
Specify a function that puts an incoming FlowFile to target data storage.
|
protected void |
putFlowFiles(ProcessContext context,
ProcessSession session,
FC functionContext,
C connection,
List<FlowFile> flowFiles,
RoutingResult result)
Put fetched FlowFiles to a data storage.
|
void |
setLogger(ComponentLog logger) |
void |
transferFlowFiles(PartialFunctions.TransferFlowFiles<FC> f)
Specify an optional function responsible for transferring routed FlowFiles.
|
protected void |
validateCompositePattern() |
protected PartialFunctions.InitConnection<FC,C extends AutoCloseable> initConnection
protected PartialFunctions.FetchFlowFiles<FC> fetchFlowFiles
protected Put.PutFlowFile<FC,C extends AutoCloseable> putFlowFile
protected PartialFunctions.TransferFlowFiles<FC> transferFlowFiles
protected PartialFunctions.AdjustRoute<FC> adjustRoute
protected PartialFunctions.OnCompleted<FC,C extends AutoCloseable> onCompleted
protected PartialFunctions.OnFailed<FC,C extends AutoCloseable> onFailed
protected PartialFunctions.Cleanup<FC,C extends AutoCloseable> cleanup
protected ComponentLog logger
protected void putFlowFiles(ProcessContext context, ProcessSession session, FC functionContext, C connection, List<FlowFile> flowFiles, RoutingResult result) throws ProcessException
context - process context passed from a Processor onTrigger.session - process session passed from a Processor onTrigger.functionContext - function context passed from a Processor onTrigger.connection - connection to data storage, established by PartialFunctions.InitConnection.flowFiles - FlowFiles fetched from PartialFunctions.FetchFlowFiles.result - Route incoming FlowFiles if necessary.ProcessExceptionprotected void validateCompositePattern()
public void onTrigger(ProcessContext context, ProcessSession session, FC functionContext) throws ProcessException
Processor using this pattern is expected to call this method from its onTrigger.
Typical usage would be constructing a process pattern instance at a processor method
which is annotated with OnScheduled,
and use pattern.onTrigger from processor.onTrigger.
PartialFunctions.InitConnection is required at least. In addition to any functions required by an implementation class.
context - process context passed from a Processor onTrigger.session - process session passed from a Processor onTrigger.functionContext - function context should be instantiated per onTrigger call.ProcessException - Each partial function can throw ProcessException if onTrigger should stop immediately.public void fetchFlowFiles(PartialFunctions.FetchFlowFiles<FC> f)
f - Function to fetch incoming FlowFiles.public void initConnection(PartialFunctions.InitConnection<FC,C> f)
f - Function to initiate a connection to a data storage.public void putFlowFile(Put.PutFlowFile<FC,C> f)
f - a function to put a FlowFile to target storage.public void adjustRoute(PartialFunctions.AdjustRoute<FC> f)
f - a function to adjust route.public void transferFlowFiles(PartialFunctions.TransferFlowFiles<FC> f)
f - a function to transfer routed FlowFiles.public void onCompleted(PartialFunctions.OnCompleted<FC,C> f)
f - Function to be called when a put operation finishes successfully.public void onFailed(PartialFunctions.OnFailed<FC,C> f)
f - Function to be called when a put operation failed.public void cleanup(PartialFunctions.Cleanup<FC,C> f)
f - Function to be called when a put operation finished regardless of whether it succeeded or not.public void setLogger(ComponentLog logger)
Copyright © 2019 Apache NiFi Project. All rights reserved.