Connectors: Difference between revisions
No edit summary |
Updated by push_wiki.py |
||
| Line 1: | Line 1: | ||
[[ | Connectors are the components within Middleware4j responsible for reading from and writing to specific file formats and protocols. Each [[Maps|Map]] has one input connector and one or more output connectors. The connector type determines how the data is read, written, or transmitted. | ||
== How Connectors Work == | |||
When a file arrives in an input directory, the input connector reads it and converts the data into an internal XML representation. This XML is then optionally transformed by an XSLT stylesheet before being passed to each output connector. The output connector converts the XML back into the required format and writes it to the destination. | |||
== Available Connectors == | |||
=== [[ASCII]] === | |||
Reads or writes fixed-column flat files. The key configuration is the '''pattern''' attribute, which specifies which column ranges to extract from (input) or write to (output). For example, <code>1-10,12-21,23-32</code> extracts three fields from columns 1–10, 12–21, and 23–32. | |||
Use this connector when integrating with legacy systems that produce or consume fixed-width files. | |||
=== [[CSV]] === | |||
Reads or writes delimiter-separated files using the Apache Commons CSV library. Configurable options include the delimiter character, quote character, and whether to handle 8.3 short filenames for legacy compatibility. | |||
Use this connector for comma- or caret-separated files, spreadsheet exports, and similar tabular data. | |||
=== [[XML]] === | |||
Reads or writes XML files. Because Middleware4j processes all data internally as XML, this connector requires no intermediate conversion — the file is loaded directly as the working document. XSLT stylesheets transform the structure as required. | |||
Use this connector when the source or destination system uses XML, including Commander4j's own interface message format. | |||
=== IDOC === | |||
Reads or writes SAP IDOC format files. IDOCs are fixed-format flat files used by SAP for data exchange. Middleware4j includes schema definitions for common IDOC types and converts them to XML for processing. | |||
Use this connector when integrating with SAP systems that produce or consume IDOC files. | |||
=== Excel === | |||
Reads XLS and XLSX spreadsheet files using Apache POI, or writes data to Excel format. Useful for integrating with systems that exchange data via spreadsheet. | |||
=== [[EMAIL]] === | |||
Sends files as email attachments via SMTP, or monitors an email inbox for incoming attachments. Email distribution lists and SMTP credentials are configured in the separate <code>email.xml</code> file. | |||
Use this connector to deliver reports or notifications by email, or to receive data files submitted via email. | |||
=== [[RAW]] === | |||
Copies or moves files without any transformation or format conversion. Unlike other connectors, RAW does not convert the file to an XML representation — it passes the bytes through unchanged. This is significantly more efficient for large files or binary content. | |||
Use this connector when you simply need to move or replicate files between directories or file shares without modifying them. | |||
=== [[PDF_PRINT]] === | |||
Monitors a directory for PDF files and automatically sends them to a named printer queue. The output connector configuration specifies the queue name. | |||
Use this connector to automate printing of reports, labels, or documents that are generated and dropped as PDF files by another system. | |||
=== [[SOCKET]] === | |||
Transmits the transformed output to a device or service over a TCP/IP socket connection. The host IP address, port number, and optional repeat count are configured on the output connector. Useful for sending data directly to label printers, weighing systems, or other networked devices. | |||
=== MQTT === | |||
Publishes the transformed output to an MQTT message broker. The broker address, topic, and quality of service level are configurable. Useful for IoT integration and event-driven architectures. | |||
== Connector Configuration Reference == | |||
Each connector type has its own set of configuration elements within the map's <code><input></code> or <code><output></code> block in <code>config.xml</code>. See the individual connector pages and [[Middleware4j Example Configuration]] for worked examples. | |||
== Error Handling == | |||
If a connector fails to process a file (for example, because the format is invalid or the destination is unavailable), the input file is renamed with an <code>.error</code> extension and left in the input directory. An email notification is sent if email notifications are enabled for that map. | |||
See also: [[Maps]], [[Middleware4j Example Configuration]], [[Overview_Middleware4j]] | |||
[[Category:Middleware4j]] | |||
Latest revision as of 12:17, 1 April 2026
Connectors are the components within Middleware4j responsible for reading from and writing to specific file formats and protocols. Each Map has one input connector and one or more output connectors. The connector type determines how the data is read, written, or transmitted.
How Connectors Work
When a file arrives in an input directory, the input connector reads it and converts the data into an internal XML representation. This XML is then optionally transformed by an XSLT stylesheet before being passed to each output connector. The output connector converts the XML back into the required format and writes it to the destination.
Available Connectors
ASCII
Reads or writes fixed-column flat files. The key configuration is the pattern attribute, which specifies which column ranges to extract from (input) or write to (output). For example, 1-10,12-21,23-32 extracts three fields from columns 1–10, 12–21, and 23–32.
Use this connector when integrating with legacy systems that produce or consume fixed-width files.
CSV
Reads or writes delimiter-separated files using the Apache Commons CSV library. Configurable options include the delimiter character, quote character, and whether to handle 8.3 short filenames for legacy compatibility.
Use this connector for comma- or caret-separated files, spreadsheet exports, and similar tabular data.
XML
Reads or writes XML files. Because Middleware4j processes all data internally as XML, this connector requires no intermediate conversion — the file is loaded directly as the working document. XSLT stylesheets transform the structure as required.
Use this connector when the source or destination system uses XML, including Commander4j's own interface message format.
IDOC
Reads or writes SAP IDOC format files. IDOCs are fixed-format flat files used by SAP for data exchange. Middleware4j includes schema definitions for common IDOC types and converts them to XML for processing.
Use this connector when integrating with SAP systems that produce or consume IDOC files.
Excel
Reads XLS and XLSX spreadsheet files using Apache POI, or writes data to Excel format. Useful for integrating with systems that exchange data via spreadsheet.
Sends files as email attachments via SMTP, or monitors an email inbox for incoming attachments. Email distribution lists and SMTP credentials are configured in the separate email.xml file.
Use this connector to deliver reports or notifications by email, or to receive data files submitted via email.
RAW
Copies or moves files without any transformation or format conversion. Unlike other connectors, RAW does not convert the file to an XML representation — it passes the bytes through unchanged. This is significantly more efficient for large files or binary content.
Use this connector when you simply need to move or replicate files between directories or file shares without modifying them.
PDF_PRINT
Monitors a directory for PDF files and automatically sends them to a named printer queue. The output connector configuration specifies the queue name.
Use this connector to automate printing of reports, labels, or documents that are generated and dropped as PDF files by another system.
SOCKET
Transmits the transformed output to a device or service over a TCP/IP socket connection. The host IP address, port number, and optional repeat count are configured on the output connector. Useful for sending data directly to label printers, weighing systems, or other networked devices.
MQTT
Publishes the transformed output to an MQTT message broker. The broker address, topic, and quality of service level are configurable. Useful for IoT integration and event-driven architectures.
Connector Configuration Reference
Each connector type has its own set of configuration elements within the map's <input> or <output> block in config.xml. See the individual connector pages and Middleware4j Example Configuration for worked examples.
Error Handling
If a connector fails to process a file (for example, because the format is invalid or the destination is unavailable), the input file is renamed with an .error extension and left in the input directory. An email notification is sent if email notifications are enabled for that map.
See also: Maps, Middleware4j Example Configuration, Overview_Middleware4j