Interface Management

Article05/08/20233 min read

Scenario

From the Aptean Mobile Warehouse app we need the possibility to register packaging transactions in case the customer uses the Aptean packaging app. The integration in this case, without creating dependency, is handled via the Aptean Interface Management app.

High level overview

Note

Interface Management only consist of generic (help) functions related to the interface process. All module specific code related to the interface process is part of the specific modules.

  1. Packaging entries are created via scanning and saved into a temporary table available in the Aptean Mobile Warehouse app.
  2. The packaging entries (only available / known by the Aptean Mobile Warehouse app) are packed (serialized to JSON via the Interface Management helper function) and send via generic functions available in the Interface Management app on basis of the interface contract. It’s possible serialize to JSON automatically or define the schema (per field (type) + how to handle) yourself.
  3. The package is received and unpacked (deserialized) in a temporary table (Only available/known by the Aptean Mobile Warehouse app) by the Packaging app, again using generic functions available in the Interface Management app on basis of the interface contract. When fields aren’t present in the defined schema they will not be parsed i.e. skipped.
  4. The App Integration Code triggers the defined procedure in the Packaging app, in this case register the Packaging entries on basis of the received record set in the actual Packaging entries table(only available / known by the Packaging app). When all goes well Packaging will set Handled to true. When errors occur in this final step it’s necessary to also backport the messages to the Aptean Mobile Warehouse app. Again this is possible by using the generic functions available in the Interface Management app on basis of its specific interface contract.

Process in more detail

Interface Management will only respond to known Interface Implementations. The instances of subscribers are managed by a SingleInstance codeunit. Interface Mgt. Each individual app requires a pair of codeunits:

  1. Contains the logic (EventSubscriberInstance = Manual)
  2. To register itself as an implementation, to bind an instance of codeunit 1 and pass that instance to Interface Mgt. when required.

Flow

  1. The Interface Management app knows all interface implementations by calling the interface implementations with a discovery event.
  2. The Aptean Mobile Warehouse app asks Interface Management to provide available implementations.
  3. The Aptean Mobile Warehouse app sets the following parameter values and asks Interface Management to raise the event:
  4. Interface Code, PACInterfaceCode, Implementation Code, PACImplementationCode, App Integration Code, SendPackTransFunction.
  5. Interface Management runs the codeunit set on registration of the interface implementation. This codeunit is responsible for binding an instance of the codeunit that contains the logic in the Aptean Mobile Warehouse app and passing that instance back to Interface Management which stores it in a VAR and keeps it in scope long enough to respond to the event in the following step
  6. Interface Management calls the OnInterfaceEvent event with the VAR set above, the one bound codeunit in scope within the Packaging app responds to the event.
  7. After reading the event parameters the Packaging app processes the received data on basis of the interface implementation procedure and if defined sets response data as requested (handled=true or false in case errors occur).
  8. The Aptean Mobile Warehouse app gets and reads the response if requested.