> For the complete documentation index, see [llms.txt](https://mars-15.gitbook.io/dispatchito/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mars-15.gitbook.io/dispatchito/basic-functionality/management.md).

# Management

Managing the system allows for:

1. Initial setup
2. Clearing topics of subscriptions
3. Cleaning up stale bindings

#### Setup

Achieved by calling `Setup` function. Currently the only purpose is to manage the automated cleanup of stale bindings. By default the system runs the cleanup every 30 seconds. You can change the interval by modifying a `CleanupInterval` parameter. You can also disable the cleanup entirely by setting `CleanupStaleBindings` to false. The function can be called at any point to allow for fine-tuning of the whole process. This is the only function that has no counterpart in the Blueprint Library.

{% tabs %}
{% tab title="Blueprint" %}

<figure><img src="https://1181272575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfQy1REqz5GdSLZ1Mbpoo%2Fuploads%2FEyBGYEZGuEvkmvkboL9F%2Fimage.png?alt=media&amp;token=e3dbed72-894b-4f6d-af9f-88216121630b" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="C++" %}

```cpp
UDispatchitoSubsystem* subsystem = GEngine->GetEngineSubsystem<UDispatchitoSubsystem>();

bool cleanupStaleBindings = true;
float cleanupInterval = 30;

subsystem->Setup(cleanupStaleBindings, cleanupInterval);
```

{% endtab %}
{% endtabs %}

#### Clearing topics

Achieved by calling either `ClearTopic` and providing single topic to be cleared or `ClearAllTopics` to have all the topics cleared. This removes all the subscriptions made to topic(s).

{% tabs %}
{% tab title="Blueprint" %}

<figure><img src="https://1181272575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfQy1REqz5GdSLZ1Mbpoo%2Fuploads%2FZSeMBJtyqpAqAszLt5Ya%2Fimage.png?alt=media&amp;token=d6c0131b-a19e-4901-9f0b-5040f33f6653" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="C++" %}

```cpp
UDispatchitoSubsystem* subsystem = GEngine->GetEngineSubsystem<UDispatchitoSubsystem>();

subsystem->ClearTopic(EventTopic);

subsystem->ClearAllTopics();
```

{% endtab %}
{% endtabs %}

#### Cleaning up stale bindings

Achieved by calling `CleanupStaleBindings` function. By default this is called every 30 seconds so there is no need to call it manually. If automated cleanup is disabled, consider calling it from time to time if your case entails many bound objects being created and destroyed without prior calls to unsubscribe them or their bindings.

{% tabs %}
{% tab title="Blueprint" %}

<figure><img src="https://1181272575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfQy1REqz5GdSLZ1Mbpoo%2Fuploads%2FTflKJVPstIf7irx5YIsp%2Fimage.png?alt=media&amp;token=d3deb707-814e-42ba-ba62-cf2ec17edc50" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="C++" %}

```cpp
UDispatchitoSubsystem* subsystem = GEngine->GetEngineSubsystem<UDispatchitoSubsystem>();

subsystem->CleanupStaleBindings();
```

{% endtab %}
{% endtabs %}
