Filtering and content-based routing

A connection point can send documents. The data flow defines which types of documents, such as sales orders or purchase orders, must be delivered to which other connection points. Even for a single document type, not all document instances are relevant for the next activity in a flow. Based on the content of the document, or based on document headers, documents may or may not be needed. All document types are supported when document headers are used. For routing based on document content, the BOD or JSON Conventional documents can be used. Use filtering or content-based routing to avoid delivering too many documents to a connection point.

In the toolbox of the document flow modeler, two types of flows are available for this purpose:

  • Filter

    Depending on the document content or headers and the filter conditions that are specified. Documents are sent to a destination if the filter condition is fulfilled. If the document does not match the filter, it is filtered out and not sent to the next step.

    For example, the CodeDefinition BOD represents multiple types of code master data. An application can only be interested in a subset of all code definitions, for example only 'reason codes' are relevant.

    Multi-document flows, such as master data flows or reporting flows, can also be filtered. You do not have to create multiple flows in that case.

  • Routing

    Depending on the document content or headers, documents are distributed to one or more destinations, depending on the routing conditions. If none of the routing conditions is met and default branch is not defined,, documents are filtered out.

    For example, a warehouse management application represents only one warehouse per application instance. An ERP application sends SyncPurchaseOrder messages. Depending on the warehouse on the purchase order line, the message must be sent to one or more specific warehouse management instances. A message is only sent to application instance WMS_1 if it contains at least one line for warehouse.

    You can define a default branch for routing. If none of the routing conditions are met, documents are sent to this default branch. Unlike a normal branch, the default branch can be left empty. There is one exception, if the default branch is empty and there is no activity after routing, the document has no route to go to. The document is marked as not matching the filter.

Note: To define filters or routing that are based on document content, the metadata for the documents to be routed must be available in the Data Catalog.

If the filter or routing receives BODs with the same document name but different verbs, the filtering or routing is the same for these verbs.

Note: The content-based routing depends on the data that is available in the document content or headers. If the sending application does not set attributes that are used in the condition, the result is not as expected. The contents of the BOD can also depend on the used verb and action code. For example, if a Sync message is sent with actionCode Delete, the document can only contain the identifiers, such as the document ID. To deal with such situation, use the actionCode in a condition or include a condition that explicitly checks for the existence of an attribute.

Content-based routing and filtering do not change the contents of a document. Either the complete document is passed on or not. Note that:

  • A document in the BOD can include repeating elements, such as multiple sales order lines. If the condition includes a check on such lines, the BOD is passed on if at least one of the lines matches the condition.
  • For some verbs, a BOD can contain multiple document instances, such as multiple sales orders. In that case, the BOD, including all document instances, is passed on if at least one of the sales orders matches the condition.