@ElementType(value=ITERATOR) public abstract class IteratingPipe<I> extends MessageSendingPipe
<results count="num_of_elements"> <result>result of processing of first item</result> <result>result of processing of second item</result> ... </results>For more configuration options, see
MessageSendingPipe
.
<param name="element-name-of-current-item" xpathExpression="name(/*)" /> <param name="value-of-current-item" xpathExpression="/*" />
Modifier and Type | Class and Description |
---|---|
protected class |
IteratingPipe.ItemCallback |
protected static class |
IteratingPipe.StopReason |
MessageSendingPipe.LinkMethod
HasStatistics.Action
Modifier and Type | Field and Description |
---|---|
protected static String |
MAX_ITEMS_REACHED_FORWARD |
protected TransformerPool |
msgTransformerPool |
protected static String |
STOP_CONDITION_MET_FORWARD |
INPUT_VALIDATOR_NAME_PREFIX, INPUT_VALIDATOR_NAME_SUFFIX, INPUT_WRAPPER_NAME_PREFIX, INPUT_WRAPPER_NAME_SUFFIX, MAX_RETRY_INTERVAL, MESSAGE_LOG_NAME_PREFIX, MESSAGE_LOG_NAME_SUFFIX, MIN_RETRY_INTERVAL, msgLog, OUTPUT_VALIDATOR_NAME_PREFIX, OUTPUT_VALIDATOR_NAME_SUFFIX, OUTPUT_WRAPPER_NAME_PREFIX, OUTPUT_WRAPPER_NAME_SUFFIX, PIPE_CLEAR_TIMEOUT_MONITOR_EVENT, PIPE_EXCEPTION_MONITOR_EVENT, PIPE_TIMEOUT_MONITOR_EVENT
AUTOMATIC_STREAMING
parameterNamesMustBeUnique
log
LONG_DURATION_MONITORING_EVENT, MESSAGE_SIZE_MONITORING_EVENT, PIPE_EXCEPTION_MONITORING_EVENT
Constructor and Description |
---|
IteratingPipe() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
canStreamToNextPipe()
called if the pipe implementation requests an OutputStream, to determine if there are side effects configured
that require the output of this pipe to be available at the return of the doPipe() method.
|
void |
configure()
checks for correct configuration of forward
|
protected IteratingPipe.ItemCallback |
createItemCallBack(PipeLineSession session,
ISender sender,
Writer out) |
protected I |
getItem(IDataIterator<I> it) |
protected IDataIterator<I> |
getIterator(Message input,
PipeLineSession session,
Map<String,Object> threadContext) |
protected TransformerPool |
getStopConditionTp() |
protected Message |
itemToMessage(I item) |
protected IteratingPipe.StopReason |
iterateOverInput(Message input,
PipeLineSession session,
Map<String,Object> threadContext,
IteratingPipe.ItemCallback callback) |
void |
iterateOverStatistics(StatisticsKeeperIterationHandler hski,
Object data,
HasStatistics.Action action) |
protected MessageOutputStream |
provideOutputStream(PipeLineSession session)
provide the outputstream, or null if a stream cannot be provided.
|
protected PipeRunResult |
sendMessage(Message input,
PipeLineSession session,
ISender sender,
Map<String,Object> threadContext) |
void |
setAddInputToResult(boolean b)
When
true the input is added to the result in an input element |
void |
setBlockSize(int i)
Controls multiline behaviour.
|
protected void |
setCloseIteratorOnExit(boolean b) |
void |
setCollectResults(boolean b)
Controls whether all the results of each iteration will be collected in one result message.
|
void |
setIgnoreExceptions(boolean b)
When
true ignore any exception thrown by executing sender |
void |
setItemNoSessionKey(String string)
Key of session variable to store number of items processed, i.e.
|
void |
setMaxChildThreads(int maxChildThreads)
Maximum number of child threads that may run in parallel simultaneously (combined total of all threads calling this pipe).
|
void |
setMaxItems(int maxItems)
The maximum number of items returned.
|
void |
setNamespaceDefs(String namespaceDefs)
Namespace defintions for xpathExpression.
|
void |
setOmitXmlDeclaration(boolean b)
Force the transformer generated from the xpath-expression to omit the xml declaration
|
void |
setOutputType(TransformerPool.OutputType outputType)
Only valid for xpathexpression
|
void |
setParallel(boolean parallel)
When set
true , the calls for all items are done in parallel (a new thread is started for each call). |
void |
setRemoveDuplicates(boolean b)
When
true duplicate input elements are removed, i.e. |
void |
setRemoveXmlDeclarationInResults(boolean b)
Postprocess each partial result, to remove the xml-declaration, as this is not allowed inside an xml-document
|
void |
setSender(ISender sender)
The sender that should send the message
|
void |
setStopConditionXPathExpression(String string)
Expression evaluated on each result and forwards to ["stopConditionMet"] forward if configured.
|
void |
setStyleSheetName(String stylesheetName)
Stylesheet to apply to each message, before sending it
|
void |
setXpathExpression(String string)
Alternatively: xpath-expression to create stylesheet from
|
canProvideOutputStream, consumesSessionVariable, doPipe, hasSizeStatistics, increaseRetryIntervalAndWait, preserve, propagateName, setAuditTrailNamespaceDefs, setAuditTrailSessionKey, setAuditTrailXPath, setCheckRootTag, setCheckXmlWellFormed, setCorrelationIDNamespaceDefs, setCorrelationIDSessionKey, setCorrelationIDStyleSheet, setCorrelationIDXPath, setExceptionOnResult, setHideMethod, setHideRegex, setInputValidator, setInputWrapper, setLabelNamespaceDefs, setLabelStyleSheet, setLabelXPath, setLinkMethod, setListener, setMaxRetries, setMessageLog, setName, setOutputValidator, setOutputWrapper, setPresumedTimeOutInterval, setResultOnTimeOut, setRetryMaxInterval, setRetryMinInterval, setRetryNamespaceDefs, setRetryXPath, setStreamResultToServlet, setStubFilename, setStubFileName, setTimeOutOnResult, setUseInputForExtract, start, stop, supportsOutputStreamPassThrough
getNextPipe, getTargetStream, isStreamingActive, provideOutputStream, setStreamingActive
getParameterValue, setIfParam, setIfValue, setOnlyIfSessionKey, setOnlyIfValue, setSkipOnEmptyInput, setUnlessSessionKey, setUnlessValue, skipPipe
addParameter, createBean, findForward, getAdapter, getEventSourceName, getForwards, getInSizeStatDummyObject, getOutSizeStatDummyObject, getParameterList, getParameterOverriddenAttributeValue, getParameterValueList, registerEvent, registerForward, setApplicationContext, setChompCharSize, setDurationThreshold, setElementToMove, setElementToMoveChain, setElementToMoveSessionKey, setEmptyInputReplacement, setGetInputFromFixedValue, setGetInputFromSessionKey, setLocker, setLogIntermediaryResults, setMaxThreads, setPreserveInput, setRemoveCompactMsgNamespaces, setRestoreMovedElements, setSecLogSessionKeys, setSizeStatistics, setStoreResultInSessionKey, setWriteToSecLog, throwEvent
configureTransactionAttributes, isTransacted, isTransacted, setTransacted, setTransactionTimeout
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getName
getChompCharSize, getDurationThreshold, getElementToMove, getElementToMoveChain, getElementToMoveSessionKey, getEmptyInputReplacement, getGetInputFromFixedValue, getGetInputFromSessionKey, getLocker, getSecLogSessionKeys, getStoreResultInSessionKey, isPreserveInput, isRemoveCompactMsgNamespaces, isRestoreMovedElements, isWriteToSecLog, setPipeLine
getMaxThreads
getApplicationContext, getName
getConfigurationClassLoader
getName
getTransactionAttribute, getTransactionTimeout, getTxDef, setTransactionAttribute
protected static final String MAX_ITEMS_REACHED_FORWARD
protected static final String STOP_CONDITION_MET_FORWARD
protected TransformerPool msgTransformerPool
public void configure() throws ConfigurationException
FixedForwardPipe
configure
in interface IConfigurable
configure
in interface IPipe
configure
in class MessageSendingPipe
ConfigurationException
protected IDataIterator<I> getIterator(Message input, PipeLineSession session, Map<String,Object> threadContext) throws SenderException
SenderException
protected IteratingPipe.ItemCallback createItemCallBack(PipeLineSession session, ISender sender, Writer out)
protected Message itemToMessage(I item) throws SenderException
SenderException
protected IteratingPipe.StopReason iterateOverInput(Message input, PipeLineSession session, Map<String,Object> threadContext, IteratingPipe.ItemCallback callback) throws SenderException, TimeoutException, IOException
protected MessageOutputStream provideOutputStream(PipeLineSession session) throws StreamingException
StreamingPipe
StreamingPipe.getNextPipe()
.provideOutputStream
in class MessageSendingPipe
StreamingException
protected boolean canStreamToNextPipe()
StreamingPipe
canStreamToNextPipe
in class MessageSendingPipe
protected PipeRunResult sendMessage(Message input, PipeLineSession session, ISender sender, Map<String,Object> threadContext) throws SenderException, TimeoutException, IOException
sendMessage
in class MessageSendingPipe
SenderException
TimeoutException
IOException
protected I getItem(IDataIterator<I> it) throws SenderException
SenderException
public void iterateOverStatistics(StatisticsKeeperIterationHandler hski, Object data, HasStatistics.Action action) throws SenderException
iterateOverStatistics
in interface HasStatistics
iterateOverStatistics
in class MessageSendingPipe
SenderException
public void setSender(ISender sender)
MessageSendingPipe
setSender
in class MessageSendingPipe
protected TransformerPool getStopConditionTp()
public void setStyleSheetName(String stylesheetName)
public void setXpathExpression(String string)
public void setNamespaceDefs(String namespaceDefs)
prefix=namespaceuri
-definitions. For some use other cases (NOT xpathExpression), one entry can be without a prefix, that will define the default namespace.public void setOutputType(TransformerPool.OutputType outputType)
public void setOmitXmlDeclaration(boolean b)
public void setItemNoSessionKey(String string)
public void setMaxItems(int maxItems)
public void setStopConditionXPathExpression(String string)
*[@finished='yes']
can be used.
This can be used if the condition to stop can be derived from the item result. To stop after a maximum number of items has been processed, use maxItems
.
Previous versions documented that position()=2
could be used. This is not working as expected; Use maxItems insteadpublic void setIgnoreExceptions(boolean b)
true
ignore any exception thrown by executing senderpublic void setCollectResults(boolean b)
false
, only a small summary is returned.
Setting this attributes to false
is often required to enable processing of very large files. N.B. Remember in such a case that setting transactionAttribute to NotSupported might be necessary toopublic void setRemoveXmlDeclarationInResults(boolean b)
public void setAddInputToResult(boolean b)
true
the input is added to the result in an input elementpublic void setRemoveDuplicates(boolean b)
true
duplicate input elements are removed, i.e. they are handled only onceprotected void setCloseIteratorOnExit(boolean b)
public void setParallel(boolean parallel)
true
, the calls for all items are done in parallel (a new thread is started for each call). when collectresults set true
, this pipe will wait for all calls to finish before results are collected and pipe result is returnedpublic void setMaxChildThreads(int maxChildThreads)
0
for unlimited threadspublic void setBlockSize(int i)
Copyright © 2023 Frank!Framework. All rights reserved.