# Multi-Workflow Engine

## 1. Purpose

* Share document references between independent policies/instances using global topics.
* Let other policies listen to those topics and process incoming references in their own branches.
* Keep processing predictable: only events that match configured type/schema/filters are routed and executed.

## 2. Location

### **Admin setup (Policy Configurator)**

Where to add the blocks

* Open Policy Configurator
* Add Global Events Writer and Global Events Reader to the policy flow

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2FcS7MikwhpKp2SIAe5l6O%2Funknown.png?alt=media&#x26;token=07e81bbe-416b-4a26-a22d-5a6571239040" alt=""><figcaption></figcaption></figure>

Get complete information about the blocks: [Global Events Writer Block](https://guardian.hedera.com/guardian/standard-registry/policies/policy-creation/introduction/global-events-writer-block) and [Global Events Reader Block](https://guardian.hedera.com/guardian/standard-registry/policies/policy-creation/introduction/global-events-reader-block)

### 3. Publish policy

* Reader/Writer do not work in Dry Run (block UI/pages are not shown and logic is not executed)
* Publish the policy so configuration is applied in a real run.

### 4. User setup (during policy execution)

#### **Streams management (Writer/Reader)**

* In the running policy UI, open the Reader/Writer block page (streams/topics management)
* User can:
  * Add a global topic
  * Create a global topic
  * Toggle Active ON/OFF
    * ON = Writer publishes / Reader reads & processes
    * OFF = Writer skips / Reader ignores
  * Delete a topic/stream

#### **Streams management (Writer)**

* Document type by topic

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2FTwKGlbHlmphOburnzyGP%2Funknown.png?alt=media&#x26;token=b4801e32-2df6-4a8d-b3e6-c5f0e2d87d7a" alt=""><figcaption></figcaption></figure>

#### **Streams management (Reader)**

* User can set filter fields/values for a topic
* Filters are applied only if:
  * document type is VC
  * Admin configured a schema for the target branch

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2FyjqjlXdin4kcmslG94kw%2Funknown.png?alt=media&#x26;token=a6e7ab55-a101-4d14-8a70-c7fb2ba5d221" alt=""><figcaption></figcaption></figure>

#### **Branch execution rule (Reader)**

* A branch is executed only if the incoming event passes all checks:
  * document type matches (if configured)
  * schema validation passes (if configured)
  * field filters match (only if enabled and applicable)

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2FB3vwzws54yGjupmGMlR7%2Fimage.png?alt=media&#x26;token=c24c332f-091d-4a2f-886c-81127f015f88" alt=""><figcaption></figcaption></figure>
