-2

I'm writing a new microservice app. event driven app.
The app handles crypto currency wallets.

There is a service: "Coin Service", this one holds data that every other service need access to.

I have 10 services, 9 out of 10 services needs to have access to coin service data.
I dont want to sync all of its data 9 times to the other services...
On the other hand, I dont want to allow access via api to other service. it would become a monolith if i open the data to an api...

How can such thing be handled?

Thanks

3
  • 2
    Sounds like you're forcing microservices onto a system which isn't suitable for them. Jun 16 at 7:55
  • @PhilipKendall All the other services are pretty decoupled.
    – SexyMF
    Jun 16 at 8:16
  • decoupling only really matters at a system level.
    – Ryathal
    Jun 16 at 12:46

1 Answer 1

3

Do the other services need access or do they just need a pointer id to a thing in the coin service? If every service just needs a reference to walletID that's perfectly fine, no need to replicate data all over the place.

If you really do need data then you need to redesign your services, because you don't have a useful abstraction. You came up with 10 services, maybe you really only need 5. If a microservice can't do something that is valuable from a business perspective without interacting with other services, it's a good sign you are going too micro. If every service needs to talk to a single other service, it could be sign your domains aren't properly thought out or are too thin.

2
  • Thank you. In some of the cases, the need is for data to render the UI. so for example I want to break down wallet most popular coins broken by coin category. Is it ok to implement it in the api gateway? so in the API: Ask for data from the wallet service, Ask for data from coin service and do the calculation?
    – SexyMF
    Jun 19 at 5:41
  • yes you can have a gateway endpoint that in reality calls 3 different services and stitches their outputs together. It can be tempting to start putting business logic in the gateway, and that is a problem.
    – Ryathal
    Jun 20 at 12:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.