|
| 1 | +# Multiple protocol versions |
| 2 | + |
| 3 | +## Decision |
| 4 | + |
| 5 | +We will introduce a `protocolVersion` concept that will be carried in the current `protocol` property, that will drive |
| 6 | +the selection the right protocol version for connector to connector communication. |
| 7 | + |
| 8 | +The protocol convention will be `<protocolName>:<protocolVersion>` |
| 9 | + |
| 10 | +## Rationale |
| 11 | + |
| 12 | +Currently, EDC supports only [DSP](https://docs.internationaldataspaces.org/ids-knowledgebase/v/dataspace-protocol) |
| 13 | +in the current stable form. As the spec is evolving, we should prepare the EDC for supporting multiple versions in the |
| 14 | +same EDC runtime. This will enable the communication between two EDC connectors as long as they agree on a common |
| 15 | +supported version. |
| 16 | + |
| 17 | +## Approach |
| 18 | + |
| 19 | +Since we are enriching the `protocol` property with a version, no additional changes is required in `RemoteMessage`s, |
| 20 | +`TransferProcess` and `ContractNegotiation`. |
| 21 | + |
| 22 | +We will refactor `RemoteMessageDispatcherRegistry` to: |
| 23 | + |
| 24 | +```java |
| 25 | +public interface RemoteMessageDispatcherRegistry { |
| 26 | + /** |
| 27 | + * Registers a dispatcher. |
| 28 | + */ |
| 29 | + void register(String protocol, RemoteMessageDispatcher dispatcher); |
| 30 | +} |
| 31 | +``` |
| 32 | + |
| 33 | +and we will remove the `RemoteMessageDispatcher#protocol` method. |
| 34 | + |
| 35 | +This will allow us to register a `RemoteMessageDispatcher` for multiples protocols, which means for example that in the |
| 36 | +context of [DSP](https://docs.internationaldataspaces.org/ids-knowledgebase/v/dataspace-protocol) |
| 37 | +we can register the `DspHttpRemoteMessageDispatcher` for multiple DSP versions while keeping the service injectable. |
| 38 | + |
| 39 | +In the context of [DSP](https://docs.internationaldataspaces.org/ids-knowledgebase/v/dataspace-protocol) implementation |
| 40 | +a protocol version consists of: |
| 41 | + |
| 42 | +- A set of Transformers for `RemoteMessage`s serialization/deserialization. |
| 43 | +- A scoped JSON-LD `@context` configured in the `JsonLd` service. |
| 44 | +- A set of Controllers for receiving protocol `RemoteMessage`s. |
| 45 | + |
| 46 | +We should provide BOMs for protocol versions and any common logic between versions should be extracted in `*-libs`. |
| 47 | + |
| 48 | +### Transformers |
| 49 | + |
| 50 | +Instead of having a single `TypeTransformerRegistry` for the `dsp-api` context, we should have one for |
| 51 | +each [DSP](https://docs.internationaldataspaces.org/ids-knowledgebase/v/dataspace-protocol) supported version. |
| 52 | + |
| 53 | +### JSON-LD `@context` |
| 54 | + |
| 55 | +Currently, we bind [DSP](https://docs.internationaldataspaces.org/ids-knowledgebase/v/dataspace-protocol) specific |
| 56 | +namespaces/contexts definition under the scope `DSP`. We should have multiple configurations for each supported version |
| 57 | + |
| 58 | +### Controllers |
| 59 | + |
| 60 | +We already provide versioned controllers, but each version should have its own `JerseyJsonLdInterceptor` for injecting |
| 61 | +the right JSON-LD scope. This can be achieved using `jakarta.ws.rs.container.DynamicFeature` interface. |
| 62 | + |
| 63 | +The `protocol` + `version` should be added also in `DspRequest` for selecting the right |
| 64 | +`RemoteMessage`s transformers. |
| 65 | + |
| 66 | +## Further considerations |
| 67 | + |
| 68 | +We should expose in the Management context an API for fetching the |
| 69 | +supported [versions](https://docs.internationaldataspaces.org/ids-knowledgebase/v/dataspace-protocol/common-functionalities/common.protocol) |
| 70 | +of a `counterParty` |
| 71 | + |
| 72 | +We might apply in the future a way to automatically negotiate a common supported version if no version is specified. |
| 73 | + |
0 commit comments