We use microservices and spring boot in our saas (multi tenant) projects. We will proceed through the schema per tenant. We manage the error messages we show to the users through a database. We are thinking of writing these messages to Redis. These error messages may be common messages used by different microservices. There will be support for localization and the error messages are too many to be managed effectively in a file.
I have different solutions to manage error messages in microservices.
1- Each microservice should keep its own error messages. The database of each microservice is different. Everything looks fine. But how do I manage this in a multi-schema system?
2- I can write a microservice where I can get the required error messages and add the api that will update the redis.But this will create a lot of dependency on other microservices.
3- I can create a jar file. So I write my own library of error messages. I give dependencies in all projects. I need to constantly monitor the version of this jar file. I don't have good experience with jars in state-changing builds. still very addicted
4- I can go to Maven multi module build.
What would you choose or what are your suggestions?
-
@candied_orange I guess he proposed to write an ms that would serve as an "Error code-to-error Message-provider". But who would then provide the "Can't reach error-message provider" error message?tofro– tofro03/22/2022 22:46:43Commented Mar 22, 2022 at 22:46
-
@tofro um, ouch.candied_orange– candied_orange03/22/2022 23:08:25Commented Mar 22, 2022 at 23:08
-
1I can't provide a good answer but I must point out that you're working on a very unusual microservice architecture. Schema-per-tenant is often problematic, but sometimes necessary. But microservices typically do backend stuff and do not have direct end user interaction, so that they wouldn't have to produce human-readable error messages at all. Building a common library to manage error messages (idea #3) goes against the reasons why you'd use microservices: to be able to develop, deploy, and scale services independently. The more I read of your question, the more questions I have...amon– amon03/22/2022 23:46:46Commented Mar 22, 2022 at 23:46
-
More constructively: about these different microservices – how will error messages vary between services? Are these different services with different code bases, or multiple instances of the same service? Will different services require different translations, or do all services need all translations? Will different services share a lot of messages, or are they mostly unique? How frequently will messages/translations change? Do messages change during run time (e.g. if they can be modified by clients) or are messages only changed during the development process, before the service is deployed?amon– amon03/22/2022 23:47:46Commented Mar 22, 2022 at 23:47
-
First of all, thanks for your answer. When I think about the incident, I have a lot of questions for myself. Throwing error messages that users can see over the back-end is a structure that has been created before. I don't think I can knock it down for this project. With different microservice and they all have different task. All translations will support the same 2 languages. These services may need the same language and error messages. We can say that the messages to be used together constitute 10%.Burak Yilmaz– Burak Yilmaz03/23/2022 06:04:19Commented Mar 23, 2022 at 6:04