Using Adapter Templates

Adapters are used in the context of a larger business process. This business process itself may be part of an even greater business process. In order to maximize flexibility and re-use, Business Processes can be defined one time but re-used many times. Using Adapter Templates enables a highly-reusable Business Process architecture.

Business Use

Suppose you are hosting your own FTP server. On the FTP server, each of your trading partners have their own mailbox or pickup location. This is important - when they connect they only see their documents. Daily, when you generate your invoices, you want to place each trading partner's invoices in their specific mailbox.

The process of generating and distributing invoices is fairly static; it follows a common, straightforward, and unchanging pattern. First, generate the invoices, then distribute each invoice to the appropriate mailbox. The only variability in the process is the mailbox into which the invoice is dropped. If you had 15 trading partners, you wouldn't want to develop 15 identical processes, with the only difference being which mailbox receives the invoice. In this case, Clarify allows you to build one Business Process, call it 15 times, but pass (as a parameter) the mailbox (a File Adapter in this case) into which to place the invoice. When the Business Process reaches the step to drop the invoice in a mailbox, it uses the File Adapter passed in as a parameter, and drops the invoice in the specified mailbox.

How the Object Works

Business Process re-use Adapters via Adapter Templates. Adapter Templates serve as a model that other Adapters implement. Using Adapter templates allows you to pass an Adapter to the Business Process for it to execute, instead of explicitly adding a specific Adapter to a Business Process. This allows you to develop a single Business Process, but allow it to behave differently based on information supplied to it. In general, business processes are relatively static, but are often supplied with variable values. Clarify Business Processes are designed to mirror this paradigm.

When you add an Adapter Template step to a Business Process, you create a placeholder for the execution of an Adapter. When you build a re-usable Business Process during design-time, you don't know which Adapter will be called at runtime, as it will be passed in at runtime. By adding an Adapter Template step, you instruct the Business Process to execute an Adapter, but it won't know which one until the Business Process executes.

Adapter Templates can be used for all Adapter types. There are two primary rules:
  1. The type of the Adapter and the Adapter Template must be identical. For example, if the Adapter Template is of type File Write, the Adapter must be a File Write type as well.
  2. The number and type of parameters on the Adapter Template dictate which Adapters can be passed to the Business Process.

For example, suppose you have a File Write Adapter Template named Write with FileName - Templatewith two parameters: storageNode and fileName. The storageNode parameter represents the data; the fileName parameter represents the name of the file to be written. In a Business Process, you select Write with FileName - Template to execute as a step.

When you create an Adapter (for example, File Write for MyCo) that is to implement that Adapter Template select Write with File - Template in its Template File Adapter field. The action of associating the template with the adapter allows File Write for MyCo to be passed into the Business Process and be called in place of Write with FileName - Template. They share the same parameters (storageNode and fileName) and are the same type (File Write Adapter).

Allowing Adapters to be passed and executed in place of the Adapter Template enables you to model the Business Process one time, but change its behavior based on runtime inputs. In this way, Clarify models and executes Business Processes the same way your business does.

There are other benefit's to using Adapter Templates.
  1. Reduceed development costs. You only have to build one Clarify Business Process that mimics your organization's business process.
  2. Reduced maintenance overhead. For example, if in our example you need to add a trading partner, you don't have to build another Business Process. You simply pass in another Adapter.
  3. Mass changes. If the process changes, instead of having to change the process for each trading partner, you can change the process one time.

The most common use case for Adapter Templates is on outbound EDI. Outbound EDI uses an Cleo-supplied Business Process, which executes a user-defined Connection Business Process. Simply, Connection Business Processes dispatch enveloped EDI documents to your trading partners. That process is relatively static - in most cases you simply call the right kind of Adapter (FTP, File) or AS2. You can create a simple Connection Business Process that executes an Adapter Template and passes an Adapter as a parameter. For each trading partner, you call the Connection Business Process and pass in the trading partner's specific Adapter. This design allows you to create one Business Process, but leverage it for all trading partners.