Class IteratingPipe<I>

All Implemented Interfaces:
HasSender, HasTransactionAttribute, IConfigurable, IConfigurationAware, IForwardTarget, INamedObject, IPipe, IScopeProvider, IWithParameters, EventThrowing, HasStatistics, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware
Direct Known Subclasses:
StringIteratorPipe, XmlFileElementIteratorPipe, ZipIteratorPipe

@ElementType(ITERATOR) public abstract class IteratingPipe<I> extends MessageSendingPipe
Abstract base class to send a message to a Sender for each item returned by a configurable iterator.
The output of each of the processing of each of the elements is returned in XML as follows:
  <results count="num_of_elements">
    <result>result of processing of first item</result>
    <result>result of processing of second item</result>
For more configuration options, see MessageSendingPipe.
use parameters like:
        <param name="element-name-of-current-item"  xpathExpression="name(/*)" />
        <param name="value-of-current-item"         xpathExpression="/*" />
Gerrit van Brakel
  • Field Details

  • Constructor Details

    • IteratingPipe

      public IteratingPipe()
  • Method Details

    • configure

      public void configure() throws ConfigurationException
      Description copied from class: FixedForwardPipe
      checks for correct configuration of forward
      Specified by:
      configure in interface IConfigurable
      Specified by:
      configure in interface IPipe
      configure in class MessageSendingPipe
    • getIterator

      protected IDataIterator<I> getIterator(Message input, PipeLineSession session, Map<String,Object> threadContext) throws SenderException
    • createItemCallBack

      protected IteratingPipe<I>.ItemCallback createItemCallBack(PipeLineSession session, ISender sender, Writer out)
    • itemToMessage

      protected Message itemToMessage(I item) throws SenderException
    • iterateOverInput

      protected IteratingPipe.StopReason iterateOverInput(Message input, PipeLineSession session, Map<String,Object> threadContext, IteratingPipe<I>.ItemCallback callback) throws SenderException, TimeoutException, IOException
    • sendMessage

      protected PipeRunResult sendMessage(Message input, PipeLineSession session, ISender sender, Map<String,Object> threadContext) throws SenderException, TimeoutException, IOException
      sendMessage in class MessageSendingPipe
    • getItem

      protected I getItem(IDataIterator<I> it) throws SenderException
    • getStatisticsKeeper

      @Nonnull protected io.micrometer.core.instrument.DistributionSummary getStatisticsKeeper(String name)
    • setSender

      public void setSender(ISender sender)
      Description copied from class: MessageSendingPipe
      The sender that should send the message
      setSender in class MessageSendingPipe
    • getStopConditionTp

      protected TransformerPool getStopConditionTp()
    • setStyleSheetName

      public void setStyleSheetName(String styleSheetName)
      Stylesheet to apply to each message, before sending it
    • setXpathExpression

      public void setXpathExpression(String string)
      Alternatively: xpath-expression to create stylesheet from
    • setNamespaceDefs

      public void setNamespaceDefs(String namespaceDefs)
      Namespace defintions for xpathExpression. Must be in the form of a comma or space separated list of prefix=namespaceuri-definitions. For some use other cases (NOT xpathExpression), one entry can be without a prefix, that will define the default namespace.
    • setOutputType

      public void setOutputType(TransformerPool.OutputType outputType)
      Only valid for xpathexpression
      Default value
    • setOmitXmlDeclaration

      public void setOmitXmlDeclaration(boolean b)
      Force the transformer generated from the xpath-expression to omit the xml declaration
      Default value
    • setItemNoSessionKey

      public void setItemNoSessionKey(String string)
      Key of session variable to store number of items processed, i.e. the position or index in the set of items to be processed. When handling the first item, the value will be 1.
    • setMaxItems

      public void setMaxItems(int maxItems)
      The maximum number of items returned. The (default) value of 0 means unlimited, all available items will be returned. Special forward "maxItemsReached" can be configured to follow
      Default value
    • setStopConditionXPathExpression

      public void setStopConditionXPathExpression(String string)
      Expression evaluated on each result and forwards to ["stopConditionMet"] forward if configured. Iteration stops if condition returns anything other than an empty result. To test for the root element to have an attribute 'finished' with the value 'yes', the expression *[@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 instead
    • setIgnoreExceptions

      public void setIgnoreExceptions(boolean b)
      When true ignore any exception thrown by executing sender
      Default value
    • setCollectResults

      public void setCollectResults(boolean b)
      Controls whether all the results of each iteration will be collected in one result message. If set 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 too
      Default value
    • setRemoveXmlDeclarationInResults

      public void setRemoveXmlDeclarationInResults(boolean b)
      Postprocess each partial result, to remove the xml-declaration, as this is not allowed inside an xml-document
      Default value
    • setAddInputToResult

      public void setAddInputToResult(boolean b)
      When true the input is added to the result in an input element
      Default value
    • setRemoveDuplicates

      public void setRemoveDuplicates(boolean b)
      When true duplicate input elements are removed, i.e. they are handled only once
      Default value
    • setCloseIteratorOnExit

      protected void setCloseIteratorOnExit(boolean b)
    • setParallel

      public void setParallel(boolean parallel)
      When set 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 returned
      Default value
    • setMaxChildThreads

      public void setMaxChildThreads(int maxChildThreads)
      Maximum number of child threads that may run in parallel simultaneously (combined total of all threads calling this pipe). Use 0 for unlimited threads
      Default value
    • setBlockSize

      public void setBlockSize(int i)
      Controls multiline behaviour. When set to a value greater than 0, it specifies the number of rows send, in a one block, to the sender.
      Default value
    • getStyleSheetName

      public String getStyleSheetName()
    • getXpathExpression

      public String getXpathExpression()
    • getNamespaceDefs

      public String getNamespaceDefs()
    • getOutputType

      public TransformerPool.OutputType getOutputType()
    • isOmitXmlDeclaration

      public boolean isOmitXmlDeclaration()
    • getItemNoSessionKey

      public String getItemNoSessionKey()
    • getStopConditionXPathExpression

      public String getStopConditionXPathExpression()
    • getMaxItems

      public int getMaxItems()
    • isIgnoreExceptions

      public boolean isIgnoreExceptions()
    • isCollectResults

      public boolean isCollectResults()
    • isRemoveXmlDeclarationInResults

      public boolean isRemoveXmlDeclarationInResults()
    • isAddInputToResult

      public boolean isAddInputToResult()
    • isRemoveDuplicates

      public boolean isRemoveDuplicates()
    • isCloseIteratorOnExit

      public boolean isCloseIteratorOnExit()
    • isParallel

      public boolean isParallel()
    • getMaxChildThreads

      public int getMaxChildThreads()
    • getBlockSize

      public int getBlockSize()
    • getTaskExecutor

      public org.springframework.core.task.TaskExecutor getTaskExecutor()
    • setTaskExecutor

      public void setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)