Skip to content

[ Dispatcher] Refacto : migration des maps de configuration vers un objet de configuration client - #603

Merged
bou3108 merged 7 commits into
feat/dispatcher/clients-conf-refactofrom
feat/dispatcher/migrate-to-client-config-map
Jul 2, 2026
Merged

[ Dispatcher] Refacto : migration des maps de configuration vers un objet de configuration client#603
bou3108 merged 7 commits into
feat/dispatcher/clients-conf-refactofrom
feat/dispatcher/migrate-to-client-config-map

Conversation

@bou3108

@bou3108 bou3108 commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

🔎 Détails

  • suppression du csv loader dans HubConfiguration
  • suppression des maps de conf éclatées
  • migration vers les ClientProperties de la ClientPropertiesRegistry
  • pour limiter la refacto, la ClientPropertiesRegistry est migrée dans HubConfiguration (hubConfig.getClientVersionsForPerimeter devient hubConfig.getClientPropertiesRegistry().getClientVersionsForPerimeter, même signature).

Ce ne peut être qu'un état transitoire (on préfèrerait gérer la ClientPropertiesRegistry comme un Bean accessible en direct) mais cela évite de trop modifier la classe ConversionUtils

🔗Ticket associé

2. [ Dispatcher ] appeler directement la map de config client plutôt que les maps intermédiaires

@github-actions

Copy link
Copy Markdown
File Coverage [90.57%] 🍏
ConversionUtils.java 98.77% 🍏
HubConfiguration.java 94.89% 🍏
ClientPropertiesRegistry.java 92.31% 🍏
MessageHandler.java 91.48% 🍏
MessageUtils.java 81.22% 🍏
Total Project Coverage 88.98% 🍏

@github-actions

Copy link
Copy Markdown
File Coverage [90.23%] 🍏
ConversionUtils.java 98.77% 🍏
HubConfiguration.java 95.17% 🍏
ClientPropertiesRegistry.java 92.31% 🍏
MessageHandler.java 91.48% 🍏
MessageUtils.java 81.22% 🍏
Total Project Coverage 88.69% 🍏

@bou3108
bou3108 force-pushed the feat/dispatcher/migrate-to-client-config-map branch from b2b0a3d to 869e947 Compare June 12, 2026 12:51
@github-actions

Copy link
Copy Markdown
File Coverage [90.23%] 🍏
ConversionUtils.java 98.77% 🍏
HubConfiguration.java 95.17% 🍏
ClientPropertiesRegistry.java 92.31% 🍏
MessageHandler.java 91.48% 🍏
MessageUtils.java 81.22% 🍏
Total Project Coverage 88.69% 🍏

@bou3108 bou3108 changed the title Feat/dispatcher/migrate to client config map [ Dispatcher] Refacto : migration des maps de configuration vers un objet de configuration client Jun 12, 2026
@bou3108
bou3108 marked this pull request as ready for review June 12, 2026 13:58
Message errorAmqpMessage;
if (convertToXML(sender, hubConfig.getUseXmlPreferences().get(sender))) {
Boolean useXML =
hubConfig.getClientPropertiesRegistry().get(sender) != null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On peut ajouter un helper comme getClientVersionsForPerimeter pour éviter d'avoir à gérer le cas où le client est inconnu.

try {
if (convertToXML(recipientId, hubConfig.getUseXmlPreferences().get(recipientId))) {
Boolean useXML =
hubConfig.getClientPropertiesRegistry().get(recipientId) != null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idem, helper à réutiliser.

String recipientId = getRecipientID(edxlMessage);
String useCase = EdxlUtils.getUseCaseFromMessage(edxlMessage.getFirstContentMessage());
ClientProperties clientProperties =
hubConfig.getClientPropertiesRegistry().get(recipientId);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idem, on peut créer un helper pour inhibitedUseCases.

.getOrDefault(healthActor, DEFAULT_DIRECT_CISU_PREFERENCE);
return directCisuPreference != null && directCisuPreference;

ClientProperties healthActorProperties =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On peut ici aussi créer un helper.

@@ -155,13 +155,10 @@ public static void checkMessageClassNameSupported(
public static void checkMessageNotInhibited(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Est ce qu'on peut refacto cette méthode pour ne pas avoir à lui passer la liste de usecase ? Comme ça évite de la potentielle desynchronisation entre le recipient ID passé en entrée et la liste associé (qui est get grace au recipientId lui aussi).

private String getEditorFromSender(String sender) {
return hubConfig.getClientsEditorMap().getOrDefault(sender, UNKNOWN);
ClientProperties clientProperties = hubConfig.getClientPropertiesRegistry().get(sender);
return clientProperties != null ? clientProperties.editor() : UNKNOWN;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

editor est optionnel dans le schéma de la configuration client. Ici on pourrait renvoyer null (ce qui causerait un crash de la publication des métriques notamment).

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
File Coverage [90.22%] 🍏
ConversionUtils.java 98.77% 🍏
HubConfiguration.java 95.17% 🍏
ClientPropertiesRegistry.java 93.2% 🍏
MessageHandler.java 91.37% 🍏
MessageUtils.java 80.23% 🍏
Total Project Coverage 88.68% 🍏

clients:
- client_id: fr.health.test.samu-v1
common_name: fr.health.test.samu-v1.fr
- client_id: fr.health.samuA

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On ne peut pas rester sur samu-v1 dans les tests comme actuellement ? C'est plus descriptif et à la cible avec un seul périmètre par client.

return perimeter.versions().toArray(String[]::new);
}

public Boolean getClientAcceptedMediaType(String clientId) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C'est un peu étrange qu'on renvoie un booléen ici. Avec ce naming je m'attendrais à un enum avec JSON ou XML. On peut garder quelque chose comme en l'état getClientUseXML sinon ?

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
File Coverage [90.22%] 🍏
ConversionUtils.java 98.77% 🍏
HubConfiguration.java 95.17% 🍏
ClientPropertiesRegistry.java 93.2% 🍏
MessageHandler.java 91.37% 🍏
MessageUtils.java 80.23% 🍏
Total Project Coverage 88.68% 🍏

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
File Coverage [90.34%] 🍏
ConversionUtils.java 98.72% 🍏
HubConfiguration.java 95.17% 🍏
Constants.java 95.16% 🍏
ClientPropertiesRegistry.java 93.41% 🍏
MessageHandler.java 91.37% 🍏
MessageUtils.java 80.23% 🍏
Total Project Coverage 88.68% 🍏

@bou3108
bou3108 merged commit 97bf0f7 into feat/dispatcher/clients-conf-refacto Jul 2, 2026
2 checks passed
@bou3108
bou3108 deleted the feat/dispatcher/migrate-to-client-config-map branch July 2, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants