An activator allows a micro application to initialize and connect to the platform upon host application's startup, i.e., when the user loads the web application into the browser.

In the broadest sense, an activator is a kind of microfrontend, i.e. an HTML page that runs in an iframe. In contrast to regular microfrontends, however, at platform startup, the platform loads activator microfrontends into hidden iframes for the entire platform lifecycle, thus, providing a stateful session to the micro application on the client-side.

Some typical use cases for activators are receiving messages and intents, preloading data, or flexibly providing capabilities.

A micro application registers an activator as public activator capability in its manifest, as follows:

"capabilities": [
{
"type": "activator",
"private": false,
"properties": {
"path": "path/to/the/activator"
}
}
]

Activation Context

An activator's microfrontend runs inside an activation context. The context provides access to the activator capability, allowing to read properties declared on the activator capability.

You can obtain the activation context using the ContextService as following.

// Looks up the activation context.
const ctx: ActivationContext = await Beans.get(ContextService).lookup(ACTIVATION_CONTEXT);

Multiple Activators

A micro application can register multiple activators. Note, that each activator boots the micro application on its own and runs in a separate browsing context. The platform nominates one activator of each micro application as its primary activator. The nomination has no relevance to the platform but can help code decide whether to install singleton functionality.

You can test if running in the primary activation context as following.

// Looks up the activation context.
const ctx = await Beans.get(ContextService).lookup<ActivationContext>(ACTIVATION_CONTEXT);
// Checks if running in the context of the primary activator.
const isPrimary: boolean = ctx.primary;

Sharing State

Since an activator runs in a separate browsing context, microfrontends cannot directly access its state. Instead, an activator could put data, for example, into session storage, so that microfrontends of its micro application can access it. Alternatively, an activator could install a message listener, allowing microfrontends to request data via client-side messaging.

Hierarchy

Properties

description?: string

A short description to explain the capability.

params?: ParamDefinition[]

Specifies parameters which the intent issuer can/must pass along with the intent.

Parameters are part of the contract between the intent publisher and the capability provider. They do not affect the intent routing, unlike the qualifier.

private: false

Controls if this capability is visible to other micro applications. If private, which is by default, the capability is not visible to other micro applications; thus, it can only be invoked or looked up by the providing micro application.

properties: {
    path: string;
    readinessTopics?: string | string[];
    [key: string]: any;
}

Arbitrary metadata to be associated with the capability.

Type declaration

  • [key: string]: any

    Arbitrary metadata to be associated with the capability.

  • path: string

    Path where the platform can load the activator microfrontend. The path is relative to the base URL of the micro application, as specified in the application manifest.

  • Optional readinessTopics?: string | string[]

    Starting an activator may take some time. In order not to miss any messages or intents, you can instruct the platform host to wait to enter started state until you signal the activator to be ready. For this purpose, you can define a set of topics where to publish a ready message to signal readiness. If you specify multiple topics, the activator enters ready state after you have published a ready message to all these topics. A ready message is an event; thus, a message without payload.

    If not specifying a readiness topic, the platform host does not wait for this activator to become ready. However, if you specify a readiness topic, make sure that your activator has a fast startup time and signals readiness as early as possible not to delay the startup of the platform host.

qualifier?: Qualifier

The qualifier is a dictionary of arbitrary key-value pairs to differentiate capabilities of the same type and is like an abstract description of the capability. It should include enough information to uniquely identify the capability.

Intents must exactly match the qualifier of the capability, if any.

type: Activator

Categorizes the capability in terms of its functional semantics (e.g., microfrontend if providing a microfrontend). It can be an arbitrary string literal and has no meaning to the platform.

Generated using TypeDoc