This online supplement to the documentation for version 3.0.0 of the Open eGov MessageHandler shows concrete configuration examples. Please refer to the documentation for details of the configurations options.
Common recommendations
- As always: RTFM!
- Keep installation directories for sedex and MH apart from inboxes, outboxes and log directories.
- A single sedex adapter can serve N application (N > 1) only, if each of the applications uses a different sedex message type or if the application can be addressed through different logical sedex IDs.
- If you intend to let a single sedex adapter to serve N application (N > 1), it’s a good idea to allocate a logical sedex participant per application and to use the physical sedex participant ID to address the sedex adapter only.
Common rule: 1 application = 1 logical sedex participant. - If you intend to let a single sedex adapter to serve N application (N > 1), which use the same sedex message type for communication, you will be force to use the rule above!
Case 1 – One eSchKG/e-LP/e-LEF application
Assumption
- One single eSchKG/e-LP/e-LEF application has to be connected to the sedex network.
- No further applications are to be served by the same sedex adapter.
- One nativeApp -> Native Mode
- One physical sedex participant (=sedex ID) is needed for the sedex adapter (T7-4-1 in the example configuration).
Prerequisite
- One physical sedex participant (=sedex ID) is needed for the sedex adapter (T7-4-1 in the example configuration).
Example configuration
Directory structure
/mh_examples/case1/ . +-- application ¦ +-- inbox ¦ +-- outbox +-- log ¦ +-- mh ¦ +-- sedex +-- mh ¦ +-- install-dir ¦ ¦ +-- bin ¦ ¦ +-- conf ¦ ¦ ¦ +-- config.xml ¦ ¦ ¦ +-- config.xsd ¦ ¦ ¦ +-- log4j.properties ¦ ¦ ¦ +-- recipientIdResolver.groovy ¦ ¦ ¦ +-- wrapper.conf ¦ ¦ +-- lib ¦ +-- working-dir ¦ +-- corrupted ¦ +-- db ¦ +-- sent ¦ +-- tmp ¦ ¦ +-- preparing ¦ ¦ +-- receiving ¦ +-- unknown +-- sedex +-- inbox +-- outbox +-- receipts +-- sent
config.xml
<?xml version="1.0" encoding="UTF-8"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://msghandler.suis.admin.ch/xmlns/config config.xsd" xmlns="http://msghandler.suis.admin.ch/xmlns/config" version="3.0"> <sedexAdapter> <participantId>T7-4-1</participantId> <inboxDir>/mh_examples/case1/sedex/inbox</inboxDir> <outboxDir>/mh_examples/case1/sedex/outbox</outboxDir> <receiptDir>/mh_examples/case1/sedex/receipts</receiptDir> <sentDir>/mh_examples/case1/sedex/sent</sentDir> </sedexAdapter> <messageHandler> <!-- In diesem Pfad mssen die MH Basis-Verzeichnisse sein: corrupted, tmp, unkown, etc. --> <workingDir dirPath="/mh_examples/case1/mh/working-dir"/> <!-- Wo starten relative Pfade --> <baseDir dirPath="/mh_examples/case1/application"/> <!-- wie oft wird die sedex inbox geprft --> <sedexInboxDirCheck cron="0/5 * * * * ?" /> <!-- wie oft wird das sedex receipts directoty geprft --> <sedexReceiptDirCheck cron="0/5 * * * * ?" /> <!-- jede *outbox kann Wert berschreiben --> <defaultOutboxCheck cron="0/5 * * * * ?" /> <webserviceInterface host="localhost" port="18080"/> <statusDatabase dirPath="/mh_examples/case1/mh/working-dir/db" dataHoldTimeInDays="2" resend="true"/> <protocol createPerMessageProtocols="false"/> </messageHandler> <nativeApp participantId="T7-4-1" > <!-- die lokale sedexId --> <outbox dirPath="outbox" msgType="10301"> <recipientIdResolver filePath="/mh_examples/case1/mh/install-dir/conf/recipientIdResolver.groovy" method="resolve" /> </outbox> <inbox dirPath="inbox" msgTypes="10301"/> </nativeApp> </config>
recipientIdResolver.groovy
/** * This resolver works for eSchKG messages. The sedex ID will be extracted * from the filename. * * @param filename the name of the file to be sent including path * @return the resolved Sedex-ID or an empty string */ def String resolve(String filename) { // If the filename matches the eSchKG convention -> extract sedex ID def matcher = (filename =~ /^.*\/([1-9]-[0-9A-Z]+-[0-9]+)_.*/) if (matcher.matches()) { return matcher.group(1) } // If all else fails: return empty string return '' }
Case 2 – Two eSchKG/e-LP/e-LEF applications
Assumption
- Two eSchKG/e-LP/e-LEF applications are to be connected to the sedex network over one single sedex adapter.
- Two nativeApps -> Native Mode.
- One physical sedex participant for the sedex adapter (T7-4-1 in the example configuration).
- Two logical sedex participants for the applications (T7-4-2 and T7-4-3 in the example configuration).
Prerequisite
- One physical sedex participant for the sedex adapter (T7-4-1 in the example configuration).
- Two logical sedex participants for the applications (T7-4-2 and T7-4-3 in the example configuration).
Both applications work with the same sedex message type (10301). Due to this each application requires its own logical sedex ID!
Example configuration
Directory structure
mh_examples/case2/ . +-- applicationA ¦ +-- inbox ¦ +-- outbox +-- applicationB ¦ +-- inbox ¦ +-- outbox +-- log ¦ +-- mh ¦ +-- sedex +-- mh ¦ +-- install-dir ¦ ¦ +-- bin ¦ ¦ +-- conf ¦ ¦ ¦ +-- config.xml ¦ ¦ ¦ +-- config.xsd ¦ ¦ ¦ +-- log4j.properties ¦ ¦ ¦ +-- recipientIdResolver.groovy ¦ ¦ +-- lib ¦ +-- working-dir ¦ +-- corrupted ¦ +-- db ¦ +-- sent ¦ +-- tmp ¦ ¦ +-- preparing ¦ ¦ +-- receiving ¦ +-- unknown +-- sedex +-- inbox +-- outbox +-- receipts +-- sent
config.xml
<?xml version="1.0" encoding="UTF-8"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://msghandler.suis.admin.ch/xmlns/config config.xsd" xmlns="http://msghandler.suis.admin.ch/xmlns/config" version="3.0"> <sedexAdapter> <participantId>T7-4-1</participantId> <inboxDir>/mh_examples/case2/sedex/inbox</inboxDir> <outboxDir>/mh_examples/case2/sedex/outbox</outboxDir> <receiptDir>/mh_examples/case2/sedex/receipts</receiptDir> <sentDir>/mh_examples/case2/sedex/sent</sentDir> </sedexAdapter> <messageHandler> <!-- In diesem Pfad mssen die MH Basis-Verzeichnisse sein: corrupted, tmp, unkown, etc. --> <workingDir dirPath="/mh_examples/case2/mh/working-dir"/> <!-- Wo starten relative Pfade --> <baseDir dirPath="/mh_examples/case2"/> <!-- wie oft wird die sedex inbox geprft --> <sedexInboxDirCheck cron="0/30 * * * * ?" /> <!-- wie oft wird das sedex receipts directoty geprft --> <sedexReceiptDirCheck cron="0/30 * * * * ?" /> <!-- jede *outbox kann Wert berschreiben --> <defaultOutboxCheck cron="0/30 * * * * ?" /> <webserviceInterface host="localhost" port="18080"/> <statusDatabase dirPath="/mh_examples/case2/mh/working-dir/db" dataHoldTimeInDays="2" resend="true"/> <protocol createPerMessageProtocols="false"/> </messageHandler> <nativeApp participantId="T7-4-2" > <!-- die lokale sedexId --> <outbox dirPath="applicationA/outbox" msgType="10301"> <recipientIdResolver filePath="/mh_examples/case2/mh/install-dir/conf/recipientIdResolver.groovy" method="resolve" /> </outbox> <inbox dirPath="applicationA/inbox" msgTypes="10301"/> </nativeApp> <nativeApp participantId="T7-4-3" > <!-- die lokale sedexId --> <outbox dirPath="applicationB/outbox" msgType="10301"> <recipientIdResolver filePath="/mh_examples/case2/mh/install-dir/conf/recipientIdResolver.groovy" method="resolve" /> </outbox> <inbox dirPath="applicationB/inbox" msgTypes="10301"/> </nativeApp> </config>