}, // Now we are able to provide a specific selector:
{
selector: "dispatcher", // <= This is new
}
);
```
Instead of providing a function, the selector can be assigned to the following values. These values insert a default functionality:
| Value | Description |
| - | - |
| `dispatcher` | Tries to execute the service on the requesting dispatcher |
| `first` | Tries to execute the service on the first dispatcher which replied to the request |
| `host` | Tries to execute the service on a random dispatcher found on the same host |
| `cpu-usage` | Tries to execute the service on the dispatcher with the minimal used cpu. To compare the elements the selection considers the available Cores as well |
| `free-ram` | Tries to execute the service on the dispatcher which has free ram |
To define a custom policy, provide the function as follows:
The Parameter options contains the following parameters:
| Parameter | Description |
| - | - |
| `last` | shows that the last dispatcher is being checked. |
| `initalTest`| shows a flag, that the function is just tested. This is important if you want to check all dispatchers and compare them later etc. |
- Adapting Dispatcher:
- Adding/Adapted the Functions `unregisterCallback`. This callback allows to unregister callbacks that are given in a `rpc-call`. See the Example below:
```typescript
// Add the Example Here
```
Therefore the `communication-layers` and `mirros` have to implement additional events ().
- Adding/Adapted the Functions `instanceExists`, `publisherExists` and `subscriptionExists`. These functions allows to check whether the instance / publisher / subscriber exists for the given `identifier` or `topic`
- Added `getInstanceInfo`, a function, which will return the instance description and the corresponding dispatcher.
- Added `getDispatcherForInstance`, a function, which will return the matching dispatcher of the instance.
- Creating Instances: Now the Dispatcher tests, if there is allready an instance with this name and type. If the type miss matches, an **error** is thrown. Otherwise the dispatcher tries to adapt the selector-function.