> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Migration notes

This page explains the changes required to migrate to the stated version
of Atoti What-If.

## Migrate to 2.0.0-AS6.0 and 2.0.1-AS6.0

Upgrading from version 1.9.0 See [Atoti What-If 2.0.0-AS6.0 Release Notes](https://docs.activeviam.com/solutions/libraries/what-if/5.0/dev/dev-release/previous-versions/2.0/release-notes-2.0.md#200-as60).

Atoti What-If is using Atoti Server 6.0.3.

For new features and fixes included in these releases, please see:

* [Release notes for Atoti Server](https://activeviam.com/activepivot/6.0.3/docs/release/changelog/).

### Headline announcement

* **Top to bottom redesign** : The API has been extensively redesigned to reduce coupling between implementation details and simulation parameters and make use of Atoti Server database service APIs. REST services have also been modified accordingly.
* **Simplified deliverables** : Merged the `whatif-core` and `whatif-examples` libraries into a single `whatif` library.
* **Support for distributed simulations** : Simulations are now fully supported in a distributed environment.
* **Removal of Netty messaging** : The distribution implementation based on Netty messaging has been removed.
* **JSON-based persistence** : Simulations are now persisted using JSON-based serialization.
* **Removal of the merge mechanism** : Merging simulations into a parent branch is no longer supported.

### Top to bottom redesign

Definition and simulation objects have been modified to allow easier serialization and leverage Atoti Server database service APIs. For implementation specifics, refer to [Atoti What-If Components](https://docs.activeviam.com/solutions/libraries/what-if/5.0/dev/dev-getting-started/dev-components.md#200) and [Atoti What-If Implementation Example](https://docs.activeviam.com/solutions/libraries/what-if/5.0/dev/dev-getting-started/dev-implementation-example.md#200).

### REST service changes

The following high-level changes have been made to the included REST services:

#### Removals

<table><thead><tr><th>Endpoint</th><th>HTTP method</th><th>Reason</th></tr></thead><tbody><tr><td>services/rest/what-if/getAllSubmissions</td><td>GET</td><td>Redundant data being retrieved.</td></tr><tr><td>services/rest/what-if/getSubmission?subId=xyz</td><td>GET</td><td>Redundant data being retrieved.</td></tr><tr><td>services/rest/what-if/getSpecificSubmission?subId=xyz</td><td>GET</td><td>Redundant data being retrieved.</td></tr><tr><td>services/rest/what-if/getAggregatedInformation?subId=xyz\&taskId=xyz</td><td>GET</td><td>Redundant data being retrieved.</td></tr><tr><td>services/rest/what-if/merge?id=xyz</td><td>POST</td><td>We no longer support merging branches.</td></tr><tr><td>services/rest/what-if/whatIfDefinitions?id=xyz</td><td>DELETE</td><td>Definitions are now plugins and can’t be deleted individually. The specific instance contained in a simulation can only be deleted as part of that simulation.</td></tr></tbody></table>

#### Changes

| Endpoint | HTTP method | New endpoint | Description |
| - | - | - | - |
| services/rest/what-if/whatIfDefinitions | GET | services/rest/what-if/simulations/definitions/ | Now returns a `Set<Object>` containing the simulation definition IDs. |
| services/rest/what-if/whatIfDefinitions?id=xyz | GET | services/rest/what-if/simulations/definitions/{key} | Now returns a `DatabaseSimulationDefinitionDTO` object. |
| services/rest/what-if/whatIfSubmissions | GET | services/rest/what-if/simulations/ | Now returns a list of `DatabaseSimulationDTO` objects. |
| services/rest/what-if/whatIfSubmissions?id=xyz | GET | services/rest/what-if/simulations/{simId} | Refactored with no functional changes. |
| services/rest/what-if/whatIfSubmissions?id=xyz | DELETE | services/rest/what-if/simulations/{simId} | Refactored with no functional changes. |
| services/rest/what-if/execute?id=xyz | POST | services/rest/what-if/simulations/execute/{simId} | Now returns a `DatabaseSimulationDTO` object. |
| services/rest/what-if/whatIfBranches | GET | services/rest/what-if/branches | Refactored with no functional changes. |
| services/rest/what-if/whatIfBranches?id=xyz | GET | services/rest/what-if/branches/{branchId} | Now returns a list of `DatabaseSimulationDTO` objects. |
| services/rest/what-if/whatIfBranches?id=xyz | DELETE | services/rest/what-if/branches/{branchId} | Now returns a `DatabaseSimulationStatus` object. |

#### Additions

| Endpoint | HTTP method | Description |
| - | - | - |
| services/rest/what-if/simulations | POST | Allows the creation of simulations through REST calls. The body is a `DatabaseSimulationDTO` object. |
| services/rest/what-if/version | GET | Retrieves the version of the Atoti What-If library. |
| services/rest/what-if/simulations/{simId}/diff | GET | Retrieves the before and after values for the definition associated with a simulation as a list of `DatabaseSimulationDiffDTO` objects, when implemented in a custom definition. |

### Simplified deliverables

The `whatif-core` and `whatif-examples` libraries have been merged into a single `whatif` library. The packages within the libraries have been updated accordingly, with the removal of the `.core` and `.examples` packages.

### Support for distributed simulations

Simulations are now fully supported in a distributed environment. Atoti What-If leverages Atoti Server database service APIs, with distributed executions being handled through a `RestDistributedDatabaseService` using an `IDistributedQueryResultsMerger`. Within Business Solutions, a query node will use these distributed objects, allowing a single point of entry for the entire cluster.

### Removal of Netty messaging

As the execution of simulations in a distributed environment is now using Atoti Server database service APIs, the following classes have been removed:

<table><thead><tr><th>Class</th><th>Description</th></tr></thead><tbody><tr><td>BranchesFinderMessenger</td><td>Messenger for discovering branches in a cluster.</td></tr><tr><td>BranchesRetrivalMessenger</td><td>Messenger for discovering branches per address in a cluster.</td></tr><tr><td>BranchQuerierMessenger</td><td>Messenger for querying a branch in a cluster.</td></tr><tr><td>DatastoreInfoMessenger</td><td>Messenger for retrieving all datastore information from a cluster.</td></tr><tr><td>DatastoreMetadataMessenger</td><td>Messenger for retrieving condensed datastore metadata from a cluster.</td></tr><tr><td>DeleteBranchMessenger</td><td>Messenger for deleting branches in a cluster.</td></tr><tr><td>EpochMessenger</td><td>Messenger for retrieving the epoch of the main branch.</td></tr><tr><td>ExecuteSubmissionMessenger</td><td>Messenger for executing the simulations on a cluster.</td></tr><tr><td>QuerierMessenger</td><td>Messenger for querying datastores in a cluster.</td></tr><tr><td>RollbackMessenger</td><td>Messenger for reverting branch changes in a cluster.</td></tr><tr><td>WhatIfDistributedController</td><td>Messaging Agent that monitors the cluster for changes.</td></tr><tr><td>WhatIfDistributedEngine</td><td>What-if engine implementation that leverages distributed messengers to execute simulations on a cluster.</td></tr><tr><td>WhatIfDistributedExceptionHandler</td><td>What-if exception handler that sends RollbackMessenger instances when exceptions are triggered in the cluster.</td></tr></tbody></table>

The distributed simulations are now using the same engine as local simulations, with the addition of the following classes:

<table><thead><tr><th>Class</th><th>Description</th></tr></thead><tbody><tr><td>IDistributedQueryResultsMerger</td><td>Interface for merging results from distributed queries.</td></tr><tr><td>DefaultDistributedQueryResultsMerger</td><td>Implementation of the `IDistributedQueryResultsMerger` with support for all operations included in `IDatabaseService`.</td></tr><tr><td>DefinitionParser</td><td>Implementation of `IParser` for `DatabaseSimulationDefinitionDTO` objects.</td></tr><tr><td>StatusParser</td><td>Implementation of `IParser` for `DatabaseSimulationStatus` objects.</td></tr><tr><td>RestDistributedDatabaseService</td><td>Implementation of `IDatabaseService` that executes operations against multiple `RemoteDatabaseService` instances and leverages the `IDistributedQueryResultsMerger` to merge the results.</td></tr></tbody></table>

### JSON-based persistence

Simulations are now persisted using JSON serialization. The `DatabaseSimulation` and `DatabaseSimulationDefinition` objects and associated DTOs (`DatabaseSimulationDTO` and `DatabaseSimulationDefinitionDTO`) contain easily serializable parameters. The execution logic is now decoupled from the instance parameters, allowing instances created by the persistence manager to execute seamlessly.

### Removal of the merge mechanism

Merging the results of simulations into the parent branch is no longer possible. For a secured implementation backed by workflows, use the [Sign-off Module](https://docs.activeviam.com/products/modules/signoff/latest/online-help/).
