dongwu9170 2017-07-25 02:53
浏览 8
已采纳

如何使用Golang设计多文件处理器? [关闭]

I'm trying to figure out how to design a service that can handle multiples files format, using micro-services for example:

I have a customer using a file format A, another using format B and other using format C.

After processing a specific format for each customer, I need to transform this format into an common format, and insert into database.

The first thing I tried is to design one service per customer but all of them need to know the base format and if an update is needed in this base format, I need to update all of there services.

I'm trying to decouple the service processor and have a single place to translate to base format.

If my customer services know about the base format, if this format changes, I need to update all of them. If I have a service that translate the format, this service needs to know all customer formats.

How to design this solution?

  • 写回答

1条回答 默认 最新

  • dongxi6897 2017-07-25 05:21
    关注

    Plan internal data format to suit purpose of your application first, it should be convenient for next operations. All the application should work with internal data format and only specific input-output adapters should know about specific customers formats. Then write adapters from custom data formats A, B, C, ... to convert to basic internal format. These adapters should be as thin as possible, they should have minimal logics - just convert data and nothing more. This way it will be easier to maintain them. You are right - if you change internal format you have to review and possibly change all adapters. That's why they should be very thin. Think which defaults can you have? I recommend to start with few customer formats to debug all concepts. Wheather make the solution as a set of microservices of as modules in a single monilith - has no much sense in this way.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂