mercredi 1 avril 2020

Is there any best practice for message centralization in microservices?

Simply put I'd like to centralize any message with a code and a custom message that, in the future, could support translating.

So, my idea would be to list all couples:

MSG1= new Message("M1", "Howdy");
MSG2 = new Message( "M2", "ehy");

and, in my application, I just do:

throw new MyException(MSG1);

or

myResponse.addMessage(MSG2);

Now the main question, how do I store messages?

  1. Static class/enumeration
  2. External property file
  3. Database

All 3 are feasible but is there any "standard" approach? Moreover I'm assuming to create a custom library for this, but isn't there any premade one that I can include?

Aucun commentaire:

Enregistrer un commentaire