Skip to main content

Multitenancy

Overview

Multitenancy is a type of architecture that enables several clients or multiple customer applications to share the same computational resources. These clients are known as tenants, and they have some measure of customization for the shared resource.

This form of sharing applies to software resources as well as hosting on servers to achieve efficiency and reducing cost. It allows multiple instances of the given application to operate in a shared environment.

There is only one set of infrastructure to deploy and maintain, and all tenants use it. Workflow Engine supports multitenancy in two different ways, as illustrated in the diagram below:

Multitenancy-wfe-scheme

Multitenancy Support in Workflow Engine

A Tenant Id is always passed at the process creation, and it cannot be changed further. A Tenant Id is a string.

var createInstanceParams = new CreateInstanceParams("SchemeCode", processId)
{
TenantId = "TenantId"
};

workflowRuntime.CreateInstance(createInstanceParams);

After setting, you can always get the Tenant Id value from the process instance; and, use it as you wish.

string tenantId = processInstance.TenantId;

Tags of Schemes

Each process scheme can be assigned a set of tags. Further, you can search for schemes with the given tags. For example, if you want to allow access to a scheme for selected tenants only, you can use the tags of this scheme.

Tags of Schemes in Workflow Engine

You can set tags either programmatically or in the schemes designer.

Using a code:

workflowRuntime.Builder.AddSchemeTags("SchemeCode", new List<string>() {"tag1", "tag2"});
workflowRuntime.Builder.RemoveSchemeTags("SchemeCode", new List<string>() {"tag1", "tag2"});

Using the schemes designer:

Tags

You can find scheme codes by tags using the following instruction:

workflowRuntime.GetSchemeCodes(new List<string>() {"tag1", "tag2"});

The search condition is OR. That is, the method returns all scheme codes with at least one of the tags indicated.