Platform Workflow Processors
To process and change data on the fly in Appkit, processors are usually added either to modify queries or responses.
This is where the workflow platform comes in. It lets you configure processors through configuration files.
How to configure a workflow chain (post Appkit v3.0)
There are two steps to follow when configuring a workflow chain:
-
Add the
workflow
attribute to your normal platform configuration. This will point to the workflow processors you want to run on the platform. -
Add configuration for each workflow processor.
Platform configuration
The normal platform configuration (for example, platforms/gsa.conf
) would have a workflow
attribute, paired with a comma-separated list of workflow processors to run on the platform. For example:
workflow: processors.response.capitaliseFieldValuesProcessor,processors.response.highlightFieldValuesProcessor,processors.response.copyFieldsProcessor
Each processor listed contains the name and folder path to a given processor .conf
file within the conf
directory - this can be organized however you want.
Processor configuration
Each of the processors would be configured with key-value pairs. For example:
capitaliseFieldValuesProcessor.conf
This, like all configuration files is made up of key-value pairs. You reference a name with the classpath of a given processor (either Appkit’s or your own). You then pass in the attributes of this processor as key-value pairs - in this case fields.
name: twigkit.search.processors.response.CapitaliseFieldValuesProcessor
fields: fieldA,fieldB
Calling the workflow platform
Since the workflow
attribute is part of the normal platform configuration, there is no must explicitly call the workflow platform. Simply call the normal platform:
<search:platform var="platform" conf="platforms.gsa"></search:platform>
or
<media:excel conf="platforms.gsa" query="query" fetch="10000" fields="title,foo" header="myTitle,myFoo">Export</media:excel>
Calling the normal platform would automatically run the configured processors at runtime.
Example configuration
This example would likely be configured using this setup, with each of these broken down below this.
/resources/conf/platforms
/gsa
gsa.conf (your normal GSA conf)
/workflow
workflow.conf
gsaWithProcessing.conf
/resources/conf/processors
/response
/capitaliseFieldValuesProcessor.conf
/highlightFieldValuesProcessor.conf
/copyFieldsProcessor.conf
/processors.conf
Platform configuration
Each of the processors would be configured with key value pairs, like:
workflow.conf
This file indicates to Appkit that this is a workflow configuration, and to trigger processing of that as such.
name: twigkit.platform.Workflow
gsaWithProcessing.conf
This is the part that tied together a standard existing platform configuration and one or more processor configurations.
platform: platforms.solr.excel
workflow: processors.response.capitaliseFieldValuesProcessor,processors.response.highlightFieldValuesProcessor,processors.response.copyFieldsProcessor
The processor confs mentioned are the name and folder path to a given processor .conf
file within the conf
directory; this can be organized however you want.
Processor configuration
Each of the processors would be configured with key value pairs, much like you would pass in attributes to a normal processor tag within your JSP for example:
capitaliseFieldValuesProcessor.conf
This file, like all .conf
files, is made up of key value pairs. You reference a name with the classpath of a given processor (either Appkit’s or your own). You then pass in the attributes of this processor as key value pairs - in this case as fields.
name: twigkit.search.processors.response.CapitaliseFieldValuesProcessor
fields: fieldA,fieldB
Calling the workflow platform
You just call the workflow platform as you would a normally configured platform for example:
<search:platform var="platform" conf="platforms.workflow.gsaWithProcessing"></search:platform>
Or:
<media:excel conf="platforms.workflow.gsaWithProcessing" query="${query}" fetch="10000" fields="title,foo" header="myTitle,myFoo">Export</media:excel>
The configured processors get run at runtime.