Maps: Difference between revisions
No edit summary |
Updated by push_wiki.py |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
A | A Map is the core configuration unit in Middleware4j. Each map defines a complete message transformation pipeline: where to read data from, how to transform it, and where to send the result. Multiple maps can run simultaneously, each in its own background thread. | ||
== Structure == | |||
Each map consists of: | |||
* One '''input connector''' — monitors a directory and reads incoming files | |||
* One or more '''output connectors''' — writes the transformed result to one or more destinations | |||
* Optional '''XSLT stylesheets''' on input and/or output for data transformation | |||
* Optional '''conditions''' on each output for content-based routing | |||
== How a Map Processes a File == | |||
# The input connector polls its configured directory at the set interval (default 1000 ms). | |||
# When a file matching the file mask arrives, it is read and converted to an internal XML document by the input connector. | |||
# If an input XSLT stylesheet is configured, it is applied to transform the XML. | |||
# Each output connector is evaluated in turn: | |||
## If a '''condition''' is configured, the output is only activated when the condition evaluates to true. | |||
## If activated, an optional output XSLT stylesheet is applied. | |||
## The result is written to the output destination by the output connector. | |||
# The original input file is moved to a backup location. | |||
# If any step fails, the file is renamed with an <code>.error</code> extension and an email notification is sent (if email is configured). | |||
== Configuration == | |||
Maps are defined in the main <code>config.xml</code> file. A minimal map looks like this: | |||
<syntaxhighlight lang="xml"> | <syntaxhighlight lang="xml"> | ||
<map> | |||
<id>Map01</id> | |||
<enabled>true</enabled> | |||
<description>ASCII File to CSV</description> | |||
<enableEmailNotifications>true</enableEmailNotifications> | |||
<connectors> | |||
<input> | |||
<id>in1</id> | |||
<type>ASCII</type> | |||
< | <url> | ||
<path>./interface/input/Map01</path> | |||
<mask/> | |||
<pollingInterval>1000</pollingInterval> | |||
</url> | |||
<xsl> | |||
<XSLT>Map01_ASCII_to_CSV.xsl</XSLT> | |||
</xsl> | |||
<ascii> | |||
<pattern>1-10,12-21,23-32</pattern> | |||
</ascii> | |||
</input> | |||
<output> | |||
<id>out1</id> | |||
<type>CSV</type> | |||
<url> | |||
<path>./interface/output/Map01</path> | |||
</url> | |||
</output> | |||
</connectors> | |||
</map> | |||
</syntaxhighlight> | </syntaxhighlight> | ||
== Key Settings == | |||
=== Map Level === | |||
{| class="wikitable" | |||
|- | |||
! Setting !! Description | |||
|- | |||
| '''id''' || Unique identifier for this map (e.g. Map01) | |||
|- | |||
| '''enabled''' || true/false — disabled maps are loaded but do not run | |||
|- | |||
| '''description''' || Human-readable description shown in the GUI | |||
|- | |||
| '''enableEmailNotifications''' || Whether to send error emails for this map | |||
|} | |||
=== Input Connector === | |||
{| class="wikitable" | |||
|- | |||
! Setting !! Description | |||
|- | |||
| '''type''' || The connector type: ASCII, CSV, XML, IDOC, Excel, EMAIL, RAW, PDF_PRINT | |||
|- | |||
| '''path''' || The directory to monitor for incoming files | |||
|- | |||
| '''mask''' || File extension filter (leave empty to process all files) | |||
|- | |||
| '''pollingInterval''' || How often to check the directory, in milliseconds | |||
|- | |||
| '''xsl / XSLT''' || Optional XSLT stylesheet to apply after reading | |||
|} | |||
=== Output Connector === | |||
{| class="wikitable" | |||
|- | |||
! Setting !! Description | |||
|- | |||
| '''type''' || The connector type: ASCII, CSV, XML, SOCKET, MQTT, EMAIL, Excel, PDF_PRINT, RAW, IDOC | |||
|- | |||
| '''path''' || Output directory (multiple directories separated by semicolons) | |||
|- | |||
| '''xsl / XSLT''' || Optional XSLT stylesheet to apply before writing | |||
|- | |||
| '''use83GUID''' || Use short (8.3) GUID filenames for legacy application compatibility | |||
|- | |||
| '''retainOriginalFilename''' || Keep the original input filename on the output file | |||
|} | |||
== Conditional Routing == | |||
An output connector can be made conditional using an XPath expression evaluated against the internal XML document. This allows a single map to route different messages to different outputs based on their content. | |||
<syntaxhighlight lang="xml"> | |||
<condition> | |||
<param1>/message/messageData/storageBin</param1> | |||
<param1_Type>xquery</param1_Type> | |||
<param2>DESPATCH</param2> | |||
<param2_Type>literal</param2_Type> | |||
<comparitor>EQUAL</comparitor> | |||
</condition> | |||
</syntaxhighlight> | |||
Supported comparitors are <code>EQUAL</code> and <code>NOT EQUAL</code>. Either or both parameters can be XPath expressions (<code>xquery</code>) or fixed values (<code>literal</code>). | |||
== Multiple Outputs == | |||
A single map can have any number of output connectors. All enabled outputs whose conditions are satisfied receive the transformed message. This allows one incoming file to simultaneously update multiple systems in different formats. | |||
== Global Settings == | |||
Global settings that apply to all maps are defined at the top of <code>config.xml</code>: | |||
{| class="wikitable" | |||
|- | |||
! Setting !! Description | |||
|- | |||
| '''logPath''' || Directory for transformation log files | |||
|- | |||
| '''XSLTPath''' || Directory where XSLT stylesheets are stored | |||
|- | |||
| '''logArchiveRetentionDays''' || How many days to keep old log files | |||
|- | |||
| '''retryOpenFileCount''' || Number of times to retry reading a locked file | |||
|- | |||
| '''retryOpenFileDelay''' || Delay in milliseconds between retries | |||
|- | |||
| '''enableEmailNotifications''' || Global email notification toggle | |||
|- | |||
| '''statusReportTime''' || Time of day to send the daily status report email | |||
|} | |||
See also: [[Connectors]], [[Middleware4j Example Configuration]], [[Overview_Middleware4j]] | |||
[[Category:Middleware4j]] | |||
Latest revision as of 12:17, 1 April 2026
A Map is the core configuration unit in Middleware4j. Each map defines a complete message transformation pipeline: where to read data from, how to transform it, and where to send the result. Multiple maps can run simultaneously, each in its own background thread.
Structure
Each map consists of:
- One input connector — monitors a directory and reads incoming files
- One or more output connectors — writes the transformed result to one or more destinations
- Optional XSLT stylesheets on input and/or output for data transformation
- Optional conditions on each output for content-based routing
How a Map Processes a File
- The input connector polls its configured directory at the set interval (default 1000 ms).
- When a file matching the file mask arrives, it is read and converted to an internal XML document by the input connector.
- If an input XSLT stylesheet is configured, it is applied to transform the XML.
- Each output connector is evaluated in turn:
- If a condition is configured, the output is only activated when the condition evaluates to true.
- If activated, an optional output XSLT stylesheet is applied.
- The result is written to the output destination by the output connector.
- The original input file is moved to a backup location.
- If any step fails, the file is renamed with an
.errorextension and an email notification is sent (if email is configured).
Configuration
Maps are defined in the main config.xml file. A minimal map looks like this:
<map>
<id>Map01</id>
<enabled>true</enabled>
<description>ASCII File to CSV</description>
<enableEmailNotifications>true</enableEmailNotifications>
<connectors>
<input>
<id>in1</id>
<type>ASCII</type>
<url>
<path>./interface/input/Map01</path>
<mask/>
<pollingInterval>1000</pollingInterval>
</url>
<xsl>
<XSLT>Map01_ASCII_to_CSV.xsl</XSLT>
</xsl>
<ascii>
<pattern>1-10,12-21,23-32</pattern>
</ascii>
</input>
<output>
<id>out1</id>
<type>CSV</type>
<url>
<path>./interface/output/Map01</path>
</url>
</output>
</connectors>
</map>
Key Settings
Map Level
| Setting | Description |
|---|---|
| id | Unique identifier for this map (e.g. Map01) |
| enabled | true/false — disabled maps are loaded but do not run |
| description | Human-readable description shown in the GUI |
| enableEmailNotifications | Whether to send error emails for this map |
Input Connector
| Setting | Description |
|---|---|
| type | The connector type: ASCII, CSV, XML, IDOC, Excel, EMAIL, RAW, PDF_PRINT |
| path | The directory to monitor for incoming files |
| mask | File extension filter (leave empty to process all files) |
| pollingInterval | How often to check the directory, in milliseconds |
| xsl / XSLT | Optional XSLT stylesheet to apply after reading |
Output Connector
| Setting | Description |
|---|---|
| type | The connector type: ASCII, CSV, XML, SOCKET, MQTT, EMAIL, Excel, PDF_PRINT, RAW, IDOC |
| path | Output directory (multiple directories separated by semicolons) |
| xsl / XSLT | Optional XSLT stylesheet to apply before writing |
| use83GUID | Use short (8.3) GUID filenames for legacy application compatibility |
| retainOriginalFilename | Keep the original input filename on the output file |
Conditional Routing
An output connector can be made conditional using an XPath expression evaluated against the internal XML document. This allows a single map to route different messages to different outputs based on their content.
<condition> <param1>/message/messageData/storageBin</param1> <param1_Type>xquery</param1_Type> <param2>DESPATCH</param2> <param2_Type>literal</param2_Type> <comparitor>EQUAL</comparitor> </condition>
Supported comparitors are EQUAL and NOT EQUAL. Either or both parameters can be XPath expressions (xquery) or fixed values (literal).
Multiple Outputs
A single map can have any number of output connectors. All enabled outputs whose conditions are satisfied receive the transformed message. This allows one incoming file to simultaneously update multiple systems in different formats.
Global Settings
Global settings that apply to all maps are defined at the top of config.xml:
| Setting | Description |
|---|---|
| logPath | Directory for transformation log files |
| XSLTPath | Directory where XSLT stylesheets are stored |
| logArchiveRetentionDays | How many days to keep old log files |
| retryOpenFileCount | Number of times to retry reading a locked file |
| retryOpenFileDelay | Delay in milliseconds between retries |
| enableEmailNotifications | Global email notification toggle |
| statusReportTime | Time of day to send the daily status report email |
See also: Connectors, Middleware4j Example Configuration, Overview_Middleware4j